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. --- runtime/lua/vim/lsp/_watchfiles.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/_watchfiles.lua') diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua index c66a76feae..49328fbe9b 100644 --- a/runtime/lua/vim/lsp/_watchfiles.lua +++ b/runtime/lua/vim/lsp/_watchfiles.lua @@ -9,6 +9,8 @@ local M = {} if vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1 then M._watchfunc = watch.watch +elseif vim.fn.executable('fswatch') == 1 then + M._watchfunc = watch.fswatch else M._watchfunc = watch.watchdirs end @@ -177,4 +179,3 @@ function M.cancel(client_id) end return M - -- cgit