Skip to content
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

Merged
merged 5 commits into from
Feb 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lua/lspconfig/ui/lspinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,14 @@ 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 = uv.fs_realpath(fname) or fn.fnamemodify(fn.resolve(fname), ':p')
if is_windows then
fname:gsub('%/', '%\\')
end
local sep = is_windows and '\\' or '/'
local fname_parts = vim.split(fname, sep, { trimempty = true })
local fname_parts = vim.tbl_filter(function(v)
return #v > 0
end, vim.split(fname, sep))
if workspace_folders then
for _, schema in pairs(workspace_folders) do
local matched = true
Expand Down