aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/provider/python.lua
diff options
context:
space:
mode:
authorYochem van Rosmalen <git@yochem.nl>2026-02-27 23:45:07 +0100
committerGitHub <noreply@github.com>2026-02-27 17:45:07 -0500
commitdc5d313d66c620699a926aeefaf20bb0ec0d653e (patch)
tree6f9d4bade619e5f7e20e0357f2b935a2d13768e6 /runtime/lua/vim/provider/python.lua
parent47479757540fa3b56a48145c74eeb93db81c90f7 (diff)
downloadrneovim-dc5d313d66c620699a926aeefaf20bb0ec0d653e.tar.gz
rneovim-dc5d313d66c620699a926aeefaf20bb0ec0d653e.tar.bz2
rneovim-dc5d313d66c620699a926aeefaf20bb0ec0d653e.zip
fix(vim.fs): joinpath() should ignore empty items #38077
Problem: vim.fs.joinpath treats empty string as a path segment (it adds a path separator for each empty item): print(vim.fs.joinpath('', 'after/lsp', '')) -- '/after/lsp/' print(vim.fs.joinpath('', '')) -- '/' Especially problematic if the empty segment is the first segment, as that converts the path to an absolute path. Solution: Ignore empty (length of 0) path segments. Benchmark: local function test(func) local t = vim.uv.hrtime() for _ = 1, 100000, 1 do func('', 'this/is', 'a/very/long/path', '', 'it', 'really', 'is') end print(math.floor((vim.uv.hrtime() - t) / 1e6), 'ms') end - with Iter():filter() --> 370 ms - building new segments table --> 208 ms - with vim.tbl_filter --> 232 ms - Instead of gsub split on `/` in all parts --> 1870 ms
Diffstat (limited to 'runtime/lua/vim/provider/python.lua')
0 files changed, 0 insertions, 0 deletions