-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
jdtls will not start for windows #2341
Comments
can you try the min config which provide by nvim-lspconfig and i can't open your log. |
It is by any chance that every LSP configuration depending on At least I have to modify the source file everytime after having nvim-lspconfig updated. I believe that for whichever version of libuv that neovim is using does not behave correctly on Windows. Currently I think at least The patch below is my own workaround to let nvim-lspconfig work correctly on Windows: diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index 843e63c..5b388fa 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -122,11 +122,7 @@ M.path = (function()
end
local function is_fs_root(path)
- if is_windows then
- return path:match '^%a:$'
- else
- return path == '/'
- end
+ return path == vim.fn.fnamemodify(path, ':h')
end
local function is_absolute(filename)
@@ -138,20 +134,8 @@ M.path = (function()
end
local function dirname(path)
- local strip_dir_pat = '/([^/]+)$'
- local strip_sep_pat = '/$'
- if not path or #path == 0 then
- return
- end
- local result = path:gsub(strip_sep_pat, ''):gsub(strip_dir_pat, '')
- if #result == 0 then
- if is_windows then
- return path:sub(1, 2):upper()
- else
- return '/'
- end
- end
- return result
+ path = vim.fn.fnamemodify(path, ':h')
+ return path
end
local function path_join(...)
@@ -160,7 +144,7 @@ M.path = (function()
-- Traverse the path calling cb along the way.
local function traverse_parents(path, cb)
- path = uv.fs_realpath(path)
+ path = vim.fn.fnamemodify(path, ':p')
local dir = path
-- Just in case our algo is buggy, don't infinite loop.
for _ = 1, 100 do
@@ -186,7 +170,7 @@ M.path = (function()
else
return
end
- if v and uv.fs_realpath(v) then
+ if v and vim.fn.fnamemodify(v, ':p') then
return v, path
else
return
@@ -358,7 +342,7 @@ function M.server_per_root_dir_manager(make_config)
-- Launch the server in the root directory used internally by lspconfig, if otherwise unset
-- also check that the path exist
- if not new_config.cmd_cwd and uv.fs_realpath(root_dir) then
+ if not new_config.cmd_cwd and vim.fn.fnamemodify(root_dir, ':p') then
new_config.cmd_cwd = root_dir
end
|
@wangkaibule PR welcome (any objections @glepnir ?) |
@wangkaibule that did seem to be the case. I was trying to dig through myself but was pulled away by other priorities. I ended up switching to nvim-jdtls which works fine. I can pull a new version to try. |
yea there has same problem caused by |
I got caught in the same situation using Windows 11. Is this problem solved yet? |
This is the opposite of a minimal config. Is downloading for example "LuaSnip" really necessary to recreate the problem? |
I am closing the thread due to insufficient information. I do not want to wade through miles of config to find the actual source of the problem. If anyone is still encountering this problem (@wangkaibule @seyoatda perhaps?), then I encourage you make a new issue with an actual minimal configuration. |
@dundargoc my apologies I will work to re-create with a smaller config. Would the appropriate take be to create a new issue? |
Nah, you can edit this issue. |
@dundargoc it looks like the fix mentioned above has been merged. I cannot appear to reproduce on newer versions. I am closing. |
Description
I have a Windows 11 machine with neovim installed. I have lsp-zero to configure lsp and other parts of the workflow. I have jdtls installed (no I do not need nvim-jdtls yet). I start nvim in a java project and open a file. The configuration is shown correctly but there are no clients attached. To ensure this is a Windows issue I moved my configs over to WSL Ubuntu install and jdtls works perfectly fine out of the box no configs needed.
Neovim version
NVIM v0.8.0-1210-gd367ed9b2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Nvim-lspconfig version
5292d60
Operating system and version
Windows 11
Affected language servers
jdtls
Steps to reproduce
lsp-zero
lsp.lua
:LspInfo
Actual behavior
JDTLS does not start. There are 0 clients attached.
Expected behavior
Import management and autocomplete (WSL Ubuntu works aok).
Minimal config
lsp.lua
The text was updated successfully, but these errors were encountered: