mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
perf(lsp): only joinpath for dirs in watchdirs
Doesn't have a huge impact, but showed up in profile output using `require("jit.p").start("i1", "/tmp/profile")` before: 31% joinpath 25% fs.lua:0 13% normalize 13% skip 8% _watchfunc 5% gsplit 3% spairs after: 34% skip 29% fs.lua:0 12% joinpath 7% normalize 5% _watchfunc 5% spairs
This commit is contained in:

committed by
Lewis Russell

parent
8bb67d64e2
commit
2f4792943a
@@ -200,11 +200,13 @@ function M.watchdirs(path, opts, callback)
|
|||||||
local max_depth = 100
|
local max_depth = 100
|
||||||
|
|
||||||
for name, type in vim.fs.dir(path, { depth = max_depth }) do
|
for name, type in vim.fs.dir(path, { depth = max_depth }) do
|
||||||
local filepath = vim.fs.joinpath(path, name)
|
if type == 'directory' then
|
||||||
if type == 'directory' and not skip(filepath, opts) then
|
local filepath = vim.fs.joinpath(path, name)
|
||||||
local handle = assert(uv.new_fs_event())
|
if not skip(filepath, opts) then
|
||||||
handles[filepath] = handle
|
local handle = assert(uv.new_fs_event())
|
||||||
handle:start(filepath, {}, create_on_change(filepath))
|
handles[filepath] = handle
|
||||||
|
handle:start(filepath, {}, create_on_change(filepath))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user