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.
This commit is contained in:
Lewis Russell
2024-02-07 11:28:35 +00:00
parent 816b56f878
commit 4ff3217bbd
7 changed files with 140 additions and 11 deletions

View File

@@ -4494,6 +4494,15 @@ describe('LSP', function()
it(
string.format('sends notifications when files change (watchfunc=%s)', watchfunc),
function()
if watchfunc == 'fswatch' then
skip(
not is_ci() and fn.executable('fswatch') == 0,
'fswatch not installed and not on CI'
)
skip(is_os('win'), 'not supported on windows')
skip(is_os('mac'), 'flaky')
end
skip(
is_os('bsd'),
'kqueue only reports events on watched folder itself, not contained files #26110'
@@ -4614,6 +4623,7 @@ describe('LSP', function()
test_filechanges('watch')
test_filechanges('watchdirs')
test_filechanges('fswatch')
it('correctly registers and unregisters', function()
local root_dir = '/some_dir'
@@ -5078,4 +5088,3 @@ describe('LSP', function()
end)
end)
end)