aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp
Commit message (Collapse)AuthorAge
* fix(lsp): check method is supported when range formatting (#21970)Sean Dewar2023-01-24
| | | | | | `vim.lsp.buf.format()` silently did nothing if no servers supported `textDocument/rangeFormatting` when formatting with a range. Issue found by `@hwrd:matrix.org` in the Matrix chat.
* fix(lsp): assert workspace/applyEdit receives params (#21945)Mathias Fußenegger2023-01-22
| | | | | | | | | | | | | According to the specification `workspace/applyEdit` must be called with `ApplyWorkspaceEditParams`. So far the client just returned, which could lead to a misleading error on the server side because `workspace/applyEdit` must respond with a `ApplyWorkspaceEditResult`. This adds an assertion to clarify that the server is violating the specification. See https://github.com/neovim/neovim/issues/21925
* feat(lsp): add triggerKind option for vim.lsp.buf.code_action (#21905)kishii2023-01-21
|
* fix(lsp): fix `removed` param value in add_workspace_folder (#21915)Raphael2023-01-20
|
* docs(lsp): fix type annotation on convert_input_to_markdown_lines (#21772)Chris Kipp2023-01-12
| | | | | This small changes just ensures that if you're using `convert_input_to_markdown_lines` without `contents` you don't get a warning (when using something like neodev) that there is an expected second param, since it can be nil.
* fix(lsp): revert semantic token gravity change from #21574 (#21763)jdrouhard2023-01-12
|
* docs(lsp): update buf_notify and rpc.notify params types (#21753)Chris Kipp2023-01-11
| | | | | | | | Small, but I was getting warnings about my usage of `vim.lsp.buf_notify(bufnr, method, {example = example})` since the docs say that `params` must be a string, however this can really be anything when it's passed to `rpc.notify` since we just end up calling `vim.json.encode(payload)` on it. This fixes the docs in those two places and regenerates them.
* feat(float): open float relative to mouse #21531Sebastian Lyng Johansen2023-01-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: No easy way to position a LSP hover window relative to mouse. Solution: Introduce another option to the `relative` key in `nvim_open_win()`. With this PR it should be possible to override the handler and do something similar to this https://github.com/neovim/neovim/pull/19481#issuecomment-1193248674 to have hover information displayed from the mouse. Test case: ```lua local util = require('vim.lsp.util') local function make_position_param(window, offset_encoding) window = window or 0 local buf = vim.api.nvim_win_get_buf(window) local row, col local mouse = vim.fn.getmousepos() row = mouse.line col = mouse.column offset_encoding = offset_encoding or util._get_offset_encoding(buf) row = row - 1 local line = vim.api.nvim_buf_get_lines(buf, row, row + 1, true)[1] if not line then return { line = 0, character = 0 } end if #line < col then return { line = 0, character = 0 } end col = util._str_utfindex_enc(line, col, offset_encoding) return { line = row, character = col } end local make_params = function(window, offset_encoding) window = window or 0 local buf = vim.api.nvim_win_get_buf(window) offset_encoding = offset_encoding or util._get_offset_encoding(buf) return { textDocument = util.make_text_document_params(buf), position = make_position_param(window, offset_encoding), } end local hover_timer = nil vim.o.mousemoveevent = true vim.keymap.set({ '', 'i' }, '<MouseMove>', function() if hover_timer then hover_timer:close() end hover_timer = vim.defer_fn(function() hover_timer = nil local params = make_params() vim.lsp.buf_request( 0, 'textDocument/hover', params, vim.lsp.with(vim.lsp.handlers.hover, { silent = true, focusable = false, relative = 'mouse', }) ) end, 500) return '<MouseMove>' end, { expr = true }) ```
* feat(lsp): show active clients in :checkhealth vim.lsp (#21670)Mathias Fußenegger2023-01-08
| | | | | For users using vim.lsp.start it can be useful to get an overview of active client that is less verbose than a full `:lua =vim.lsp.get_active_clients()`
* fix(lsp): partially revert semantic token gravity change from #21574 (#21680)jdrouhard2023-01-08
|
* fix(lsp): correct callHierarchy capability to fix lsp.buf.incoming_calls() ↵2023-01-06
| | | | | (#21665) Co-authored-by: maozhongzhou <maozhongzhou@wps.cn>
* docs(lua): adjust some type annotationsnotomo2023-01-04
|
* feat(lsp): add function to clear codelens (#21504)Mathias Fußenegger2022-12-31
| | | | | | | | Currently once you retrieve the lenses you're pretty much stuck with them as saving new lenses is additive. Adding a dedicated method to reset lenses allows users to toggle lenses on/off which can be useful for language servers where they are noisy or expensive and you only want to see them temporary.
* fix(lsp): adjust gravity of semantic tokens extmarks (#21574)jdrouhard2022-12-30
| | | | | Fixes #21543 This should provide a better user experience when appending or prepending text to a word that has a semantic token extmark. More often than not, the appended/prepended text to the word will end up becoming part of the token anyway, so just use that extmark as the user types.
* fix(lsp): token_edit.data might be null on deletion (#21462)tiagovla2022-12-19
|
* feat: `vim.inspect_pos`, `vim.show_pos`, `:Inspect`Folke Lemaitre2022-12-17
|
* feat(lsp): add function to get semantic tokens at cursorChristian Clason2022-12-13
|
* feat(lsp): highlight semantic token modifiers (#21390)Christian Clason2022-12-12
| | | | | | | | Apply semantic token modifiers as separate extmarks with corresponding highlight groups (e.g., `@readonly`). This is a low-effort PR to enable the most common use cases (applying, e.g., italics or backgrounds on top of type highlights; language-specific fallbacks like `@global.lua` are also available). This can be replaced by more complicated selector-style themes later on.
* perf(lsp): update semantic tokens algorithm for parsing modifiers (#21383)jdrouhard2022-12-12
| | | | | | | | Instead of testing for every possible modifier type, only test bits up to the highest set in the token array. Saves many bit ops and comparisons when there are no modifiers or when the highest set bit is a lower bit than the highest possible in the legend on average. Can be further simplified when non-luaJIT gets the full bit module (see #21222)
* docs #20986Justin M. Keyes2022-12-11
| | | | | | - https://github.com/neovim/tree-sitter-vimdoc v1.2.4 eliminates most errors in pi_netrw.txt, so we can remove that workaround from ignore_parse_error(). - improved codeblock
* fix(lsp): ignore null responses for semanticTokens request (#21364)fsouza2022-12-10
| | | | | | | | The spec indicates that the response may be `null`, but it doesn't really say what a `null` response means. Since neovim raises an error if the response is `null`, I figured that ignoring it would be the safest bet. Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* fix(lsp): fix get_active_clients bufnr parameter (#21366)Mathias Fußenegger2022-12-09
| | | Follow up to https://github.com/neovim/neovim/pull/21337
* fix(lsp): correct some type annotations (#21365)Mathias Fußenegger2022-12-09
|
* fix(lsp): followup fixes for semantic tokens support (#21357)jdrouhard2022-12-09
| | | | | | | | | | | | | | | | 1. The algorithm for applying edits was slightly incorrect. It needs to preserve the original token list as the edits are applied instead of mutating it as it iterates. From the spec: Semantic token edits behave conceptually like text edits on documents: if an edit description consists of n edits all n edits are based on the same state Sm of the number array. They will move the number array from state Sm to Sm+1. 2. Schedule the semantic token engine start() call in the client._on_attach() function so that users who schedule_wrap() their config.on_attach() functions (like nvim-lspconfig does) can still disable semantic tokens by deleting the semanticTokensProvider from their server capabilities.
* feat(lsp): initial support for semantic token highlightingJohn Drouhard2022-12-08
| | | | | | * credit to @smolck and @theHamsta for their contributions in laying the groundwork for this feature and for their work on some of the helper utility functions and tests
* refactor(lsp): remove deprecated vim.lsp.buf_get_clients calls (#21337)Raphael2022-12-08
|
* feat(lsp): support willSave & willSaveWaitUntil capability (#21315)Mathias Fußenegger2022-12-08
| | | | | `willSaveWaitUntil` allows servers to respond with text edits before saving a document. That is used by some language servers to format a document or apply quick fixes like removing unused imports.
* fix(lsp): ensure open_logfile is safe for fast events (#21288)Mathias Fußenegger2022-12-04
| | | Closes https://github.com/neovim/neovim/issues/21052
* fix(lsp): call show_document with correct argsMathias Fussenegger2022-12-04
| | | | Closes https://github.com/neovim/neovim/issues/21177
* fix(lsp): render <pre>{lang} code blocks and set separator default to false ↵Folke Lemaitre2022-12-03
| | | | (#21271)
* docs(gen): support language annotation in docstringsChristian Clason2022-12-02
|
* docs: fix typos (#21196)dundargoc2022-11-29
| | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Raphael <glephunter@gmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com>
* feat(lsp): support set title in lsp relate floatwindow (#21110)Raphael2022-11-21
|
* fix(lsp): ignore hover and signatureHelp responses on buffer change (#21121)Grzegorz Rozdzialik2022-11-19
| | | | | | | | | | | | | | | | | | | Language servers can take some time to respond to the `textDocument/hover` and `textDocument/signatureHelp` messages. During that time, the user could have already moved to another buffer. The popup was always shown in the current buffer, which could be a different one than the buffer for which the request was sent. This was particularly annoying when moving to a buffer with a `BufLeave` autocmd, as that autocmd was triggered when the hover popup was shown for the original buffer. Ignoring the response from these 2 messages if they are for a buffer that is not the current one leads to less noise. The popup will only be shown for the buffer for which it was requested. A more robust solution could involve cancelling the hover/signatureHelp request if the buffer changes so the language server can free its resources. It could be implemented in the future.
* feat(lsp): run handler in coroutine to support async response (#21026)Mathias Fußenegger2022-11-19
| | | | To illustrate a use-case this also changes `window/showMessageRequest` to use `vim.ui.select`
* fix(lsp/window_showDocument): correctly handle external resources #20867lvimuser2022-10-30
| | | | | - since cmd is a list, it runs directly ('no shell') and we shouldn't escape. - typo: shellerror -> shell_error
* fix(lsp): reporting bogus capabilities in CodeActionKind #20678David Hotham2022-10-16
| | | | | | | | | | | | | | | | Problem: LSP client provides bogus capabilities in CodeActionKind. LSP logs show this in the "initialize" message: codeActionKind = { valueSet = { "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } Solution: Only the values from the CodeActionKind table should be presented, not also the keys. fix #20657
* fix(lua): properly configure luacheck and remove `local vim = ...` lines ↵Folke Lemaitre2022-10-09
| | | | (#20551)
* feat(lsp): support window/showDocument (#19977)lvimuser2022-10-08
|
* refactor(lsp): remove deprecated lsp functions (#20421)Mathias Fußenegger2022-10-01
|
* docs: fix typos (#20394)dundargoc2022-09-30
| | | | | Co-authored-by: Raphael <glephunter@gmail.com> Co-authored-by: smjonas <jonas.strittmatter@gmx.de> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* feat(gen_help_html.lua): adapt to new parserJustin M. Keyes2022-09-28
| | | | | - adapt to parser changes from https://github.com/vigoux/tree-sitter-vimdoc/pull/16 - numerous other generator improvements
* fix(docs): invalid :help links #20345Justin M. Keyes2022-09-25
| | | | | Fix those naughty single quotes. closes #20159
* fix(lsp): create missing directory before creating file (#19835)shaunsingh2022-09-24
| | | Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* fix(lsp): use correct function name in deprecated message (#20308)Mike2022-09-23
| | | fix: use correct function name in deprecated message
* fix(lsp): out of bounds error in lsp.util.apply_text_edits (#20137)ofwinterpassed2022-09-20
| | | Co-authored-by: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com>
* fix(lsp): support `false` result in handlers (#20252)Mathias Fußenegger2022-09-20
| | | Closes https://github.com/neovim/neovim/issues/20111
* docs(lsp): update rpc.start stdio limitations (#20120)Mathias Fußenegger2022-09-08
|
* feat(lsp): add range option to lsp.buf.format (#19998)Mathias Fußenegger2022-09-08
|
* fix(docs): update lsp.rpc.start docs to match return value changes (#20003)Mathias Fußenegger2022-08-30
| | | Follow up to https://github.com/neovim/neovim/pull/19916