aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/buf.lua
Commit message (Collapse)AuthorAge
...
* fix(lsp): adjust offset encoding in lsp.buf.rename() (#18829)Fredrik Ekre2022-06-01
| | | | | | | | Fix a bug in lsp.buf.rename() where the range returned by the server in textDocument/prepareRename was interpreted as a byte range directly, instead of taking the negotiated offset encoding into account. This caused the placeholder value in vim.ui.input to be incorrect in some cases, for example when non-ascii characters are used earlier on the same line.
* feat(lsp): turn rename filter into a predicate (#18745)Mathias Fußenegger2022-05-26
| | | Same as https://github.com/neovim/neovim/pull/18458 but for rename
* feat(lsp)!: turn format filter into predicate (#18458)Mathias Fußenegger2022-05-25
| | | | | This makes the common use case easier. If one really needs access to all clients, they can create a filter function which manually calls `get_active_clients`.
* fix(lsp): only send diagnostics from current buffer in code_action() (#18639)Fredrik Ekre2022-05-20
| | | | Fix vim.lsp.buf.(range_)code_action() to only send diagnostics belonging to the current buffer and not to other files in the workspace.
* feat(lsp): option to reuse_win for jump actions (#18577)Lewis Russell2022-05-18
|
* fix(lsp): perform client side filtering of code actions (#18392)Fredrik Ekre2022-05-12
| | | | | | | | Implement filtering of actions based on the kind when passing the 'only' parameter to code_action(). Action kinds are hierachical with a '.' as the separator, and the filter thus allows, for example, both 'quickfix' and 'quickfix.foo' when requestiong only 'quickfix'. Fix https://github.com/neovim/neovim/pull/18221#issuecomment-1110179121
* Merge pull request #18487 from clason/styluaChristian Clason2022-05-11
|\ | | | | CI: format and lint runtime with Stylua
| * chore: format runtime with styluaChristian Clason2022-05-09
| |
* | docs(lsp): fix description of `only` in vim.lsp.buf.code_action() (#18492)Fredrik Ekre2022-05-09
|/
* fix(lsp): skip clients without rename capability (#18449)Mathias Fußenegger2022-05-06
| | | | | Follow up to https://github.com/neovim/neovim/pull/18441 This way rename should "just work" in most cases without having to manually filter the client
* fix(lsp): fix rename capability checks and multi client support (#18441)Mathias Fußenegger2022-05-05
| | | | | | | | Adds filter and id options to filter the client to use for rename. Similar to the recently added `format` function. rename will use all matching clients one after another and can handle a mix of prepareRename/rename support. Also ensures the right `offset_encoding` is used for the `make_position_params` calls
* feat(lsp): add async option to vim.lsp.buf.format (#18322)Mathias Fußenegger2022-04-30
| | | | | | | | Deprecates the existing `vim.lsp.buf.formatting` function. With this, `vim.lsp.buf.format` will replace all three: - vim.lsp.buf.formatting - vim.lsp.buf.formatting_sync - vim.lsp.buf.formatting_seq_sync
* feat(lsp): add vim.lsp.buf.format (#18193)Michael Lingelbach2022-04-30
|
* 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>
* feat(lsp): options to filter and auto-apply code actions (#18221)Fredrik Ekre2022-04-30
| | | | | | | | | | | | | | | | | | | Implement two new options to vim.lsp.buf.code_action(): - filter (function): predicate taking an Action as input, and returning a boolean. - apply (boolean): when set to true, and there is just one remaining action (after filtering), the action is applied without user query. These options can, for example, be used to filter out, and automatically apply, the action indicated by the server to be preferred: vim.lsp.buf.code_action({ filter = function(action) return action.isPreferred end, apply = true, }) Fix #17514.
* fix(lsp): avoid nil workspace/symbol query (#17107)Daniel Steinberg2022-01-15
|
* fix(lsp): forward offset_encoding to apply_text_edits (#17075)Michael Lingelbach2022-01-13
|
* fix(lsp): strictly enforce passing offset encoding (#17049)Michael Lingelbach2022-01-13
| | | | | | | | | | This removes the "fallback" to utf-16 in many of our helper functions. We should always explicitly pass these around when possible except in two locations: * generating params with help utilities called by buf.lua functions * the buf.lua functions themselves Anything that is called by the handler should be passed the offset encoding.
* fix(lsp): only send valid params in executeCommand (#16987)Michael Lingelbach2022-01-08
|
* chore: fix typos (#16816)dundargoc2022-01-04
| | | | | | | Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Sebastian Volland <seb@baunz.net> Co-authored-by: Lewis Russell <lewis6991@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* feat(lsp): use `vim.ui.select` for selecting lsp client (#16531)Anshuman Medhi2021-12-07
|
* docs(lsp): do not use nvim_command for Vimscript examplesGregory Anders2021-11-30
| | | | | | The examples are relevant and applicable for both Lua and Vimscript configurations and the `vim.api.nvim_command` prefixes just add noise that doesn't contribute to the example.
* docs(lsp): add annotations for private functionsGregory Anders2021-11-30
|
* fix(lsp): require bufnr for apply_text_edits (#16444)Michael Lingelbach2021-11-26
|
* fix(lsp): avoid indexing vim.NIL for null workspaceFolders (#16404)Michael Lingelbach2021-11-22
| | | | * internally represent no workspaceFolders as nil instead of vim.NIL * rename workspaceFolders -> workspace_folders for consistency
* fix(lsp): gracefully handle nil workspaceFolders (#16284)Michael Lingelbach2021-11-11
| | | * handle when workspaceFolder is nil in buf.list_workspace_folders and buf.add_workspace_folder
* feat(ui): add vim.ui.input and use in lsp rename (#15959)Sebastian Lyng Johansen2021-11-07
| | | | | | * vim.ui.input is an overridable function that prompts for user input * take an opts table and the `on_confirm` callback, see `:help vim.ui.input` for more details * defaults to a wrapper around vim.fn.input(opts) * switches the built-in client's rename handler to use vim.ui.input by default
* fix(lsp): pass the enriched ctx to the client-side command (#16201)Nghia Le Minh2021-11-01
|
* feat(lsp): add per-client commands (#16101)Michael Lingelbach2021-11-01
|
* feat(ui): add `opt.kind` to `vim.ui.select` (#15838)Zachary Churchill2021-10-31
| | | Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* feat(lsp): add codeAction/resolve support (#15818)Mathias Fußenegger2021-09-28
| | | Closes https://github.com/neovim/neovim/issues/15339 and https://github.com/neovim/neovim/issues/15828
* fix(lsp): avoid serializing boolean as key (#15810)Michael Lingelbach2021-09-27
| | | | | | In vim.lsp.buf.references, the key vim.type_idx (which evaluates to a boolean) was set to equal vim.types.dictionary. This resulted in a boolean key in json which is not allowed by the json spec, and which lua-cjson fails to serialize.
* feat(lsp): allow subset of CodeActionContext as arg to code_action methods ↵Mathias Fußenegger2021-09-26
| | | | | | | | | (#15793) This makes it easier to filter the code actions. For example: vim.lsp.buf.code_action { only = 'refactor' }
* fix(lsp): update lsp-handler signature in call_hierarchy (#15738)Mathias Fußenegger2021-09-21
| | | | | | | | This fixes the handler signature and also prevents n+1 requests firing if there are multiple clients. (The first `prepareCallHierarchy` handler is called once per client, each invocation used `buf_request` to make more requests using *all* clients)
* feat(lsp): support textDocument/prepareRename (#15514)Zi How Poh2021-09-08
|
* feat(lsp)!: change handler signatureMichael Lingelbach2021-09-05
| | | | | | | | | | | | | | | | | | | | | | | | Previously, the handler signature was: function(err, method, params, client_id, bufnr, config) In order to better support external plugins that wish to extend the protocol, there is other information which would be advantageous to forward to the client, such as the original params of the request that generated the callback. In order to do this, we would need to break symmetry of the handlers, to add an additional "params" as the 7th argument. Instead, this PR changes the signature of the handlers to: function(err, result, ctx, config) where ctx (the context) includes params, client_id, and bufnr. This also leaves flexibility for future use-cases. BREAKING_CHANGE: changes the signature of the built-in client handlers, requiring updating handler calls
* 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.
* feat: aggregate code actions from all clients (#15121)Folke Lemaitre2021-07-18
|
* fix(lsp): avoid ipairs on non-sequential tables (#15059)Michael Lingelbach2021-07-11
| | | | | | | | | | | | | | | | | | | | ipairs terminates on the first nil index when iterating over table keys: for i,k in ipairs( {[1] = 'test', [3] = 'test'} ) do print(i, k) end prints: 1 test Instead, use pairs which continues iterating over the entire table: for i,k in pairs( {[1] = 'test', [3] = 'test'} ) do print(i, k) end prints: 1 test 3 test
* fix(lsp): Set `dir` completion option for add_workspace_folderMathias Fussenegger2021-06-25
| | | | | Given that the input is pre-filled with a path, it should be possible to use dir completion.
* fix(lsp): add bufnr to formatting requestsLukas Reineke2021-06-15
| | | | | | Add the buffer number to the `textDocument/formatting` request, so that it is passed to the handler. The built-in formatting handlers do not use the buffer number, but user overrides should have access to it.
* docs(lsp): annotate call_hierarchy function as privatecbarrete2021-06-14
|
* lsp: handle unsupported call hierarchy callCédric Barreteau2021-05-19
|
* Synchronous formatting methods notify the user on timeout and interruptedKarim Abou Zeid2021-05-02
|
* Support multiple range formatting clientsKarim Abou Zeid2021-05-02
|
* Add formatting_seq_sync, change formatting and formatting_syncKarim Abou Zeid2021-05-01
|
* [LSP] Add in more docs for highlight groups with document_highlight() (#13614)Chris Kipp2021-02-24
| | | | | | Currently it's not 100% clear that without setting these, using the autocomds to utilize the `textDocument/documentHighlight` functionality, nothing will actually be visible since the highlight groups don't have any details. This just adds in a couple simple extra notes to make sure that's done
* doc: Add missing parameter end_pos for range_formatting (#13481)Olivier Roques2020-12-09
|
* feat: Allow incremental sync & lsp flags (#13371)TJ DeVries2020-12-08
|
* LSP: Feature/add workspace folders (#12638)Michael Lingelbach2020-11-25
| | | | | | | | | | | * First implementation of workspace folders * Add completion for current directory * Add tracking of workspace folders * Add workspace folder listing * Add checks on adding/removing workspaces * Add appropriate initialization options * Add documentation * Make workspaceFolders available wherever client is