-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
javalsp - no completion available #1994
Comments
How did you try to use autocompletion in Java? Can you share any example code you were testing with, and where you positioned your cursor? |
@w0rp And started doing something simple like defining a String variable and then accessing its length, e.g.
Or just try to use any of the static methods from String. |
Did you set |
All plugin-specific settings are done after they are loaded. Should I try the other way around? |
Yes, you must set that setting before ALE is loaded. |
I updated the documentation to tell people to set that setting to |
OK, tried it. But still I do not get any completion ;-( |
Out of curiosity, do you utilize any delimiter auto-pairing plug ins? I ask this because I find that ALE's (python) completion for me breaks fairly easily with auto-pairing enabled (whereas other language clients still complete, so I assume it has to do with processing before the completion suggestions are generated).
The following snippet completes as expected: # python snippet in neovim, no auto-pairing plugin:
class MyBase:
pass
class K(My # <C-x><C-o> suggests MyBase Wheras the same snippet with manually paired parens (or auto-paired via a plugin) produces: The gif above is less clear than I'd like, but effectively: # class MyClass:
pass
class K(My # <C-x><C-o> fails. # ) |
@shanesmith Thank you for your hint but actually I have not additional plugins installed for this test. Here's my stripped down vimrc.
|
|
Fair enough, but the trivial example of completion failing inside parenthesis occurs even when ALE completion is automatically triggered after the delay. Obviously it is a separate issue to the original one concerning Java, so if anything once I get some time I will try to go through the steps of creating a new issue. |
@w0rp I am also unable to get auto-completion working with ale. Not sure at what point I updated that broke this but was working before (I wrote javalsp support). ALEInfo shows the LSP command is executed and started but completion, go-to-definition, and friends do not do anything. Is there a way to debug the communication between ALE and the LSP server?? like output the request/response between in the channels to a file to see what is going on? I am also currently implementing LSP support for Eclipse LSP #1996, it is almost ready (see hsanson/ale) but it does not seem to do anything like javalsp. I also tested the javalsp with visual studio code and there it work perfectly. I can get autocompletion and jump to definition/references without problem. |
Yes, the easiest way to debug ALE and LSP communication is to use the |
|
I created a docker container with Ubuntu:18.10 to try this but in the packaged vim 8.0 I get the following error when opening a java file:
Other linters seem to work correctly. Also tried installing vim 8.1 from this repo and got the same error. Not sure if this is the issue affecting neovim or is a different problem. |
That's potentially something we can't fix, but we can maybe catch the error and ignore it at least. See this ancient issue: #39 I don't use |
Ok when running vim 8.0 within a docker container I get the error above. I installed vim 8.0 from apt-get in my dev machine and was able to get the following log:
Not really sure what I should be looking here but seems the command to invoke the LSP server fails with "No such file or directory" error. I checked that the command actually works and starts the LSP server in the terminal: [~]> /bin/bash -c 'java -cp /home/ryujin/.config/nvim/tools/javacs.jar -Xverify:none org.javacs.Main'
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"java.version is 1.8.0_191"}} Also verified that the rootUri and rootPath exists and point to the directory where the java project is located. P.S. replicating the issue above is easy running vim inside a ubuntu:18.10 docker container with vim installed via apt-get. |
Okay, I can merge your pull request to make the executable configurable, and I'll create a second issue for catching write error and either ignoring them or logging them. Either way, they should not be interrupting whatever you are doing in Vim. |
Hm, still does not work correctly for me. When I create a log as suggested earlier for debugging (#1994 (comment)), I see something like this:
I tried building https://github.com/georgewfraser/vscode-javac as suggested in the docs AND also took the version (2.6) installed via VSCODE. I am still trying to do something simple as I wrote in #1994 (comment) |
Oh, Java 8, really? Because on the project site it says at least Java 10 is needed .... I'll give it a try anyway. Thank you. |
Interesting. With Java 8 now not errors any longer. But completion does not work, anyway :-(. ALEInfo shows:
And when logging, I see something like this:
|
I've been fiddling with this as well. The project has now updated to Java 11 and is using JLink to make a distribution, instead of creating a fat jar. I've forked ALE and updated the code to start it up correctly, see jqno@5ce1e9b (I can make a PR if desired). The server starts locally when I run it from the commandline, but now I get errors when I try to use it from Vim and I'm at a loss how to fix those:
Any ideas? |
Dunno what those errors mean. That shouldn't happen. Could you provide the steps of what you did exactly which led to those errors? |
Here's my output of
|
Actually language server features seem to have stopped working for me. I tried javalsp, eclipselsp for java, and pyls for python and autocompletion is not working. I also tried the ch_logfile() call to check what is going on but I get no output at all with Vim:
|
I merged that pull request now. Everyone should update |
Thanks! I just tried again, using
I clearly see a NullPointerException, so I dove into the code of |
It would appear I am having a similar issue. Are you aware if this is a known issue @jqno? Using
|
No, not aware of that. In fact, I stopped using javalsp altogether since I couldn't get it to work. |
The way ALE invokes the java language server is wrong (#2119). This may be the cause of the problems you are experiencing. After building java-language-server there will be a
Here is my setup that works just fine:
|
@hsanson, thank you very much for the tip, using the latest version and running it through its launcher did the trick. Although I had tried running
I had tried adding them to the For the Arch users out there. In addition to aur/java-language-server I have also prepared a aur/java-language-server-git which currently builds version |
@hsanson Thx for the update. Now, I do not see any errors, but completion still does not work for me. Would you mind posting your settings? |
@Jeansen my config is available at https://github.com/hsanson/dotvim. I recommend you use the ch_logfile to capture the communication between ALE and the java-language-server and open a new issue with your findings. I may be able to look into it. |
@Jeansen here is a snippet for convenience:
|
@hsanson Thx, I will checkt that out. |
Information
VIM version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug 22 2018 23:46:39)
Included patches: 1-320
Operating System:
Debian GNU/Linux buster/sid
What went wrong
There is no completion offered at all when writing Java code.
Reproducing the bug
Follow the instructions to install javalsp.
I installed javalsp in Visual Studio Code and it works.
I tried another LSP (for bash) and it sort of works. At least, I get a popup with suggestions as I type. Though the popup is not as elaborate as in VS Code.
:ALEInfo
The text was updated successfully, but these errors were encountered: