mirror of
https://github.com/neovim/neovim.git
synced 2026-05-27 15:25:33 +00:00
feat(lsp): highlight foldtext via treesitter #38789
Problem: To support `collapsedText`, which allows the LSP server to determine the content of the foldtext, we provided `vim.lsp.foldtext()`. However, such content does not have highlighting. Solution Treat the filetype of `collapsedText` as the filetype of the corresponding buffer and use tree-sitter to highlight it.
This commit is contained in:
@@ -1506,8 +1506,11 @@ end
|
||||
|
||||
--- Provides a `foldtext` function that shows the `collapsedText` retrieved,
|
||||
--- defaults to the first folded line if `collapsedText` is not provided.
|
||||
function lsp.foldtext()
|
||||
return vim.lsp._folding_range.foldtext()
|
||||
---
|
||||
--- The displayed foldtext will be highlighted via treesitter.
|
||||
---@param lnum? integer line number (default: current fold start)
|
||||
function lsp.foldtext(lnum)
|
||||
return vim.lsp._folding_range.foldtext(lnum)
|
||||
end
|
||||
|
||||
---@deprecated Use |vim.lsp.get_client_by_id()| instead.
|
||||
|
||||
Reference in New Issue
Block a user