Open Equiphract opened 7 months ago
I don't know anything about vim, but seems like there's a vim-lsp plugin that should do all the config for you https://github.com/mattn/vim-lsp-settings
I tried to stay away from that plugin since the idea of having a plugin to handle another plugin's configuration seemed odd to me. Nevertheless, I now installed it and tried it out - and disabled all my handwritten configuration - and still experience more or less the same behaviour which almost seems like a freezing of the language server's functionality after one request (one request sometimes works but after that none work). One major difference now is that I now get an App.java is a non-project file, only syntax errors are reported warning at the top of my file. That is something I have seen in the logs before and was wondering why. I was of the impression that this language server is able to recognise Maven projects,
Judging from the logs it can't load the problem properly:
jdt.ls-java-project does not exist\nJava Model Exception: Error in Java Model (code 969): jdt.ls-java-project does not exist\n\tat org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:572)\n\tat org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:233)\n\tat org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:585)\n\tat org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:308)\n\tat org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:294)\n\tat org.eclipse.jdt.internal.core.JavaElement.getChildren(JavaElement.java:249)\n\tat org.eclipse.jdt.internal.core.JavaProject.getPackageFragmentRoots(JavaProject.java:2294)\n\tat org.eclipse.jdt.internal.core.JavaProject.getPackageFragments(JavaProject.java:2318)\n\tat org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.cleanupResources(ProjectsManager.java:345)\n\tat org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:120)\n\tat org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:263)\n\tat org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)\n\tat org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)\n","type":1}}}]
Wed 03 Apr 2024 07:36:02 PM CEST:["<---",1,"eclipse.jdt.ls",{"response":{"method":"language/status","jsonrpc":"2.0","params":{"message":"jdt.ls-java-project does not exist","type":"Error"}}}]
I think this might be caused by setting -data
to the project repository:
\ '-data',
\ getcwd()
Can you try using a location that's outside of it?
There should also be a .metadata/.log
file within the data folder, which might give you additional pointers on what's wrong.
When using the vim-lsp-settings plugin, -data
is set to /home/me/.local/share/vim-lsp-settings/servers/eclipse-jdt-ls/data
and there is also a .metadata/.log
present. However, I do not see anything interesting in there, but I will attach it here anyways:
Maybe, grasping at straws here, the structure of the data directory gives you insight on what is happening, so I will attach it here too:
Hi there.
I've spent most of my morning configuring eclipse JDTLS with...
I had similar problems, but not quite the same though. The LSP was loading properly, I had my syntax highlight and the inline documentation, but most commands was throwing an error “no delegate command”. While looking for an explanation I found your post.
I’m not sure if this going to help in your particular case, but that’s, with my best intentions, an exhaustive steps I’ve taken to setup VIM, vim_lsp and JDTLS.
$ jdtls
The magic sauce is in the lsp-java.vim, you have to "register" the JDTLS commands to send them properly to the lsp. Thanks to lsp-vim-settings there!
I hope this post will help you or anyone having this problem in the future.
That’s my lsp-java.vim to link everything together, change the paths for yours. I put my Java projects under ~/Projects/java_workspace. $JDT_HOME is where my jdtls folder is located.
I put the ‘data’ (.metadata) in that java_workspace folder too; since it’s the JDTLS metadata.
I face the following issues when trying to get this language server up and running with Vim and vim-lsp:
I have a test project set up with two simple classes:
The project's structure is as following:
Looking into the logs provided by vim-lsp I see quite a few weird things, such as MessageProvider is not on the classpath of project , only syntax errors are reported or the message server already started that is repeated multiple times. I am attaching a copy of a log file that was recorded while performing the following actions:
messageProvider
at its declaration and issue a renameprintln
and issue a hover request to display some documentation for this symbolprintln
and issue the same request as in step 6:q!
I have been trying to get this language server to work for the last 4 days or so and I am starting contemplate to just use an IDE again... I am also attaching the portion of my .vimrc where I register the language server as there may be a configuration error. I am experiencing this behaviour on a 64-bit Gentoo Linux system.
vim_lsp_eclipsejdtls.log