ABckh / zed-java-eclipse-jdtls

Eclipse Public License 2.0
28 stars 3 forks source link

Make .class files readable, it would make possible to go to definition to source files #16

Open ABckh opened 4 months ago

maximstewart commented 3 months ago

Would this be why ctrl+l_clicking gives me a reference window instead of the src definition? I was wondering if I should open another issue or not. I'm using Linux (Arch).

ABckh commented 3 months ago

Hi, @maximstewart! I have just checked and it works fine, the only difference zed has compared to IntelliJ, it opens references window if ctrl click to the name of the class or method, and if you ctrl click to the method call or class in constructor it works as expected.

Hope it makes sense, let me know if you have any questions

maximstewart commented 3 months ago

So, I guess my question is is this a function of the Zed plugin or Eclipse JDTLS? For example, I go to definition when ctrl click in Python code so would like to do that here too.

Also, for "...and if you ctrl click to the method call or class in constructor it works as expected." I'm not sure I understand. (Or my setup isn't working correctly.)

For the below, ctrl clicking any of the decorators or imports (unless the import is my code) just gives me references. Fopr my code it jumps me to the actual class. scrshot_2024-07-27 13:07:50

and for the below ctrl clicking sha256Hex for the DigestUtils gives me references as well than jumping to the definition.

scrshot_2024-07-27 13:18:28

ABckh commented 3 months ago

I guess there is something wrong with your setup, this is how it works for me: https://streamable.com/f52dnu

When we try to 'Go to definition' for one of the classes defined in your project, it works fine. However, when we try to go to the definition of one of the source classes, such as 'String', nothing is shown.

I can see that some of the classes are marked red, I would assume that the project is not initialised, please make sure you opened the right dir.

Let me know if you have any questions

maximstewart commented 3 months ago

"I can see that some of the classes are marked red, I would assume that the project is not initialised, please make sure you opened the right dir."

Yeah, I'm unsure myself as when hovering over String it says "Java: String cannot be resolved to type." but hovering over DigestUtils gives me the documentation like so:

scrshot_2024-07-30 22:10:31

I do see files getting generated for the project when opening it with Zed and the plugin. Those files and folders are a .settings folder with sub files in it, a .classpath file, a .factorypath file, and a .project file. I tried looking through the Zed logs and nothing in particular stood out besides the following which when I looked into seemed maybe related to Issue 15

scrshot_2024-07-30 22:18:54

ABckh commented 3 months ago

@maximstewart can you open the same project in any ide (IntelliJ, vscode) without those errors? If You have 2 jdtls installed, can you please check that the extension is taking the right one?

maximstewart commented 3 months ago

So, I downloaded VSCodium and with the exception of "String" and "Files" classes I believe it's the same as Zed in terms of the: "XYZ String cannot be resolved to type" message. That being said, I can ctrl click into classes like the "PostMapping". By the way, trying to right click and do the Go to Definition option in the context menu NOR using the keyboard shortcut work to jump to it in Zed. Nothing happens with either action.

scrshot_2024-08-02 23:42:14

I will add that I do get the following in VSCodium which feels a little odd:

scrshot_2024-08-02 23:43:12

But, I'm almost inclined to think the above is more the plugin I'm using in VSCodium maybe being Redhat based even though it's using Eclipse JDTLS as its base. That plugin is the following:

scrshot_2024-08-02 23:52:45

EDIT:

To add to your other request, as far as I know I only had the one JDTLS installed until using the VSCodium baased plugin that uses it too. But, in the ~/local/share/zed/extensions/{installed,work} paths there is only one instance/plugin shown.

scrshot_2024-08-03 00:02:27

ABckh commented 2 months ago

@maximstewart sorry for long reply, is this project open sourced? so I could clone it and check if it works on my machine. My guess that the problem is with your environment, not with extension. Please try to resolve the issues which you see in VSCode and let me know, if you have any other questions

maximstewart commented 2 months ago

No worries on slow reply as I'm grateful for any help as is. =) As for the code you can pull it from here:

https://code.itdominator.com/itdominator/thumbnail-api

I have been busy myself but will try to look at what's going on VSCode side this weekend or as soon as I am free to do so.

ABckh commented 2 months ago

@maximstewart I have checked the project and it works on my machine :) Try to completely delete jdtls from your computer as well as the extension from zed and then reinstall it from scratch.

Regarding List problem you have, you are using List from hibernate and you are trying to use it as default List interface List<ThumbnailDto>, but it works differently (docs). I think you just need to use default List from java.util.List instead in your application code.

maximstewart commented 2 months ago

Hey, I'm sorry. I thought I replied to your prior post but looks like I didn't hit Comment. Anyway, I got some free time to look and made some progress with at least getting VSCode to not be so upset.

I ended up downloading a JDK from Oracle and pointing to it. (Even though the path that VSCode complains about exists and states it's openjdk in the name.) Anyway, that made the bubble go away but still didn't fix ctrl+clicking on Path object and directing me to the definition. BUT, I found out something interesting and that is that if I manually add to the import list

import java.nio.file.Path;

and THEN ctrl+click in VSCode it will actually take me to the definition- weird.

As for java.util.List , hmmmmm, I woulda sworn I had it as such but at this point don't really know. Really embarrassing either way as I see the same along the chain of calls. That actually does clear the error in Zed when converting to util's List. In addition, manually adding the import for Set clears the related errors too. I still can't go to definition as I'd like but it's progress.

Last, but not least, I will look to try purging and reinstalling everything soon per your last request.

maximstewart commented 1 month ago

@ABckh I see our prior convo is marked as off topic. Sorry about that. I didn't want to leave you hanging so am finisahing the convo out by saying I've decided to take an alternate path so am not needing the stuff I had issues with to work anymore. Thank you for your attempted assistence and time, though.

ABckh commented 1 month ago

@maximstewart No problem at all, I marked it as off topic as it has nothing to do with .class files, so please feel free to create new issue and I will try to help you!