vscode-antlr4
vscode-antlr4 copied to clipboard
No rule selected
I experience unstable behavior from the extension. once installed the first time, it worked fine. later on, all right click commands for displaying graphs reveal this message "No rule selected".
Experiencing the same. It's my first time using this extension so assumed there was something wrong with how I was using it.
It's important to place the caret within a rule's text. Then it should work.
this behavior cause is inconsistent. sometimes it comes after closing VSCODE and reopening it later. the only fix i found is to make any edit and save the g4 file. saving with no edit does not fix it
To help with issues like this I added a log feature to the extension. So, when you see a problem open the OUTPUT tab in VS Code and switch to the ANTLR4 Output channel. Then paste the content here.
Same problem only call graph diagram is built. ANTLR OUTPUT shows this on edit of grammar file: Running Java with parameters: -jar c:\Users\acc4k.vscode\extensions\mike-lischke.vscode-antlr4-2.4.6\node_modules\antlr4ng-cli\antlr4-4.13.2-SNAPSHOT-complete.jar -message-format antlr -o d:\Projects\BtrQL\src\main\grammar.antlr -no-listener -no-visitor -Xexact-output-dir d:\Projects\BtrQL\src\main\grammar\Grammar.g4
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: org/antlr/v4/Tool has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
I updated JDK from 21 with GraalVM to 22 and it fixed the issue.
BTW, awesome plugin! Thank you very much for you work!
Just yesterday I had the same error in a different context and it turned out that the Java version from Oracle uses a smaller class file versions (52). When you install an OpenJDK Java version (at least 20) this issue should be gone.