aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_watch.lua
Commit message (Collapse)AuthorAge
* feat(vim.validate): improve fast form and deprecate spec formLewis Russell2024-10-21
| | | | | | | | | | | | | | Problem: `vim.validate()` takes two forms when it only needs one. Solution: - Teach the fast form all the features of the spec form. - Deprecate the spec form. - General optimizations for both forms. - Add a `message` argument which can be used alongside or in place of the `optional` argument.
* perf(validate): use lighter versionLewis Russell2024-10-17
| | | | | - Also fix `vim.validate()` for PUC Lua when showing errors for values that aren't string or number.
* fix(watch): ignore nonexistent paths (ENOENT)Justin M. Keyes2024-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The `_watch.watch()` strategy may fail if the given path does not exist: …/vim/_watch.lua:101: ENOENT: no such file or directory stack traceback: [C]: in function 'assert' …/vim/_watch.lua:101: in function <…/vim/_watch.lua:61> [string "<nvim>"]:5: in main chunk - `_watch.watch()` actively asserts any error returned by `handle:start()`. - whereas `_watch.watchdirs()` just ignores the result of `root_handle:start()`. Servers may send "client/registerCapability" with "workspace/didChangeWatchedFiles" item(s) (`baseUri`) which do not actually exist on the filesystem: https://github.com/neovim/neovim/issues/28058#issuecomment-2189929424 { method = "client/registerCapability", params = { registrations = { { method = "workspace/didChangeWatchedFiles", registerOptions = { watchers = { { globPattern = { baseUri = "file:///Users/does/not/exist", pattern = "**/*.{ts,js,mts,mjs,cjs,cts,json,svelte}" } }, ... } Solution: - Remove the assert in `_watch.watch()`. - Show a once-only message for both cases. - More detailed logging is blocked until we have `nvim_log` / `vim.log`. fix #28058
* fix(watch): exclude .git when using inotifywait (#29914)Manuel2024-08-01
| | | | | | inotifywait man page specifies: The file must be specified with a relative or absolute path according to whether a relative or absolute path is given for watched directories. So it would only work this way in case the path is relative (which at least for gopls it is not)
* feat(lsp): drop fswatch, use inotifywait (#29374)Andreas Schneider2024-07-06
| | | | | | | | | | | | | | This patch replaces fswatch with inotifywait from inotify-toools: https://github.com/inotify-tools/inotify-tools fswatch takes ~1min to set up recursively for the Samba source code directory. inotifywait needs less than a second to do the same thing. https://github.com/emcrisostomo/fswatch/issues/321 Also it fswatch seems to be unmaintained in the meantime. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
* perf(lsp): only joinpath for dirs in watchdirsMathias Fussenegger2024-05-14
| | | | | | | | | | | | | | | | | | | | | | | | 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
* fix: move fswatch linux check inside of vim.schedule (#27824)Tomas Slusny2024-03-12
| | | | | | Fixes issue reported in the original PR: https://github.com/neovim/neovim/pull/27810 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
* docs: adjust fswatch overflow message to mention docs with infoTomas Slusny2024-03-11
| | | | | | | | | - 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 <slusnucky@gmail.com>
* fix(fswatch): --latency is locale dependentOscar Creator2024-03-10
|
* feat(lsp): report fswatch errorsLewis Russell2024-03-06
| | | | | | Resolves #27713 Co-authored-by: Tomasz N <przepompownia@users.noreply.github.com>
* feat(lsp): add fswatch watchfunc backendLewis Russell2024-03-01
| | | | | | | | | | | 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.
* refactor(watch): simplify filechanges processingLewis Russell2024-03-01
|
* refactor(watch): general tidy upLewis Russell2024-03-01
| | | | | | - Rename watch.poll to watch.watchdirs - Unify how include and exclude is applied - Improve type hints
* refactor: fix luals warningsdundargoc2023-12-30
|
* perf(lsp): use async fs_stat for file watching on linux (#26123)Mathias Fußenegger2023-11-21
|
* perf(lsp): replace file polling on linux with per dir watcher (#26108)Mathias Fußenegger2023-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Should help with https://github.com/neovim/neovim/issues/23291 On linux `new_fs_event` doesn't support recursive watching, but we can still use it to watch folders. The downside of this approach is that we may end up sending some false `Deleted` events. For example, if you save a file named `foo` there will be a intermediate `foo~` due to the save mechanism of neovim. The events we get from vim.uv in that case are: - rename: foo~ - rename: foo~ - rename: foo - rename: foo - change: foo - change: foo The mechanism in this PR uses a debounce to reduce this to: - deleted: foo~ - changed: foo `foo~` will be the false positive. I suspect that for the LSP case this is good enough. If not, we may need to follow up on this and keep a table in memory that tracks available files.
* fix(lua): improve annotations for stricter luals diagnostics (#24609)Christian Clason2023-08-09
| | | | | | | | | | | | | | | Problem: luals returns stricter diagnostics with bundled luarc.json Solution: Improve some function and type annotations: * use recognized uv.* types * disable diagnostic for global `vim` in shared.lua * docs: don't start comment lines with taglink (otherwise LuaLS will interpret it as a type) * add type alias for lpeg pattern * fix return annotation for `vim.secure.trust` * rename local Range object in vim.version (shadows `Range` in vim.treesitter) * fix some "missing fields" warnings * add missing required fields for test functions in eval.lua * rename lsp meta files for consistency
* docs(lua): more improvements (#24387)Lewis Russell2023-07-18
| | | | | | | | | | | | | | | | | * docs(lua): teach lua2dox how to table * docs(lua): teach gen_vimdoc.py about local functions No more need to mark local functions with @private * docs(lua): mention @nodoc and @meta in dev-lua-doc * fixup! Co-authored-by: Justin M. Keyes <justinkz@gmail.com> --------- Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* fix(lint): lint warnings #24226Raphael2023-07-10
|
* perf(lsp): reduce polling handles for workspace/didChangeWatchedFiles (#23500)Jon Huhn2023-06-14
| | | Co-authored-by: Lewis Russell <lewis6991@gmail.com>
* feat(lua): rename vim.loop -> vim.uv (#22846)Lewis Russell2023-06-03
|
* fix(watchfiles): skip Created events when poll starts (#23139)Jon Huhn2023-04-17
|
* feat(lsp): implement workspace/didChangeWatchedFiles (#22405)Jon Huhn2023-03-05
|
* Revert "feat(lsp): implement workspace/didChangeWatchedFiles (#21293)"Mathias Fussenegger2023-02-25
| | | | | | This reverts commit 5732aa706c639b3d775573d91d1139f24624629c. Causes editor to freeze in projects with many watcher registrations
* feat(lsp): implement workspace/didChangeWatchedFiles (#21293)Jon Huhn2023-02-25