aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp
Commit message (Collapse)AuthorAge
* feat(lsp)!: vim.lsp.inlay_hint.get(), enable(), is_enabled() #25512LW2023-11-12
| | | | | | | | | | | | | | | | | | refactor!: `vim.lsp.inlay_hint()` -> `vim.lsp.inlay_hint.enable()` Problem: The LSP specification allows inlay hints to include tooltips, clickable label parts, and code actions; but Neovim provides no API to query for these. Solution: Add minimal viable extension point from which plugins can query for inlay hints in a range, in order to build functionality on top of. Possible Next Steps --- - Add `virt_text_idx` field to `vim.fn.getmousepos()` return value, for usage in mappings of `<LeftMouse>`, `<C-LeftMouse>`, etc
* fix(lsp): fix omnicomplete in middle of the line (#25787)Lajos Koszti2023-10-26
| | | | | | | | Fixes a regression from 5e5f5174e3faa862a9bc353aa7da41487911140b Until that commit we had a logic like this: `local prefix = startbyte and line:sub(startbyte + 1) or line_to_cursor:sub(word_boundary)` The commit changed the logic and no longer cut off the line at the cursor, resulting in a prefix that included trailing characters
* fix(lsp): fix off-by-one error for omnifunc word boundaryMathias Fussenegger2023-10-23
| | | | | | | | Fixes https://github.com/neovim/neovim/issues/25177 I initially wanted to split this into a refactor commit to make it more testable, but it appears that already accidentally fixed the issue by normalizing lnum/col to 0-indexing
* fix(lsp): refactor escaping snippet text (#25611)Maria José Solano2023-10-14
|
* fix(lsp): account for border height in max floating popup height (#25539)LW2023-10-08
|
* feat(lsp)!: replace snippet parser by lpeg grammarMaria José Solano2023-10-02
|
* test(lsp): add normalize_markdown testsMaria José Solano2023-09-20
|
* feat(lsp): improve control over placement of floating windows (#24494)Grace Petryk2023-09-10
|
* fix(lsp): only disable inlay hints / diagnostics if no other clients are ↵Chris AtLee2023-08-31
| | | | | | | | | | | | | | | | | | | connected (#24535) This fixes the issue where the LspNotify handlers for inlay_hint / diagnostics would end up refreshing all attached clients. The handler would call util._refresh, which called vim.lsp.buf_request, which calls the method on all attached clients. Now util._refresh takes an optional client_id parameter, which is used to specify a specific client to update. This commit also fixes util._refresh's handling of the `only_visible` flag. Previously if `only_visible` was false, two requests would be made to the server: one for the visible region, and one for the entire file. Co-authored-by: Stanislav Asunkin <1353637+stasjok@users.noreply.github.com> Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
* feat(highlight): Allow hyphens (-) in highlight group names (#24714)Gregory Anders2023-08-15
| | | Fixes: https://github.com/neovim/neovim/issues/23184
* feat(lsp): implement textDocument/diagnostic (#24128)Chris AtLee2023-07-20
|
* fix(lsp): markdown code fence should allow space before info string #24364Mike2023-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Bash language server returns "hover" markdown content that starts with a code fence and info string of `man` preceded by whitespace, which Nvim does not render properly. See https://github.com/bash-lsp/bash-language-server/blob/0ee73c53cebdc18311d4a4ad9367185ea4d98a03/server/src/server.ts#L821C15-L821C15 ```typescript function getMarkdownContent(documentation: string, language?: string): LSP.MarkupContent { return { value: language ? // eslint-disable-next-line prefer-template ['``` ' + language, documentation, '```'].join('\n') : documentation, kind: LSP.MarkupKind.Markdown, } } ``` For example, ``` ``` man NAME git - the stupid content tracker ``` ``` If I remove the white space, then it is properly formatted. ``` ```man instead of ``` man ``` Per CommonMark Spec https://spec.commonmark.org/0.30/#info-string whitespace is allowed before and after the `info string` which identifies the language in a codeblock. > The line with the opening code fence may optionally contain some text > following the code fence; this is trimmed of leading and trailing > spaces or tabs and called the [info > string](https://spec.commonmark.org/0.30/#info-string). If the [info > string](https://spec.commonmark.org/0.30/#info-string) comes after > a backtick fence, it may not contain any backtick characters. (The > reason for this restriction is that otherwise some inline code would > be incorrectly interpreted as the beginning of a fenced code block.) Solution: Adjust stylize_markdown() to allow whitespace before codeblock info.
* feat(lsp): move inlay_hint() to vim.lsp (#24130)Mathias Fußenegger2023-06-30
| | | | | | Allows to keep more functions hidden and gives a path forward for further inlay_hint related functions - like applying textEdits. See https://github.com/neovim/neovim/pull/23984#pullrequestreview-1486624668
* feat(lsp): opt-in to dynamicRegistration for inlay hints (#24102)Mathias Fußenegger2023-06-22
| | | | | Since https://github.com/neovim/neovim/pull/23681 there is dynamic registration support. We should use that for new features unless there is a good reason to turn it off.
* feat(lsp): inlay hints #23984Chinmay Dalal2023-06-19
| | | | | | | | | | | Add automatic refresh and a public interface on top of #23736 * add on_reload, on_detach handlers in `enable()` buf_attach, and LspDetach autocommand in case of manual detach * unify `__buffers` and `hint_cache_by_buf` * use callback bufnr in `on_lines` callback, bufstate: remove __index override * move user-facing functions into vim.lsp.buf, unify enable/disable/toggle Closes #18086
* feat(lsp): add handlers for inlay hints (#23736)Chinmay Dalal2023-06-11
| | | initial support; public API left for a follow-up PR
* refactor(lsp): use LPeg for watchfiles matching (#23788)Jon Huhn2023-06-05
|
* feat(lua): rename vim.loop -> vim.uv (#22846)Lewis Russell2023-06-03
|
* test: don't unnecessarily specify win/buf for `nvim_(get|set)_option_value`Famiu Haque2023-05-22
| | | | `nvim_(get|set)_option_value` pick the current buffer / window by default for buffer-local/window-local (but not global-local) options. So specifying `buf = 0` or `win = 0` in opts is unnecessary for those options. This PR removes those to reduce code clutter.
* refactor(options): deprecate nvim[_buf|_win]_[gs]et_optionLewis Russell2023-05-21
| | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: famiu <famiuhaque@protonmail.com>
* test(lsp): fix unstable tests for semantic tokensjdrouhard2023-04-23
| | | | Add screen:expect() calls after insert() to make sure the screen has been drawn before we assert the state of the semantic tokens table
* docs: fix typosdundargoc2023-04-04
| | | | | | Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Raphael <glephunter@gmail.com> Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com> Co-authored-by: himanoa <matsunoappy@gmail.com>
* feat(diagnostic): add support for tagsLewis Russell2023-03-30
| | | | | | The LSP spec supports two tags that can be added to diagnostics: unnecessary and deprecated. Extend vim.diagnostic to be able to handle these.
* feat(lsp): render markdown in docs hover #22766Roberto Pommella Alegro2023-03-25
| | | | | | | | | | | Problem: LSP docs hover (textDocument/hover) doesn't handle HTML escape seqs in markdown. Solution: Convert common HTML escape seqs to a nicer form, to display in the float. closees #22757 Signed-off-by: Kasama <robertoaall@gmail.com>
* fix(lsp): prevent lsp tests from picking up local user config (#22606)Mathias Fußenegger2023-03-10
| | | | | | | | Sets `NVIM_APPNAME` for the lsp server instances and also for the `exec_lua` environment to ensure local user config doesn't interfere with the test cases. My local `ftplugin/xml.lua` broke the LSP test cases about setting `omnifunc` defaults.
* feat(lsp)!: add rule-based sem token highlighting (#22022)swarn2023-03-06
| | | | | | | | | | | | | feat(lsp)!: change semantic token highlighting Change the default highlights used, and add more highlights per token. Add an LspTokenUpdate event and a highlight_token function. :Inspect now shows any highlights applied by token highlighting rules, default or user-defined. BREAKING CHANGE: change the default highlight groups used by semantic token highlighting.
* feat(lsp): implement workspace/didChangeWatchedFiles (#22405)Jon Huhn2023-03-05
|
* perf(lsp): only redraw the windows containing LSP tokensbfredl2023-02-28
| | | | | | | | redraw! redraws the entire screen instead of just the windows with the buffer which were actually changed. I considered trying to calculating the range for the delta but it looks tricky. Could a follow-up.
* 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
|
* fix(tests): use -l mode for lsp testsbfredl2023-01-31
| | | | | This fixes "fake server" from leaking memory, which makes ASAN very upset, except on current ASAN CI for some reason.
* 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.
* test(lsp): add a screen:expect() between insert() and feed_command() (#21577)zeertzjq2022-12-29
| | | | The insert() and feed_command() type a lot of text, with only one screen:expect() call after the feed_command() it may time out.
* fix(lsp): token_edit.data might be null on deletion (#21462)tiagovla2022-12-19
|
* 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)
* 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): 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(test): create an lsp-specific helpers.lua fileJohn Drouhard2022-12-08
| | | | * move the code for creating fake rpc servers there
* refactor(lsp): use autocmd api (#19407)ii142022-07-17
| | | | | | | * refactor(lsp): use autocmd api * refactor(lsp): inline BufWritePost and VimLeavePre callbacks
* fix(lsp): small bugs in snippet-parser #18998L3MON4D32022-06-29
| | | | | | | | | This fixes the following bugs: `${1:else_text}` -> format with if_text: "else_text" `${1:-else_text}` -> format with if_text: "else_text" `${1:}` in `format` (eg. empty else_text) -> error. `${1:}` (eg. empty placeholder) -> error. Thanks hrsh7th :)
* fix(lsp): fix unnecessary buffers being added on empty diagnostics (#18275)ii142022-04-26
| | | | | Some language servers send empty `textDocument/publishDiagnostics` messages after indexing the project with URIs corresponding to unopened buffers. This commit guards against opening buffers corresponding to empty diagnostics.
* fix(lsp): handle insertion of previous line (#17618)Michael Lingelbach2022-03-06
|
* fix(lsp): start incremental sync range at previous newline character (#17610)Michael Lingelbach2022-03-05
| | | This change forces the start of an incremental sync range to begin always on an existing line.
* feat(diagnostic): add "code" to the diagnostic structure (#17510)David Shen2022-03-02
|
* fix(lsp): correctly align start and end range to codepoints during ↵Rishikesh Vaishnav2021-12-17
| | | | | | | | | | | | | | | | | | | | | incremental sync (#16670) Closes #16624 Fixes two issues with aligning the start position and end position to codepoints when calculating the start and end range. When aligning the start position: * use aligned byte index to calculate character index rather than the unadjusted byte When aligning the end position: * do not adjust the end byte if it falls on a UTF-8 codepoint * align byte to the first byte of the next codepoint rather than the last byte of the current codepoint * compute character character end range on the aligned byte index This commit also adds additional test coverage, including multibyte operations that previously failed before this commit.
* fix(lsp): improve incremental sync robustness (#16358)Michael Lingelbach2021-11-18
| | | | | closes https://github.com/neovim/neovim/issues/16352 * improve handling of multi-byte deletions
* fix(lsp): fix edge cases in incremental sync (#16308)Michael Lingelbach2021-11-15
|
* fix(lsp): rewrite incremental sync (#16252)Michael Lingelbach2021-11-09
| | | | | | * use codeunits/points instead of byte ranges when applicable * take into account different file formats when computing range and sending text (dos, unix, and mac supported) * add tests of incremental sync