diff options
Diffstat (limited to 'runtime/doc')
| -rw-r--r-- | runtime/doc/lsp.txt | 30 | ||||
| -rw-r--r-- | runtime/doc/news.txt | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 1693ff5e4f..f7157df0f2 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -204,6 +204,7 @@ won't run if your server doesn't support them. - `'textDocument/diagnostic'` - `'textDocument/documentHighlight'` - `'textDocument/documentSymbol'` +- `'textDocument/foldingRange'` - `'textDocument/formatting'` - `'textDocument/hover'` - `'textDocument/implementation'` @@ -697,6 +698,35 @@ commands *vim.lsp.commands* The second argument is the `ctx` of |lsp-handler| +foldclose({kind}, {winid}) *vim.lsp.foldclose()* + Close all {kind} of folds in the the window with {winid}. + + To automatically fold imports when opening a file, you can use an autocmd: >lua + vim.api.nvim_create_autocmd('LspNotify', { + callback = function(args) + if args.data.method == 'textDocument/didOpen' then + vim.lsp.foldclose('imports', vim.fn.bufwinid(args.buf)) + end + end, + }) +< + + Parameters: ~ + • {kind} (`lsp.FoldingRangeKind`) Kind to close, one of "comment", + "imports" or "region". + • {winid} (`integer?`) Defaults to the current window. + +foldexpr({lnum}) *vim.lsp.foldexpr()* + Provides an interface between the built-in client and a `foldexpr` + function. + + Parameters: ~ + • {lnum} (`integer`) line number + +foldtext() *vim.lsp.foldtext()* + Provides a `foldtext` function that shows the `collapsedText` retrieved, + defaults to the first folded line if `collapsedText` is not provided. + formatexpr({opts}) *vim.lsp.formatexpr()* Provides an interface between the built-in client and a `formatexpr` function. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 98782bfd15..ad3f2c0a6a 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -230,6 +230,8 @@ LSP • |vim.lsp.buf.hover()| now highlights hover ranges using the |hl-LspReferenceTarget| highlight group. • Functions in |vim.lsp.Client| can now be called as methods. +• Implemented LSP folding: |vim.lsp.foldexpr()| + https://microsoft.github.io/language-server-protocol/specification/#textDocument_foldingRange LUA |