fix: open files under cwd with relative name (#693)

This commit is contained in:
Muhammad Imaduddin 2025-12-30 01:15:58 +07:00 committed by GitHub
parent bbfa7cba85
commit 634049414b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -277,7 +277,7 @@ M.normalize_url = function(url, callback)
local norm_path = util.addslash(fs.os_to_posix_path(realpath)) local norm_path = util.addslash(fs.os_to_posix_path(realpath))
callback(scheme .. norm_path) callback(scheme .. norm_path)
else else
callback(realpath) callback(vim.fn.fnamemodify(realpath, ":."))
end end
end) end)
) )

View file

@ -168,5 +168,6 @@ a.describe("files adapter", function()
test_util.wait_for_autocmd("BufReadPost") test_util.wait_for_autocmd("BufReadPost")
assert.equals("ruby", vim.bo.filetype) assert.equals("ruby", vim.bo.filetype)
assert.equals(vim.fn.fnamemodify(tmpdir.path, ":p") .. "file.rb", vim.api.nvim_buf_get_name(0)) assert.equals(vim.fn.fnamemodify(tmpdir.path, ":p") .. "file.rb", vim.api.nvim_buf_get_name(0))
assert.equals(tmpdir.path .. "/file.rb", vim.fn.bufname())
end) end)
end) end)