aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/rpc.lua
Commit message (Collapse)AuthorAge
...
* fix(lsp): detach spawned LSP server processes (#18477)Gregory Anders2022-05-08
| | | | | | | | LSP servers should be daemonized (detached) so that they run in a separate process group from Neovim's. Among other things, this ensures the process does not inherit Neovim's TTY (#18475). Make this configurable so that clients can explicitly opt-out of detaching from Nvim.
* chore(lsp): remove capabilities sanitization (#17814)Michael Lingelbach2022-04-30
| | | | | | | | | | | | | | | | * feat(lsp)!: remove capabilities sanitization Users must now access client.server_capabilities which matches the same structure as the protocol. https://microsoft.github.io/language-server-protocol/specification client.resolved_capabilities is no longer used to gate capabilities, and will be removed in a future release. BREAKING CHANGE Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* chore: fix typos (#16506)dundargoc2021-12-28
| | | | | | | | | Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com> Co-authored-by: Alef Pereira <ealefpereira@gmail.com> Co-authored-by: AusCyber <willp@outlook.com.au> Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
* fix(lsp): change rpc start notify level to warn (#16467)Michael Lingelbach2021-11-30
| | | This is less obtrusive, and does not require a confirmation to dismiss
* chore: fix typos (#16361)dundargoc2021-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: István Donkó <istvan.donko@gmail.com> Co-authored-by: Julian Berman <Julian@GrayVines.com> Co-authored-by: bryant <bryant@users.noreply.github.com> Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com> Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com> Co-authored-by: Jesse Wertheim <jaawerth@gmail.com> Co-authored-by: dm1try <me@dmitry.it> Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl> Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com> Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: István Donkó <istvan.donko@gmail.com> Co-authored-by: Julian Berman <Julian@GrayVines.com> Co-authored-by: bryant <bryant@users.noreply.github.com> Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com> Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com> Co-authored-by: Jesse Wertheim <jaawerth@gmail.com> Co-authored-by: dm1try <me@dmitry.it> Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl> Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com>
* feat(lsp): use uv_spawn to check if server executable (#16430)Michael Lingelbach2021-11-25
| | | | | | | | Previously, the built-in language server client checked if the first argument of cmd was executable via vim.fn.executable. This ignores PATH injected via cmd_env. Instead, we now start the client via uv.spawn, and handle the failure mode, reporting the error back to the user. Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
* feat(lsp): track pending+cancel requests on client object #15949jdrouhard2021-10-29
|
* fix(lsp): expose ContentModified error code to callbacks (#15262)Rishikesh Vaishnav2021-10-08
|
* feat(lsp): improve json deserialization performance (#15854)Michael Lingelbach2021-10-05
| | | | | | | | | | * Add optional second table argument to vim.json.decode which takes a table 'luanil' which can include the 'object' and/or 'array' keys. These options use luanil when converting NULL in json objects and arrays respectively. The default behavior matches the original lua-cjson. * Remove recursive_convert_NIL function from rpc.lua, use vim.json.decode with luanil = { object = true } instead. This removes a hotpath in the json deserialization pipeline by dropping keys with json NULL values throughout the deserialized table.
* refactor(lsp): remove json encode/decode wrappers (#15826)Mathias Fußenegger2021-09-28
|
* feat(lsp): use cjson for lsp rpc (#15759)Michael Lingelbach2021-09-26
|
* feat(lsp): improve logging (#15636)Michael Lingelbach2021-09-15
| | | | | | | * Simplify rpc encode/decode messages to rpc.send/rcp.receive * Make missing handlers message throw a warning * Clean up formatting style in log * Move all non-RPC loop messages to trace instead of debug * Add format func option to log to allow newlines in per log entry
* docs: make Lua docstrings consistent #15255Gregory Anders2021-08-22
| | | | | | | | | | | | The official developer documentation in in :h dev-lua-doc specifies to use "--@" for special/magic tokens. However, this format is not consistent with EmmyLua notation (used by some Lua language servers) nor with the C version of the magic docstring tokens which use three comment characters. Further, the code base is currently split between usage of "--@", "---@", and "--- @". In an effort to remain consistent, change all Lua magic tokens to use "---@" and update the developer documentation accordingly.
* fix(lsp): Handle nil message_callbacksMathias Fussenegger2021-06-25
| | | | | | | | | | The `onexit` handler could set `message_callbacks` to `nil` within the luv event loop while the mainloop runs a function that tries to access `message_callbacks`. This adds some checks to prevent errors in that case. Fixes https://github.com/neovim/neovim/issues/14863
* fix(lsp): do not convert vim.NIL to nil in listsAkin Sowemimo2021-06-24
|
* lsp: Only mute RequestCancelled or ContentModified, but not other errorsMathias Fussenegger2021-05-23
| | | | | | | | | | | | | | | | | | | | | | | | | | handlers passed to `lsp_buf_request` weren't called if the server responded with an error that looks like this: "decoded", { error = { code = -32601, message = "No delegateCommandHandler for foo" }, id = 5, jsonrpc = "2.0" } An example where that happens is both eclipse.jdt.ls and the haskell-language-server when invoking a command that doesn't exist: :lua vim.lsp.buf_request( 0, 'workspace/executeCommand', { command = 'foo' }, function(err, _, res) print(vim.inspect(err), vim.inspect(res)) end )
* lsp: Allow decoded.result to be `false`Mathias Fussenegger2021-04-30
| | | | | | | | | | | | | | | | | | | | | | | | | Some servers might respond to `workspace/executeCommand` requests with a boolean result and that could be `false`. A `false` result should be allowed and not trigger the `on_error` handler: -- Invalid server message on_error(client_errors.INVALID_SERVER_MESSAGE, decoded) Concrete example where this occurred is with eclipse.jdt.ls: vim.lsp.buf_request( 0, 'workspace/executeCommand', { command = 'java.project.isTestFile', arguments = { vim.uri_from_bufnr(0), }, }, function(err, _, resp) print(vim.inspect(err), vim.inspect(resp)) end )
* lsp: allow launching language servers with uv_spawn using cwd argMichael Lingelbach2021-04-01
|
* fix: show error when language server start fails and prevent future requestsDavid Zhang2021-02-26
|
* lsp: Reduce memory usage for buffering the message from LSP.Yuki Ito2020-11-29
|
* lsp: vim.lsp.diagnostic (#12655)TJ DeVries2020-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Breaking Changes: - Deprecated all `vim.lsp.util.{*diagnostics*}()` functions. - Instead, all functions must be found in vim.lsp.diagnostic - For now, they issue a warning ONCE per neovim session. In a "little while" we will remove them completely. - `vim.lsp.callbacks` has moved to `vim.lsp.handlers`. - For a "little while" we will just redirect `vim.lsp.callbacks` to `vim.lsp.handlers`. However, we will remove this at some point, so it is recommended that you change all of your references to `callbacks` into `handlers`. - This also means that for functions like |vim.lsp.start_client()| and similar, keyword style arguments have moved from "callbacks" to "handlers". Once again, these are currently being forward, but will cease to be forwarded in a "little while". - Changed the highlight groups for LspDiagnostic highlight as they were inconsistently named. - For more information, see |lsp-highlight-diagnostics| - Changed the sign group names as well, to be consistent with |lsp-highlight-diagnostics| General Enhancements: - Rewrote much of the getting started help document for lsp. It also provides a much nicer configuration strategy, so as to not recommend globally overwriting builtin neovim mappings. LSP Enhancements: - Introduced the concept of |lsp-handlers| which will allow much better customization for users without having to copy & paste entire files / functions / etc. Diagnostic Enhancements: - "goto next diagnostic" |vim.lsp.diagnostic.goto_next()| - "goto prev diagnostic" |vim.lsp.diagnostic.goto_prev()| - For each of the gotos, auto open diagnostics is available as a configuration option - Configurable diagnostic handling: - See |vim.lsp.diagnostic.on_publish_diagnostics()| - Delay display until after insert mode - Configure signs - Configure virtual text - Configure underline - Set the location list with the buffers diagnostics. - See |vim.lsp.diagnostic.set_loclist()| - Better performance for getting counts and line diagnostics - They are now cached on save, to enhance lookups. - Particularly useful for checking in statusline, etc. - Actual testing :) - See ./test/functional/plugin/lsp/diagnostic_spec.lua - Added `guisp` for underline highlighting NOTE: "a little while" means enough time to feel like most plugins and plugin authors have had a chance to refactor their code to use the updated calls. Then we will remove them completely. There is no need to keep them, because we don't have any released version of neovim that exposes these APIs. I'm trying to be nice to people following HEAD :) Co-authored: [Twitch Chat 2020](https://twitch.tv/teej_dv)
* lsp: remove vim.NIL from processing (#13174)TJ DeVries2020-11-02
| | | | | * lsp: remove vim.NIL from processing * lsp: remove instances of vim.NIL
* lsp: Handle ContentModified the same way as RequestCancelled (#12803)Rasmus Ishøy Michelsen2020-09-22
| | | | | * Added the ContentModified error to be hidden from users, like RequestCancelled * Fixed tests (and ill-formed lua code) * Simplified if-expression
* lsp: remove output log at rpc.notifyHirokazu Hata2020-08-26
| | | | Since "rpc.send.payload" outputs the log with almost the same contents, delete the output here.
* Add FIXMEsPatrice Peterson2020-08-23
|
* Add docs for most vim.lsp methodsPatrice Peterson2020-08-23
| | | | Most of the lsp.log will be addressed in a separate PR.
* doc: fix scripts and regenerate (#12506)TJ DeVries2020-07-02
| | | | | | | | | | | | | | | | | * Fix some small doc issues * doc: fixup * doc: fixup * Fix lint and rebase * Remove bad advice * Ugh, stupid mpack files... * Don't let people include these for now until they specifically want to * Prevent duplicate tag
* lsp: do not assert even if the code does not exist in ErrorCodes (#11981)Hirokazu Hata2020-04-21
| | | | | | | | There is ErrorCodes in the LSP specification, but in ResponseError.code it is not used and the actual type is number. Some language servers response original error cods and this is valid spec. So we shouldn't assert even if the code does not exist in ErrorCodes. ref: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#responseMessage
* lsp/rpc.lua: fix `env` application functionJustin M. Keyes2020-02-16
| | | | Env vars must be merged with the current env.
* gen_vimdoc.py: generate LSP docsJustin M. Keyes2019-12-31
|
* LSP: Handle rpc RequestCancelled specifically. (#11606)Ashkan Kiani2019-12-24
| | | | | | | This was creating extra noise in errors that we should've been handling internally. Fixes #11515
* Bugfixes.Ashkan Kiani2019-11-20
| | | | | - Return after an error in RPC. - Use an empty vim table for serialization.
* lua LSP client: initial implementation (#11336)Ashkan Kiani2019-11-13
Mainly configuration and RPC infrastructure can be considered "done". Specific requests and their callbacks will be improved later (and also served by plugins). There are also some TODO:s for the client itself, like incremental updates. Co-authored by at-tjdevries and at-h-michael, with many review/suggestion contributions.