aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/buf.lua
Commit message (Collapse)AuthorAge
* fix(lsp): avoid ipairs on non-sequential tables (#15059)Michael Lingelbach2021-09-26
| | | | | | | | | | | | | | | | | | | | 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): update lsp-handler signature in call_hierarchy (#15738)Mathias Fußenegger2021-09-26
| | | | | | | | 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)!: change handler signature #15504Michael Lingelbach2021-09-26
|
* 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
* 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: fix formatting_sync with multiple clients (#13233)francisco souza2020-11-07
| | | | | | | | buf_request_sync returns a table indexed by the client id, so when starting a second client on a separate buffer, result[1] will be nil. Closes #13232. Co-authored-by: francisco souza <fsouza@users.noreply.github.com>
* lsp: Add vim.lsp.buf.range_code_action() (#12962)notomo2020-09-24
| | | | | Allows to execute code_action for a given range. :'<,'>lua vim.lsp.buf.range_code_action()
* lsp: fix lsp.buf.formatting_sync() null response (#12752)beardedsakimonkey2020-09-12
| | | Co-authored-by: tim apple <tim@tims-MacBook-Pro.local>
* Add docs for most vim.lsp methodsPatrice Peterson2020-08-23
| | | | Most of the lsp.log will be addressed in a separate PR.
* doc: Add documentation for some `vim.lsp.buf` functions (#12552)cbarrete2020-07-19
| | | | | | | | | * Add documentation for some `vim.lsp.buf` functions * Add inline Lua documentation * Use generated documentation for LSP buffer functions Co-authored-by: Cédric Barreteau <>
* lsp: Add support for call hierarchies (#12556)cbarrete2020-07-18
| | | | | | | | | | | | | | | | | | * LSP: Add support for call hierarchies * LSP: Add support for call hierarchies * LSP: Add support for call hierarchies * LSP: Jump to call location Jump to the call site instead of jumping to the definition of the caller/callee. * LSP: add tests for the call hierarchy callbacks * Fix linting error Co-authored-by: Cédric Barreteau <>
* 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: Set current name as default rename text (#12553)cbarrete2020-06-27
| | | | | | Since we don't know what the server considers to be a symbol, `cword` is the best bet in most cases. Co-authored-by: Cédric Barreteau <>
* lsp: Add sync variant of LSP formattingDavid Lukes2020-06-22
| | | | | Also, factor out a `vim.lsp.util.get_effective_tabstop()` helper and add tests for it.
* LSP: Add textDocument/codeAction support (#11607)Jesse2020-05-16
| | | | | | | | | | | | * Add textDocument/codeAction * Add callback for workspace/executeCommand * Escape newlines in codeAction titles * Return empty list in get_line_diagnostics if no buffer diagnostics * Add stub documentation * Validate context parameter in code_action * Add support for edit in CodeAction responses * Group diagnostics by line in vim.lsp.util.get_line_diagnostics() * Advertise code action literal support
* lsp: add workspace/symbol (#12224)Christian Clason2020-05-02
| | | | | | | | * lsp: add workspace/symbol * refactor symbol callback * set hierarchical symbol support to true * add documentation and default mapping Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
* LSP: remove obsolete "peek definition" code #12178Thore Weilbier2020-04-25
| | | | | | The method with the name 'textDocument/peekDefinition' is not part of the official language server protocol specification. Therefore no language server can/will support this. Thereby all related code and documentation as been removed.
* lsp: add bufnr to callback function argumentsHirokazu Hata2020-02-28
| | | | | DocumentSymbol type doesn't have location field. So when we'll add 'textDocument/documentSymbol’ handler, we can't decide which file have we jump to.
* add support to show diagnostics count in statusline (#11641)Alvaro Muñoz2020-02-26
| | | | | * add support to show diagnostics count in statusline * documentation
* LSP: implement documentHighlight (#11638)Alvaro Muñoz2020-02-26
| | | | | | | | * implement documentHighlight * fix bug * document highlight groups * use uppercase for help section title * documentation
* LSP: Refine formatting tabSize #11834Jesse-Bakker2020-02-10
| | | | | | | | | | | | Use the logic explained in the softtabstop help section for defining the tabSize parameter in formatting requests. This means that: - if softtabstop is 0, tabstop is used - if softtabstop < 0, shiftwidth is used - if softtabstop > 0, softtabstop is used When inserting spaces instead of tabs, softtabstop is used in vim. Therefor it would be more logical to use it when formatting instead of the current tabstop.
* LSP: Move default buf callbacks to vim.lsp.callbacks (#11452)Ashkan Kiani2019-11-26
| | | | | | | - In the process, refactored focusable_preview to a util function. - Add text for locations_to_items of the current line. - Improve location callback to handle multiple return values by using set_qflist. - Remove update_tagstack and leave note for future travelers.
* Add support for textDocument/references.Ashkan Kiani2019-11-24
| | | | | | Add set_qflist and set_loclist. - Also add locations_to_items, which calculates byte offsets for character positions in files and avoids unnecessary operations.
* UI tweaks.Ashkan Kiani2019-11-23
| | | | | | - Hide diagnostics on client exit - Stop insert on popup focus. - Hide popup on insertchar (for signature_help)
* Fix encoding translation in other places.Ashkan Kiani2019-11-21
|
* Fix position params for encoding.Ashkan Kiani2019-11-21
|
* Account for character length in jump position.Ashkan Kiani2019-11-21
|
* UpdatesAshkan Kiani2019-11-21
| | | | | | | | - Use correct implementation of text_edits. - Send indent options to rangeFormatting and formatting. - Remove references to vim bindings and filetype from lsp.txt - Add more examples to docs. - Add before_init to allow changing initialize_params.
* Use the apply_text_edits from util.Ashkan Kiani2019-11-20
|
* Fix reference in rename.Ashkan Kiani2019-11-20
|
* Add full text_edit implementation.Ashkan Kiani2019-11-20
| | | | | | | | - Implements textDocument/formatting, textDocument/rangeFormatting, workspace/applyEdit. TODO: - still has edge cases around replacement probably. Only tested with inserts on the same position.
* Satisfy lualint.Ashkan Kiani2019-11-20
|
* Fix rename support.Ashkan Kiani2019-11-20
|
* Spaces not tabs.Ashkan Kiani2019-11-20
|
* Change error writer to not be annoying.Ashkan Kiani2019-11-20
|
* Move everything to buf & default_callbacksAshkan Kiani2019-11-20
| | | | | | | | - Rename builtin_callbacks to default_callbacks and slightly change its semantics: - No longer contains the default implementations. Instead, any default_callbacks will be used in preference for our .buf methods. - Add this to the docs.
* Add everything to lsp.buf and get rid of autoload.Ashkan Kiani2019-11-20
|
* Add lsp.buf and hover implementation.Ashkan Kiani2019-11-20