From 4ff3217bbd8747d2d44680a825ac29097faf9c4b Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 7 Feb 2024 11:28:35 +0000 Subject: feat(lsp): add fswatch watchfunc backend Problem: vim._watch.watchdirs has terrible performance. Solution: - On linux use fswatch as a watcher backend if available. - Add File watcher section to health:vim.lsp. Warn if watchfunc is libuv-poll. --- test/functional/lua/watch_spec.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test/functional/lua') diff --git a/test/functional/lua/watch_spec.lua b/test/functional/lua/watch_spec.lua index fa84459b67..115fee8091 100644 --- a/test/functional/lua/watch_spec.lua +++ b/test/functional/lua/watch_spec.lua @@ -21,6 +21,15 @@ describe('vim._watch', function() local function run(watchfunc) it('detects file changes (watchfunc=' .. watchfunc .. '())', function() + if watchfunc == 'fswatch' then + skip(is_os('mac'), 'flaky test on mac') + skip( + not is_ci() and helpers.fn.executable('fswatch') == 0, + 'fswatch not installed and not on CI' + ) + skip(is_os('win'), 'not supported on windows') + end + if watchfunc == 'watch' then skip(is_os('bsd'), 'Stopped working on bsd after 3ca967387c49c754561c3b11a574797504d40f38') else @@ -95,6 +104,7 @@ describe('vim._watch', function() vim.uv.sleep(100) touch(watched_path) + vim.uv.sleep(100) os.remove(watched_path) vim.uv.sleep(100) @@ -113,5 +123,5 @@ describe('vim._watch', function() run('watch') run('watchdirs') + run('fswatch') end) - -- cgit