aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2022-08-30 13:14:09 +0200
committerGitHub <noreply@github.com>2022-08-30 13:14:09 +0200
commit0368ca70c437e82ae4709f8ed9562fb9aaf03c8c (patch)
tree0047f88f5e50346e47614ff3be1fe88d8fdfd2ed
parentf9c183c0cad95f0370067e849af6bdbada7b6517 (diff)
downloadrneovim-0368ca70c437e82ae4709f8ed9562fb9aaf03c8c.tar.gz
rneovim-0368ca70c437e82ae4709f8ed9562fb9aaf03c8c.tar.bz2
rneovim-0368ca70c437e82ae4709f8ed9562fb9aaf03c8c.zip
docs(lsp): replace formatting_sync example in lsp-faq (#19994)
`formatting_sync` is deprecated
-rw-r--r--runtime/doc/lsp.txt7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 82d94afdc8..aba5c9a4a0 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -126,13 +126,14 @@ FAQ *lsp-faq*
"after/ftplugin/python.vim".
- Q: How do I run a request synchronously (e.g. for formatting on file save)?
- A: Use the `_sync` variant of the function provided by |lsp-buf|, if it
- exists.
+ A: Check if the function has an `async` parameter and set the value to
+ false.
E.g. code formatting: >
" Auto-format *.rs (rust) files prior to saving them
- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)
+ " (async = false is the default for format)
+ autocmd BufWritePre *.rs lua vim.lsp.buf.format({ async = false })
<
*lsp-vs-treesitter*