Replies: 3 comments 1 reply
-
@justinmk may have some insights or ideas. |
Beta Was this translation helpful? Give feedback.
-
Yes. "normalize" should be deterministic. For URIs we may need special handling for the "scheme" part. Although AFAIR,
Example? Note that a "buffer name" is not necessarily a filepath, so it's invalid to call normalize() on a non-filepath buffer name.
Perhaps it should only handle |
Beta Was this translation helpful? Give feedback.
-
Improvements to normalize(): #28203 |
Beta Was this translation helpful? Give feedback.
-
Currently
vim.fs.normalize
will mangle file path type URIs. eg:vim.fs.normalize("oil:///tmp/testing/")
returnsoil:/tmp/testing
.This behavior falls in line with Python's
os.path.normpath
so in a sense, I can see this being expected behavior.On the flip side, doing something like
vim.fs.normalize(vim.api.nvim_buf_get_name(0))
is not always a safe operation due to this behavior. Safe as in not getting an invalid path/URI as the return value.Wanted to get some ideas on the best way to handle these file path URI edge cases. Would it make sense for
vim.fs.normalize
to always just bypass handling URIs? Or is it on users and plugin authors to avoid blindly usingvim.fs.normalize
with the many ways one can get buffer names in vim?Beta Was this translation helpful? Give feedback.
All reactions