Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find by symbol don't open maven reference classes #2475

Open
raulvaldoleiros opened this issue May 27, 2022 · 7 comments
Open

Find by symbol don't open maven reference classes #2475

raulvaldoleiros opened this issue May 27, 2022 · 7 comments

Comments

@raulvaldoleiros
Copy link

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

@jdneo
Copy link
Collaborator

jdneo commented Jun 15, 2022

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 jdneo added the question label Jun 15, 2022
@raulvaldoleiros
Copy link
Author

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

@jdneo
Copy link
Collaborator

jdneo commented Jun 15, 2022

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

@raulvaldoleiros
Copy link
Author

It means that nothing happens :)

@raulvaldoleiros
Copy link
Author

Maybe this was the real fix: eclipse-jdtls/eclipse.jdt.ls#2087

What do you think?

@jdneo
Copy link
Collaborator

jdneo commented Jun 16, 2022

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

@raulvaldoleiros
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants