aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/uri.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2025-01-24 13:01:25 +0000
committerLewis Russell <me@lewisr.dev>2025-01-27 16:37:50 +0000
commit6aa42e8f92bd8bea49b7b2accfe4ab67a5344e41 (patch)
tree5695108458a60f19e56834e9889ea58fc9c8c32d /runtime/lua/vim/uri.lua
parent83479b95abae84b4b2b4a0331503298ddc5ff47b (diff)
downloadrneovim-6aa42e8f92bd8bea49b7b2accfe4ab67a5344e41.tar.gz
rneovim-6aa42e8f92bd8bea49b7b2accfe4ab67a5344e41.tar.bz2
rneovim-6aa42e8f92bd8bea49b7b2accfe4ab67a5344e41.zip
fix: resolve all remaining LuaLS diagnostics
Diffstat (limited to 'runtime/lua/vim/uri.lua')
-rw-r--r--runtime/lua/vim/uri.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua
index 6323f61256..8b6f1a61ee 100644
--- a/runtime/lua/vim/uri.lua
+++ b/runtime/lua/vim/uri.lua
@@ -60,9 +60,10 @@ end
---@param path string Path to file
---@return string URI
function M.uri_from_fname(path)
- local volume_path, fname = path:match('^([a-zA-Z]:)(.*)') ---@type string?
+ local volume_path, fname = path:match('^([a-zA-Z]:)(.*)') ---@type string?, string?
local is_windows = volume_path ~= nil
if is_windows then
+ assert(fname)
path = volume_path .. M.uri_encode(fname:gsub('\\', '/'))
else
path = M.uri_encode(path)
@@ -111,7 +112,7 @@ function M.uri_to_fname(uri)
uri = M.uri_decode(uri)
--TODO improve this.
if is_windows_file_uri(uri) then
- uri = uri:gsub('^file:/+', ''):gsub('/', '\\')
+ uri = uri:gsub('^file:/+', ''):gsub('/', '\\') --- @type string
else
uri = uri:gsub('^file:/+', '/') ---@type string
end