summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/lsp/util.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-23fix(lsp): malformed edit if apply_text_edits() is called twice #34954geril071
Problem: Use vim.lsp.util.apply_text_edits to re-apply the same textedit causes an incorrect edit, because apply_text_edits silently modifies the parameter. Solution: - Avoid changing `text_edit._index`. - Document this fun feature. Helped-by: Riley Bruins <ribru17@hotmail.com> Helped-by: Yi Ming <ofseed@foxmail.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-15fix(lsp): set 'winfixbuf' in open_floating_preview() window #39058Raizento1
Problem: The window opened by `vim.lsp.util.open_floating_preview()` allows its buffer to be switched. Presumably that only happens by accident and is disorienting. Solution: Set 'winfixbuf' in the open_floating_preview() window.
2026-04-15refactor(api): rename "window" to "win" (positional parameters) #39083Justin M. Keyes1
continues d0af4cd9094f. This commit renames positional parameters. This is only "cosmetic", but is intended to make it extra clear which name is preferred, since people often copy existing code despite the guidelines in `:help dev-naming`.
2026-04-14docs: lsp, options, api #38980Justin M. Keyes1
docs: lsp, options - revert bogus change to `_meta/builtin_types.lua` from 3a4a66017b74 Close #38991 Co-authored-by: David Mejorado <david.mejorado@gmail.com>
2026-04-12fix(lsp): show_document can't position cursor past EOL in insert-mode #38566Lars Debor1
Problem: vim.lsp.util.show_document insert mode is unable to set the cursor after the target character position if the target character is at end of line. Solution: Move cursor after the target character (in append position) in this case.
2026-04-08feat(api): rename buffer to buf #35330Jordan1
Problem: `:help dev-name-common` states that "buf" should be used instead of "buffer" but there are cases where buffer is mentioned in the lua API. Solution: - Rename occurrences of "buffer" to "buf" for consistency with the documentation. - Support (but deprecate) "buffer" for backwards compatibility. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-08fix(lsp): apply_text_edits causes unwanted BufDelete events #38778glepnir1
Problem: Since 2f6d1d3c887a87d9402137425b418dd12a904aac, `apply_text_edits` unconditionally sets `buflisted=true`, causing spurious BufDelete events if plugins restore the original 'buflisted' state on unlisted buffers: https://github.com/neovim/neovim/blob/65ef6cec1cb766334c59d3255595dfe523b11020/src/nvim/option.c#L2159-L2169 Solution: - Don't set 'buflisted' in `apply_text_edits`. Set it more narrowly, in `apply_workspace_edit` where the semantics requires affected buffers to be visible to the user. - Also skip setting 'buflisted' if it would not be changed, to avoid redundant `OptionSet` events.
2026-03-12refactor: integer functions, optimize asserts #34112Lewis Russell1
refactor(lua): add integer coercion helpers Add vim._tointeger() and vim._ensure_integer(), including optional base support, and switch integer-only tonumber()/assert call sites in the Lua runtime to use them. This also cleans up related integer parsing in LSP, health, loader, URI, tohtml, and Treesitter code. supported by AI
2025-11-17fix(lsp): set concealcursor='' in LSP floating windows #36596skewb1k1
Problem: Users often jump and navigate through LSP windows to yank text. Concealed markdown can make navigation through hyperlinks and code blocks more difficult. Solution: Change 'concealcursor' from 'n' to '' to preserve clean display while improving navigation and selection of the LSP response. Closes #36537
2025-10-22fix(lsp): set 'linebreak' in floating windows (#36275)Fredrik Lanker1
Set linebreak to avoid splitting words. Fix #36268
2025-10-05fix: remove quotes around `nil` deprecation alternatives (#36047)Maria Solano1
2025-08-28refactor(lua): consistent use of local aliasesChristian Clason1
2025-08-18refactor(lsp): move `util.enable` to `capability.enable`Yi Ming1
2025-08-11feat(lsp): support signature help noActiveParameterSupport #34838skewb1k1
2025-08-06feat(lsp): improve signature help display #35190skewb1k1
- Add delimiter between function signature and documentation, matching hover formatting - Show title only if there are multiple clients or multiple signatures - Avoid duplicating the title inside the window if it's already shown in the border
2025-08-06fix(lsp): show title when global winborder is set (#35181)glepnir1
Problem: make_floating_popup_options only shows when opts.border is explicitly set, ignoring global winborder setting Solution: check both opts.border and vim.o.winborder when determining whether to show title
2025-08-05fix(lsp): make thematic break parsing conform to GFM spec (#35162)skewb1k1
- Support for '_' and '*' as delimiters - Allow spaces between delimiters - Use more efficient implementation
2025-08-03fix(lsp): decode 'null' in server responses as vim.NIL #34849skewb1k1
Problem: Previously, 'null' value in LSP responses were decoded as 'nil'. This caused ambiguity for fields typed as '? | null' and led to loss of explicit 'null' values, particularly in 'data' parameters. Solution: Decode all JSON 'null' values as 'vim.NIL' and adjust handling where needed. This better aligns with the LSP specification, where 'null' and absent fields are distinct, and 'null' should not be used to represent missing values. This also enables proper validation of response messages to ensure that exactly one of 'result' or 'error' is present, as required by the JSON-RPC specification.
2025-07-22fix(lsp): support `containerName` in symbol requests #35029Riley Bruins1
The field is present for SymbolInformation and WorkspaceSymbol.
2025-07-15fix(lsp): close floating preview window correctly #34946Donatas1
Problem: After 28b7c2d (found with bisect) the hover preview window does not close when :edit'ing another file, even when you move the cursor. Solution: Change the BufLeave to target the original buffer, not the preview buffer.
2025-07-12refactor(lsp): drop vim.lsp.util._refresh() #33903Yi Ming1
Problem: - util._refresh() is only used by `inlay_hint.lua` and `document_color.lua`, and both have their own wrapper functions; - util._refresh() provides unified parameters, but this layer of wrapping is almost meaningless because - document color does not need the range parameter; - inlay hint requires a range parameter, but it is not complicated Therefore, it can be considered redundant. ref https://github.com/neovim/neovim/pull/32887#discussion_r1996413602 Solution: Remove it.
2025-07-13refactor(lsp): utility functions for `enable()/is_enabled()`Yi Ming1
2025-07-10fix(lsp): custom 'winborder' in make_floating_popup_options() #34868Sebastian Lyng Johansen1
2025-07-08fix(health): floating window closes when opening TOC (gO) #34794glepnir1
Problem: Health check floating window gets closed when pressing 'gO' to show TOC because LSP floating preview system auto-closes on BufEnter events triggered by :lopen. Solution: Temporarily disable BufEnter event for the current window during TOC operations and adjust window layout to prevent overlap.
2025-07-06feat(lsp): handle deprecated document symbols (#34751)Maria José Solano1
2025-06-23feat(lsp): support annotated text edits (#34508)Maria José Solano1
2025-06-06fix: type fixesLewis Russell1
Type fixes caught by emmylua
2025-05-02fix(lsp): use `bufnr` when getting clients in `symbols_to_items` (#33760)Maria José Solano1
2025-04-24refactor(lsp): add `handler` to `vim.lsp.util._refresh` optionsMaria José Solano1
2025-04-21feat(api): add "max_height" argument to nvim_win_text_height (#32835)luukvbaal1
Useful to e.g. limit the height to the window height, avoiding unnecessary work. Or to find out how many buffer lines beyond "start_row" take up a certain number of logical lines (returned in "end_row" and "end_vcol").
2025-04-17feat(lsp): use stricter types for methodsLewis Russell1
This change modifies gen_lsp.lua so alias types are generated for various types of lsp methods to distinguish between notifications and requests: - vim.lsp.protocol.Method.ServerToClient.Request - vim.lsp.protocol.Method.ServerToClient.Notification - vim.lsp.protocol.Method.ClientToServer.Request - vim.lsp.protocol.Method.ClientToServer.Notification These types are then used instead of `string` where appropriate.
2025-04-09fix(lsp): "bold" border for vim.lsp.buf.hover #33395Siddhant Agarwal1
Problem: vim.lsp.buf.hover allows a bold border size which hasn't been defined Solution: Define the bold border size for vim.lsp.buf.hover
2025-04-04feat(lsp.util): deprecate vim.lsp.util.stylize_markdownLewis Russell1
It's not used anywhere.
2025-04-04fix: bug in stylize_markdownLewis Russell1
`stripped` and `markdown_lines` are iterated together so must have the same length.
2025-03-22fix(lsp): handle using array as open_floating_preview title (#33016)Au.1
2025-03-18feat(float): add winborder option (#31074)glepnir1
Problem: There is currently no global option to define the default border style for floating windows. This leads to repetitive code when developers need consistent styling across multiple floating windows. Solution: Introduce a global option winborder to specify the default border style for floating windows. When a floating window is created without explicitly specifying a border style, the value of the winborder option will be used. This simplifies configuration and ensures consistency in floating window appearance. Co-authored-by: Gregory Anders <greg@gpanders.com>
2025-03-15fix(lsp): autocmds to close lsp preview windows not clearedbekaboo1
Problem: Augroup to close lsp preview hover window is not cleared after the window is closed because of unmatched group name. Solution: Delete the augroup before closing the preview window with correct group name.
2025-03-11fix(lsp): improve LSP floating preview window cleanup #31353glepnir1
Problem: The current implementation creates a unique autocommand group for each floating preview window, which is inefficient and can lead to numerous autocommand groups. Solution: Use a single shared autocommand group with improved window validation to properly clean up LSP floating preview windows.
2025-03-04fix(lsp): open_floating_preview() ignores max_height (#32716)Robert Muir1
Problem: After 47aaddfa the max_height option is no longer respected. Hover documentation and Signature help windows take up the entire text height. Solution: Compare to window's current height and only modify the height if it would reduce the height, not enlarge it.
2025-03-02docs: misc #31996Justin M. Keyes1
2025-02-27doc: clarify window-id, tab-id, nvim_set_current_x #32528David Briscoe1
Problem: Descriptions are somewhat vague. nvim_set_current_line modifies contents but nvim_set_current_buf does not, etc. Solution: - Make it clear that these functions accept or return a winid/tabid by linking to that concept in help. - Only these few files use the term "handles", so replace them with the more conventional terminology. - Add a new help section for tab-ID. This concept is unique to neovim because vim exposes tabnr, but not tab handles. This section is modelled after `:h winid`.
2025-02-25fix(lsp): resize hover window for concealed linesLuuk van Baal1
Problem: Height of a (markdown) `vim.lsp.util.open_floating_preview()` window can be reduced to account for concealed lines (after #31324). Solution: Set the window height to the text height of the preview window. Set 'concealcursor' to avoid unconcealing the cursorline when entering the hover window.
2025-02-23fix(float): ensure floating window width can fit titleMaria José Solano1
2025-02-13fix(lsp): missing method parameter when canceling requestsYi Ming1
2025-02-12fix(lsp): on detach, cancel pending foldingRange requests #31509Yi Ming1
Problem: 1. Open a relatively large file (so the server needs some time to process the request). 2. Then immediately execute `:bdelete`. 3. Once the request is completed, the handler will obtain the bufstate of a buffer already unloaded. Error executing vim.schedule lua callback: ...7841_1/share/nvim/runtime/lua/vim/lsp/_folding_range.lua:119: assertion failed! stack traceback: [C]: in function 'assert' ...7841_1/share/nvim/runtime/lua/vim/lsp/_folding_range.lua:119: in function 'multi_handler' ...7841_1/share/nvim/runtime/lua/vim/lsp/_folding_range.lua:140: in function 'handler' ...HEAD-c137841_1/share/nvim/runtime/lua/vim/lsp/client.lua:669: in function '' vim/_editor.lua: in function <vim/_editor.lua:0> Solution: On detach, cancel all pending textDocument_foldingRange requests.
2025-02-11feat(lsp)!: `symbol_to_item` requires `offset_encoding`Yi Ming1
2025-02-11feat(lsp): include `end_col` and `end_lnum` in `vim.lsp.buf.symbols_to_items`Yi Ming1
2025-01-27fix: resolve all remaining LuaLS diagnosticsLewis Russell1
2025-01-20fix(lsp): set floating window filetype after setup #32112Guilherme Soares1
Problem: The filetype for the floating window buffer is being set before its context is fully initialized. This results in `FileType` events not receiving the correct context. Solution: Set the filetype after the floating preview window and its buffer variables are fully configured to ensure proper context is provided.
2025-01-14refactor: use nvim.foo.bar format for autocommand groupsMaria José Solano1