-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for issues #41 and #42 #44
Conversation
- Updated Gradle wrapper to version 8.3 - Converted Gradle build script to Kotlin syntax - Updated Java version to 17 - Updated minimum IntelliJ version to 2022.2.5 - Resolved NPE issues #41 and #42 - Updated icon and filetype registration which used deprecated APIs - Updated ANTLR to version 4.13.1
Were you able to reproduce the problem before trying to fix it, and if so do you happen to have the HighlightBracketPair installed? |
@bjansen I don't get any errors in the IDE (I don't use HighlightBracketPair). We make an internal plugin that among other things, adds some specific functionality for our own string template files. I ran into the exception there, because it depends on the st4 plugin and targets a fairly recent version of IntelliJ. |
I asked because both #42 and antlr/intellij-plugin-v4#654 seem to involve HighlightBracketPair trying to use our classes before our parser definitions are instantiated. |
I've tried version 0.9 together with HighlightBracketPair and successfully reproduced the exception when starting IntelliJ (2023.2.2). When updating to my patched version, the exception no longer occurred after restarting. I tried starting with projects that do and do not contain any stg files and in neither case the error occurred after the patch. |
Thanks for the fix! |
So if I read this correctly, the fix is to the plugin itself, but a fixed version of the plugin has not been issued? Can we expect an updated version with the fix to be released? I use this with Rider and don't even have gradle installed. Having looked at the antlr repo, I see that I would need to clone the antlr repo, build it myself, and then install the plugin manually? Am I missing something? |
Hi,
I implemented a fix for issues #41 and #42. I am not sure how this worked originally, but the problem seemed to be caused by a change in the order of classes being loaded by IntelliJ. I wasn't entirely sure if it mattered that the token registration for the languages happened immediately when the classes were loaded, so I added some lazy loading where the issue was occurring to register the languages with the token cache if had not been registered previously.
I also updated the minimum target version to IntelliJ 2022.2.5. I wanted to target a more recent version, but it seemed to be more reasonable to still provide compatibility with some older versions. Not sure if it is supposed to be compatible with even older (or only newer) versions. In light of this, I also updated some uses of deprecated APIs and such.
Since Jetbrains seems to be trying to phase out the use of Groovy-based Gradle scripts everywhere, I also converted the script here to the Kotlin DSL.