aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/_watchfiles.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-02-07 11:24:44 +0000
committerLewis Russell <lewis6991@gmail.com>2024-03-01 22:30:27 +0000
commitb87505e11656163ddf0dbbc16b7d224815873964 (patch)
tree9128056f817a90f15107af701286455f1cce3130 /runtime/lua/vim/lsp/_watchfiles.lua
parentb413f5d048ab8676d5a77d0f2b3c20587a270673 (diff)
downloadrneovim-b87505e11656163ddf0dbbc16b7d224815873964.tar.gz
rneovim-b87505e11656163ddf0dbbc16b7d224815873964.tar.bz2
rneovim-b87505e11656163ddf0dbbc16b7d224815873964.zip
refactor(watch): general tidy up
- Rename watch.poll to watch.watchdirs - Unify how include and exclude is applied - Improve type hints
Diffstat (limited to 'runtime/lua/vim/lsp/_watchfiles.lua')
-rw-r--r--runtime/lua/vim/lsp/_watchfiles.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua
index 6ca60b78cd..220052be5f 100644
--- a/runtime/lua/vim/lsp/_watchfiles.lua
+++ b/runtime/lua/vim/lsp/_watchfiles.lua
@@ -7,7 +7,11 @@ local lpeg = vim.lpeg
local M = {}
-M._watchfunc = (vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1) and watch.watch or watch.poll
+if vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1 then
+ M._watchfunc = watch.watch
+else
+ M._watchfunc = watch.watchdirs
+end
---@type table<integer, table<string, function[]>> client id -> registration id -> cancel function
local cancels = vim.defaulttable()
@@ -164,3 +168,4 @@ function M.unregister(unreg, ctx)
end
return M
+