diff options
author | David Lukes <dafydd.lukes@gmail.com> | 2020-05-05 17:23:45 +0200 |
---|---|---|
committer | David Lukes <dafydd.lukes@gmail.com> | 2020-06-22 09:48:41 +0200 |
commit | ebee9ebe2be2bd584efefc4064a8b3a07e0505e0 (patch) | |
tree | 54fe1520a078341c073c20c8c5b4e28404cbac59 /runtime/doc | |
parent | 4496628c181e456d57e9257e14d8582d8dc548eb (diff) | |
download | rneovim-ebee9ebe2be2bd584efefc4064a8b3a07e0505e0.tar.gz rneovim-ebee9ebe2be2bd584efefc4064a8b3a07e0505e0.tar.bz2 rneovim-ebee9ebe2be2bd584efefc4064a8b3a07e0505e0.zip |
lsp: Add sync variant of LSP formatting
Also, factor out a `vim.lsp.util.get_effective_tabstop()` helper and add
tests for it.
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/lsp.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index f81265c2c8..c3d25586b6 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -58,6 +58,11 @@ Nvim provides the |vim.lsp.omnifunc| 'omnifunc' handler which allows " Use LSP omni-completion in Python files. autocmd Filetype python setlocal omnifunc=v:lua.vim.lsp.omnifunc +If a function has a `*_sync` variant, it's primarily intended for being run +automatically on file save. E.g. code formatting: > + + " Auto-format *.rs files prior to saving them + autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000) ================================================================================ FAQ *lsp-faq* @@ -767,6 +772,12 @@ document_symbol() *vim.lsp.buf.document_symbol()* formatting({options}) *vim.lsp.buf.formatting()* TODO: Documentation +formatting_sync({options}, {timeout_ms}) *vim.lsp.buf.formatting_sync()* + Same as |vim.lsp.buf.formatting()| but synchronous. Useful + for running on save, to make sure buffer is formatted prior + to being saved. {timeout_ms} is passed on to + |vim.lsp.buf_request_sync()|. + hover() *vim.lsp.buf.hover()* TODO: Documentation |