From 06fcf71bd0953baf9dc6d4c4bddf586c448f5ca6 Mon Sep 17 00:00:00 2001 From: Oscar Creator Date: Sat, 9 Mar 2024 17:10:58 +0100 Subject: fix(fswatch): --latency is locale dependent --- runtime/lua/vim/_watch.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/lua/vim/_watch.lua') diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 97c5481ad1..cf2689861a 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -303,6 +303,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() -- cgit From 0f20b7d803779950492c2838e2b042a38f4ee22f Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 11 Mar 2024 02:02:52 +0100 Subject: docs: adjust fswatch overflow message to mention docs with info - Add :h fswatch-limitations that notifies user about default inotify limitations on linux and how to adjust them - Check for Event queue overflow message from fswatch and refer user to new documentation Signed-off-by: Tomas Slusny --- runtime/lua/vim/_watch.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/lua/vim/_watch.lua') diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index cf2689861a..542e770246 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -289,6 +289,9 @@ function M.fswatch(path, opts, callback) end if data and #vim.trim(data) > 0 then + 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.schedule(function() vim.notify('fswatch: ' .. data, vim.log.levels.ERROR) end) -- cgit From 41fb98d6fab5aa02ef370d1b2b283b078517ffa4 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 12 Mar 2024 08:15:55 +0100 Subject: fix: move fswatch linux check inside of vim.schedule (#27824) Fixes issue reported in the original PR: https://github.com/neovim/neovim/pull/27810 Signed-off-by: Tomas Slusny --- runtime/lua/vim/_watch.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/_watch.lua') diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 542e770246..23c810099e 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -289,10 +289,11 @@ function M.fswatch(path, opts, callback) end if data and #vim.trim(data) > 0 then - 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.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 -- cgit From 2f4792943aa92223fadd472f20449cd13707ff7a Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Sun, 12 May 2024 21:09:06 +0200 Subject: 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 --- runtime/lua/vim/_watch.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'runtime/lua/vim/_watch.lua') diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 23c810099e..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 -- cgit