antlr / intellij-plugin-v4

An IntelliJ plugin for ANTLR v4
https://plugins.jetbrains.com/plugin/7358-antlr-v4
BSD 3-Clause "New" or "Revised" License
468 stars 104 forks source link

Ambiguity and lookahead popups don't show up with the right click in the input window #544

Closed parrt closed 2 years ago

parrt commented 2 years ago

See PreviewEditorMouseListener.rightClick(). In MyActionUtils.java this appears to be returning an empty array every time:

    @NotNull
    public static List<RangeHighlighter> getRangeHighlightersAtOffset(Editor editor, int offset) {
        MarkupModel markupModel = editor.getMarkupModel();
        // collect all highlighters and combine to make a single tool tip
        List<RangeHighlighter> highlightersAtOffset = new ArrayList<>();
        for (RangeHighlighter r : markupModel.getAllHighlighters()) {
            int a = r.getStartOffset();
            int b = r.getEndOffset();
            if (offset >= a && offset < b) { // cursor is over some kind of highlighting
                highlightersAtOffset.add(r);
            }
        }
        return highlightersAtOffset;
    }
parrt commented 2 years ago

@bjansen this might or might not be a problem actually. I might have tested it on input and grammar that would not exhibit an ambiguity or need look ahead. Looking at it now...

parrt commented 2 years ago

This works. Must click on decision in Profiler tab to select then right click in input pane to get ambig parse trees or trees associated with lookahead.