diff options
Diffstat (limited to 'runtime/lua/vim/_watch.lua')
-rw-r--r-- | runtime/lua/vim/_watch.lua | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 97c5481ad1..02b3f536c2 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -200,11 +200,13 @@ function M.watchdirs(path, opts, callback) local max_depth = 100 for name, type in vim.fs.dir(path, { depth = max_depth }) do - local filepath = vim.fs.joinpath(path, name) - if type == 'directory' and not skip(filepath, opts) then - local handle = assert(uv.new_fs_event()) - handles[filepath] = handle - handle:start(filepath, {}, create_on_change(filepath)) + if type == 'directory' then + local filepath = vim.fs.joinpath(path, name) + if not skip(filepath, opts) then + local handle = assert(uv.new_fs_event()) + handles[filepath] = handle + handle:start(filepath, {}, create_on_change(filepath)) + end end end @@ -290,6 +292,10 @@ function M.fswatch(path, opts, callback) if data and #vim.trim(data) > 0 then vim.schedule(function() + if vim.fn.has('linux') == 1 and vim.startswith(data, 'Event queue overflow') then + data = 'inotify(7) limit reached, see :h fswatch-limitations for more info.' + end + vim.notify('fswatch: ' .. data, vim.log.levels.ERROR) end) end @@ -303,6 +309,8 @@ function M.fswatch(path, opts, callback) fswatch_output_handler(line, opts, callback) end end, + -- --latency is locale dependent but tostring() isn't and will always have '.' as decimal point. + env = { LC_NUMERIC = 'C' }, }) return function() |