intellij-plugin-v4 icon indicating copy to clipboard operation
intellij-plugin-v4 copied to clipboard

Add warning to "ANTLR Preview" pane for grammars with actions

Open kaby76 opened this issue 2 years ago • 10 comments

A warning should appear in the "ANTLR Preview" pane if it uses rules that contain an action. People never read "readme's". See this StackOverflow question.

kaby76 avatar Apr 08 '22 11:04 kaby76

People never read "readme's.

Sometimes they read but you are right, it should be uderstandable without readme. It makes sense to add a warning about actions and sematics predicates using together with plugin.

KvanTTT avatar Apr 08 '22 11:04 KvanTTT

Where should this morning appear? There's not much room in the GUI input area.

parrt avatar Apr 23 '22 22:04 parrt

I'm not sure what the window is called, but it's under the LHS of the ANTLR Preview pane, under the radio buttons "Input" and "File", and under the MLE window for text input: it's a fixed window for text output for parse errors. Note, it has issues in itself: it's fixed in size to display 3 lines, although it does have a scroll bar. Even if I undock the entire ANTLR Preview pane and resize the window, it's still three lines. To do anything with it, I have to select all text and copy the text into Emacs to work with it. But, this seems the right area to place all warnings and errors.

kaby76 avatar Apr 24 '22 11:04 kaby76

Hmm... Maybe it should just replace the morning that I have now about having to select a rule to get started. On the other hand I just added something to the documentation for https://github.com/antlr/intellij-plugin-v4/issues/519 so maybe I should work on some of the bugs before release instead?

parrt avatar Apr 24 '22 17:04 parrt

Here's a proposal:

image

The message WARNING: predicates and actions are not run by this interpreter. Results may vary from the actual generated parser! will appear only once per input (even if there are multiple actions matched).

Also, the error console is now resizable:

image

bjansen avatar Apr 27 '22 20:04 bjansen

Without the resize, it was difficult to see anything, especially for plsql where it would output huge sets of symbols the parser would be expecting. This looks better, although I am not a fan of line wrapping (optional?).

kaby76 avatar Apr 27 '22 20:04 kaby76

I am not a fan of line wrapping (optional?).

The current version already works like this. Would you rather see a horizontal scrollbar?

bjansen avatar Apr 27 '22 20:04 bjansen

Can you toggle between wrapping and scrolling with a right mouse click popup context menu or something? Not a priority though. I can select, copy, paste the text in emacs for searching, saving, etc.

kaby76 avatar Apr 27 '22 20:04 kaby76

Does it make sense to use IDEA notifications, maybe it looks more natively and expected, see https://www.jetbrains.com/help/idea/notifications.html

KvanTTT avatar Apr 27 '22 21:04 KvanTTT

Hi guys, sorry for the delay. Just getting back to this. Notifications API could make sense, but then they have to make sure that that tab is open. Perhaps it's better just to toss that note into the console for antlr shown here.

parrt avatar Apr 29 '22 17:04 parrt