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
feat(lua): vim.uri #24527
base: master
Are you sure you want to change the base?
feat(lua): vim.uri #24527
Conversation
TODO: - test coverage for encode/decode - deprecate() ? - migrate all internal usages of the old deprecated functions - introduce `Uri` container object which unambiguously represents a path, reference https://github.com/microsoft/vscode-uri
vim.loop = vim.uv | ||
|
||
local uri = require('vim.uri') |
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.
This causes the uri module to be unconditionally required even if it doesn't get used.
I think we need to keep the code as it was and just add deprecated tags to meta files via #24525
@@ -1,5 +1,5 @@ | |||
local uv = vim.uv | |||
local uri_encode = vim.uri_encode | |||
local uri_encode = vim.uri.encode |
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.
If the loader now depends on the uri module then we should inline the uri module into the nvim binary.
This would make my other comment moot since requiring it essentially becomes free.
if is_windows then | ||
path = volume_path .. M.uri_encode(fname:gsub('\\', '/')) | ||
path = volume_path .. M.encode(fname:gsub('\\', '/')) |
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.
would it be possible to include correct uri encoding of the volume_path and possibly add a vscode-like normalization?
volume_path = volume_path:lower():gsub(":", "%%3A")
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.
Also I think that the M.encode should use pattern "^A-Za-z0-9%-_.!~*'()/"
(rfc2396 + "/" = keep "unreserved chars" and slashes), so that odd filenames like #@file@#
are not translated into an uri-fragment.
( followup to #24491 )
vim.uri
module.vim.uri_x
functionsTODO:
Uri
container object which unambiguously represents a path, reference https://github.com/microsoft/vscode-uri