<div dir="ltr">IDEs use semantic information to navigate and highlight/colour code.<div><br></div><div>By semantic info I mean something like...</div><div>```</div><div>  String foo;    // line 2</div><div>...</div><div>  println(foo);   // line 15</div><div>```</div> On line 2 columns 3->9 there is a reference to `java.lang.String`<div> On line 2 columns 10->13 there is a variable called `foo` of type `java.lang.String`.</div><div> On line 15 columns 11->14 there is a reference to a local variable `foo` of type `java.lang.String`</div><div><br></div><div>So in an IDE I could run `Go to definition` on line 15 column 11 and be taken to line 2 column 10.</div><div>Or I run `Go to definition` on line 2 column 5 and be taken to some position in `java/lang/String.java`.</div><div><br></div><div>Currently IDEs have to parse the source file to discover this semantic information.</div><div>Or they can use a compiler plugin like <a href="https://github.com/sourcegraph/scip-java">https://github.com/sourcegraph/scip-java</a>.</div><div><br></div><div>In the compiler plugin's case, semanticdb files are output alongside class files.</div><div>The semantic db files can then be read by the IDE instead of it having to parse the source.</div><div><br></div><div>The advantage of the plugin is that the parsing is driven by the compiler so the semantic info should always be correct.  Also - the IDE doesn't have to contain a java parser that must be up to date.</div><div><br></div><div>I think the plugin idea originally came from work on a plugin for Scala.  Since then, Scala has integrated the plugin code into its compiler so a user can just specify a compiler option to get Scalac to output the semanticdb files instead of having to download and configure a plugin.</div><div><br></div><div>I'd like to see the same happen with Java and have javac output semantic files when supplied with the relevant javac option.</div><div><br></div><div>I'd also like to see these files outputted into `-sources.jar` files with the original source. Or maybe in their own `-semantic.jar`.  It would mean that IDEs no longer have to parse library files to be able to navigate them, instead they'd just load directly from the distributed semantic files.</div><div><br></div><div>The benefits of this are reducing load on the many LSPs/IDEs out there, speeding up the generation of this information (it's already in the compiler) and ensuring correctness as the compiler should be the font of all compilery knowledge.</div><div><br></div><div>regards</div><div>Arthur</div></div>