Skip to content
Snippets Groups Projects
Commit 26055285 authored by Johannes Mey's avatar Johannes Mey
Browse files

tooltip with link also for nonterminals

parent b24b6e96
No related branches found
No related tags found
No related merge requests found
......@@ -38,9 +38,9 @@ public class GeneratedCodeUtil {
int line;
try {
line = Integer.parseInt(jastAddFileLocation.substring(pos + 1));
line = Integer.parseInt(jastAddFileLocation.substring(pos + 1).trim());
} catch (NumberFormatException e) {
line = 0;
line = 1;
}
if (vFile == null) {
return Paths.get(path).getFileName() + (line == 0 ? "" : ":" + line);
......
......@@ -16,6 +16,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
import static org.jastadd.tooling.grammar.GrammarUtil.asReferenceToTypeDecl;
import static org.jastadd.tooling.java.GeneratedCodeUtil.getNavigationUrlFromFileLocation;
public class NonterminalUseAnnotator implements Annotator {
......@@ -39,12 +40,13 @@ public class NonterminalUseAnnotator implements Annotator {
return;
}
String production = Arrays.stream(productionTag.getDataElements()).map(PsiElement::getText).collect(Collectors.joining());
String reference = getNavigationUrlFromFileLocation(declaredAt);
holder.newAnnotation(HighlightSeverity.INFORMATION, "JastAdd Nonterminal: " + production)
.range(element.getTextRange())
.highlightType(ProblemHighlightType.INFORMATION)
.textAttributes(JavaSyntaxHighlighter.NT_USE)
.tooltip("<b>JastAdd Nonterminal</b><br/>Production: <i>" + production + "</i><br/><i>Declared at </i>" + declaredAt)
.tooltip("<b>JastAdd Nonterminal</b><br/>Production: <i>" + production + "</i><br/><i>Declared at </i>" + reference)
.create();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment