aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/_watchfiles.lua
Commit message (Collapse)AuthorAge
* fix(lsp): ensure watcher cancelJaehwang Jung2025-01-02
| | | | | | | * Cancel watcher in the "force" case. * Cancel watcher outside the async callback. It seems nvim doesn't wait async jobs on quitting, leaving detached inotifywait processes. * Clean up cancelling callbacks.
* feat(lsp): deprecate non-method client functionsLewis Russell2024-11-20
| | | | | | | | | | | | | | Deprecated: - `client.request()` -> `client:request()` - `client.request_sync()` -> `client:request_sync()` - `client.notify()` -> `client:notify()` - `client.cancel_request()` -> `client:cancel_request()` - `client.stop()` -> `client:stop()` - `client.is_stopped()` `client:is_stopped()` - `client.supports_method()` -> `client:supports_method()` - `client.on_attach()` -> `client:on_attach()` Fixed docgen to link class fields to the full function doc.
* refactor(lsp): fold in dynamic_registration code into the clientLewis Russell2024-11-18
| | | | | | | | | | | Problem: Capability register logic is spread across 3 files. Solution: - Consolidate (and simplify) logic into the client. - Teach client.supports_method about resolve methods
* 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>
* 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.
* fix(lsp): cancel watchers when closing a clientLewis 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(lsp): resolve the config-client entanglementLewis Russell2024-02-13
| | | | | | | | | | | | | | | | | | | | | Previously the LSP-Client object contained some fields that are also in the client config, but for a lot of other fields, the config was used directly making the two objects vaguely entangled with either not having a clear role. Now the config object is treated purely as config (read-only) from the client, and any fields the client needs from the config are now copied in as additional fields. This means: - the config object is no longet normalised and is left as the user provided it. - the client only reads the config on creation of the client and all other implementations now read the clients version of the fields. In addition, internal support for multiple callbacks has been added to the client so the client tracking logic (done in lua.lsp) can be done more robustly instead of wrapping the user callbacks which may error.
* refactor: create function for deferred loadingdundargoc2024-02-03
| | | | | | | | | | | | | | | | The benefit of this is that users only pay for what they use. If e.g. only `vim.lsp.buf_get_clients()` is called then they don't need to load all modules under `vim.lsp` which could lead to significant startuptime saving. Also `vim.lsp.module` is a bit nicer to user compared to `require("vim.lsp.module")`. This isn't used for some nested modules such as `filetype` as it breaks tests with error messages such as "attempt to index field 'detect'". It's not entirely certain the reason for this, but it is likely it is due to filetype being precompiled which would imply deferred loading isn't needed for performance reasons.
* refactor(lsp): move glob parsing to util (#26519)Steven Arcangeli2023-12-22
| | | | | | | | refactor(lsp): move glob parsing to vim.glob Moving the logic for using vim.lpeg to create a match pattern from a glob into `vim.glob`. There are several places in the LSP spec that use globs, and it's very useful to have glob matching as a generally-available utility.
* refactor(lsp): add type annotations to _watchfiles (#26109)Mathias Fußenegger2023-11-20
|
* 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
* fix(lsp): do not assume client capability exists in watchfiles check (#24550)Sean Dewar2023-08-04
| | | | | | | | | | | | | | | | | | | | | PR #23689 assumes `client.config.capabilities.workspace.didChangeWatchedFiles` exists when checking `dynamicRegistration`, but thats's true only if it was passed to `vim.lsp.start{_client}`. This caused #23806 (still an issue in v0.9.1; needs manual backport), but #23681 fixed it by defaulting `config.capabilities` to `make_client_capabilities` if not passed to `vim.lsp.start{_client}`. However, the bug resurfaces on HEAD if you provide a non-nil `capabilities` to `vim.lsp.start{_client}` with missing fields (e.g: not made via `make_client_capabilities`). From what I see, the spec says such missing fields should be interpreted as an absence of the capability (including those indicated by missing sub-fields): https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#clientCapabilities Also, suggest `vim.empty_dict()` for an empty dict in `:h vim.lsp.start_client()` (`{[vim.type_idx]=vim.types.dictionary}` no longer works anyway, probably since the cjson switch).
* refactor(lsp): use protocol.Methods instead of strings #24537Raphael2023-08-03
|
* 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>
* perf(lsp): reduce polling handles for workspace/didChangeWatchedFiles (#23500)Jon Huhn2023-06-14
| | | Co-authored-by: Lewis Russell <lewis6991@gmail.com>
* refactor(lsp): use LPeg for watchfiles matching (#23788)Jon Huhn2023-06-05
|
* fix(lsp): don't register didChangeWatchedFiles when capability not set (#23689)Jon Huhn2023-05-20
| | | | | | | Some LSP servers (tailwindcss, rome) are known to request registration for `workspace/didChangeWatchedFiles` even when the corresponding client capability does not advertise support. This change adds an extra check in the `client/registerCapability` handler not to start a watch unless the client capability is set appropriately.
* fix(lsp): fix relative patterns for `workspace/didChangeWatchedFiles` (#23548)Jon Huhn2023-05-09
|
* fix(lsp): don't monitor files if workspace_folders is nil (#22531)Mathias Fußenegger2023-03-05
| | | | | | | | Fixes: Error SERVER_REQUEST_HANDLER_ERROR: "...di/dev/neovim/neovim/runtime/lua/vim/lsp/_watchfiles.lua :200: bad argument #1 to 'ipairs' (table expected, got nil)" Language servers can be started without root_dir or workspace_folders.
* 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