-
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
fix(lspinfo): normalize fname
path correctly
#2343
Conversation
relate #2320 cc @williamboman |
I guess we can just normalize the slashes manually? |
yes. I prefer manually |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, interesting. Maybe we should stick to libuv, but we'll need to default to fname
as-is (see #2320)
lua/lspconfig/ui/lspinfo.lua
Outdated
@@ -112,7 +112,7 @@ local function make_client_info(client, fname) | |||
local workspace_folders = fn.has 'nvim-0.9' == 1 and client.workspace_folders or client.workspaceFolders | |||
local uv = vim.loop | |||
local is_windows = uv.os_uname().version:match 'Windows' | |||
fname = vim.fn.fnamemodify(vim.fn.resolve(fname), ':p') | |||
fname = vim.loop.fs_realpath(fname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fname = vim.loop.fs_realpath(fname) | |
fname = vim.loop.fs_realpath(fname) or fname |
Re-added the previous method as a fallback + a few logic to handle funky separators. What do you think? |
Co-authored-by: Raphael <glephunter@gmail.com>
vim.fn.fnamemodify
andvim.fn.resolve
doesn't normalize slashes in Windows paths, which can cause:LspInfo
to falsely report that the current attached client is in single file mode.As far as I know
uv.fs_realpath
does everything thatvim.fn.fnamemodify(..., ":p")
andvim.fn.resolve
can do and more, so I removed them.