redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.05k stars 420 forks source link

"Go to symbol" should prioritize local classes #3670

Open gsturov opened 3 weeks ago

gsturov commented 3 weeks ago

I have local Start class in my source code. When I use "Go to symbol" dialog to navigate to that class and type "Start" I have a bunch of Start classes from different libs on the top of the list and my class on the bottom. The assumption should be that by default I am interested in my own class, so that class should be on the top of the list.

rgrunber commented 3 weeks ago

I think the client itself (VS Code ) is controlling this. We have had issues in the past simply getting the client to show certain symbols we felt should be included (eg. *) that the client interpreted literally. See also issues like https://github.com/microsoft/vscode/issues/98125 .

Here's the order of elements from the language server for a given example :

sun.security.tools.jarsigner.Main
com.sun.tools.script.shell.Main
jdk.jfr.internal.tool.Main
sun.net.httpserver.simpleserver.Main
com.sun.tools.jdeps.Main
sun.security.tools.keytool.Main
javax.swing.colorchooser.DefaultSwatchChooserPanel.MainSwatchListener
jdk.jpackage.main.Main
com.sun.tools.javac.Main
jdk.internal.misc.MainMethodFinder
com.sun.tools.javac.main.Main
com.sun.tools.javap.Main
jdk.tools.jlink.internal.Main
javax.swing.colorchooser.DefaultSwatchChooserPanel.MainSwatchKeyListener
com.sun.tools.javac.launcher.Main
jdk.tools.jimage.Main
jdk.tools.jmod.Main
sun.tools.jar.Main
org.example.Main
jdk.javadoc.internal.tool.Main
org.example.Main.main
sun.jvm.hotspot.utilities.WorkerThread.MainLoop
javax.swing.colorchooser.MainSwatchPanel
com.sun.tools.jdeprscan.Main
com.sun.tools.javac.launcher.Main.MainClassListener

and here's the actual displayed order :

image