vscode-antlr4 icon indicating copy to clipboard operation
vscode-antlr4 copied to clipboard

No rule selected

Open amryounis opened this issue 2 years ago • 7 comments

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". image

amryounis avatar Oct 24 '23 08:10 amryounis

Experiencing the same. It's my first time using this extension so assumed there was something wrong with how I was using it.

pvanb avatar Nov 14 '23 20:11 pvanb

It's important to place the caret within a rule's text. Then it should work.

mike-lischke avatar Nov 14 '23 20:11 mike-lischke

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

amryounis avatar Nov 15 '23 09:11 amryounis

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.

mike-lischke avatar Nov 25 '23 19:11 mike-lischke

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.

constantOut avatar Aug 21 '24 21:08 constantOut

BTW, awesome plugin! Thank you very much for you work!

constantOut avatar Aug 21 '24 21:08 constantOut

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.

mike-lischke avatar Aug 22 '24 06:08 mike-lischke