Skip to content
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

Merged
merged 3 commits into from
Oct 10, 2023
Merged

Fix for issues #41 and #42 #44

merged 3 commits into from
Oct 10, 2023

Conversation

FHannes
Copy link
Contributor

@FHannes FHannes commented Sep 14, 2023

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.

- 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
@bjansen
Copy link
Collaborator

bjansen commented Sep 14, 2023

Were you able to reproduce the problem before trying to fix it, and if so do you happen to have the HighlightBracketPair installed?

@FHannes
Copy link
Contributor Author

FHannes commented Sep 14, 2023

@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.

@bjansen
Copy link
Collaborator

bjansen commented Sep 14, 2023

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.

@FHannes
Copy link
Contributor Author

FHannes commented Sep 15, 2023

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.

@bjansen bjansen merged commit e33ffa3 into antlr:master Oct 10, 2023
4 checks passed
@bjansen
Copy link
Collaborator

bjansen commented Oct 10, 2023

Thanks for the fix!

@BillBaird
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants