nvim-java organize import like nvim-jdtls? #254
-
I'm currently using Lazyvim with nvim-java. However, it seems to miss the code organize imports feature. If I use Lazyvim extras, which automatically configure nvim-jdtls, I can get the organize imports feature. It didn't affect nvim-java configurations and all the features also worked fine. The only problem I have is, whenever the language server starts initializing, I get this warning: Client 1 quit with exit code 1 and signal 0 Is there a way to fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
I've been working on refactoring commands. There are quite a lot to be done. But eventually all the client commands applicable to neovim will be added. You can't use jdtls and nvim-java both at the same time. Can't help you with any of the issues you are facing when both used. For now, you can use this. |
Beta Was this translation helpful? Give feedback.
-
@chetra-seng No. Paste the entire snippet in |
Beta Was this translation helpful? Give feedback.
-
@chetra-seng From what I can see, lazyvim have keymap to run the organize import but it does not organize imports on save. Do you mean organize import on keymap? |
Beta Was this translation helpful? Give feedback.
@chetra-seng No. Paste the entire snippet in
init.lua
or something.nvim_create_autocmd
add something to be ran on an event.BufWritePre
event is triggerd before buffer writes to file. In the callback, it runs organize import based on the file type.