vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Find by symbol don't open maven reference classes

Open raulvaldoleiros opened this issue 3 years ago • 7 comments

Try to find a class (find symbols) that is referenced by maven dependencies. The class is found by the symbol search image

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. image

Thanks

raulvaldoleiros avatar May 27 '22 11:05 raulvaldoleiros

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 avatar Jun 15 '22 01:06 jdneo

@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?

raulvaldoleiros avatar Jun 15 '22 09:06 raulvaldoleiros

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....?

jdneo avatar Jun 15 '22 12:06 jdneo

It means that nothing happens :)

raulvaldoleiros avatar Jun 15 '22 13:06 raulvaldoleiros

Maybe this was the real fix: https://github.com/eclipse/eclipse.jdt.ls/issues/2087

What do you think?

raulvaldoleiros avatar Jun 16 '22 07:06 raulvaldoleiros

That fix should be contained in the latest redhat.java extension. Are you still encountering this issue with the latest version?

jdneo avatar Jun 16 '22 08:06 jdneo

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

raulvaldoleiros avatar Jun 22 '22 08:06 raulvaldoleiros