vscode-java
vscode-java copied to clipboard
Find by symbol don't open maven reference classes
Try to find a class (find symbols) that is referenced by maven dependencies. The class is found by the symbol search

When I type enter to open the class It doesn't open. If I go to a class that uses that class and do command+click it will open the class and from now on the search by symbol opens the class.
vscode isn't in the lightweight mode as you can see in the following picture.

Thanks
I think it's because the first time when you try to open the class, the source jar is not downloaded yet.
When you go to the definition via command+click, a source downloading job is kicked off. After the source is available, you can view it via symbol search.
You can enable source downloading jobs during import process via the setting java.maven.downloadSources.
@jdneo Thanks for the reply. I applied the settings and tried (without restarting vscode) with other class and it worked. Then I restarted vscode and it started download all the sources in my dependencies (took forever) 😟
My impression is that setting works as workaround but not as a definitive solution, vscode should download the specific java source when I try to open based on find by symbol instead everthing.
Can you consider this suggestion in your roadmap please?
BTW, just one more question. When you say When I type enter to open the class It doesn't open., does that mean nothing happens, or it opens a file which in the header says Failed to get sources. Instead, stub sources have been generated by the disassembler....?
It means that nothing happens :)
Maybe this was the real fix: https://github.com/eclipse/eclipse.jdt.ls/issues/2087
What do you think?
That fix should be contained in the latest redhat.java extension. Are you still encountering this issue with the latest version?
Sorry for the late reply. What I did to test was, remove the java.maven.downloadSources from settings, deleted the jar and sources from local maven repository and start vscode. I was able to open the file in a decompiled version but the source was downloaded (i saw it in local maven repo). I close the file and opened again and the decompiled version appeared. I restarted vscode and after that I was able to see the source.
Maybe is possible to do something here please :P