aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/uri.lua
diff options
context:
space:
mode:
authorIlia Choly <ilia.choly@gmail.com>2024-02-28 04:50:53 -0500
committerGitHub <noreply@github.com>2024-02-28 10:50:53 +0100
commit0190771713241b10872b9e2118e16ea4e4b2d1a0 (patch)
treef299588493d835d262a7cd4ea8acc71e467045f7 /runtime/lua/vim/uri.lua
parentcb146cc4aad746053535533cbea8834414ea82a2 (diff)
downloadrneovim-0190771713241b10872b9e2118e16ea4e4b2d1a0.tar.gz
rneovim-0190771713241b10872b9e2118e16ea4e4b2d1a0.tar.bz2
rneovim-0190771713241b10872b9e2118e16ea4e4b2d1a0.zip
fix(lua): remove uri fragment from file paths (#27647)
Problem: Some LSP servers return `textDocument/documentLink` responses containing file URIs with line/column numbers in the fragment. `vim.uri_to_fname` returns invalid file names for these URIs. Solution: Remove the URI fragment from file URIs.
Diffstat (limited to 'runtime/lua/vim/uri.lua')
-rw-r--r--runtime/lua/vim/uri.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua
index 7660dc42e7..b4e4098b91 100644
--- a/runtime/lua/vim/uri.lua
+++ b/runtime/lua/vim/uri.lua
@@ -104,6 +104,10 @@ function M.uri_to_fname(uri)
if scheme ~= 'file' then
return uri
end
+ local fragment_index = uri:find('#')
+ if fragment_index ~= nil then
+ uri = uri:sub(1, fragment_index - 1)
+ end
uri = M.uri_decode(uri)
--TODO improve this.
if is_windows_file_uri(uri) then