Add a function to find out if LSP server has replied with completion
matches. This is needed in case of using external completion engines
that expect asynchronous callback. LSP client simply acts as a source
of completion items through omnifunc (g:LspOmniFunc). Before calling
the omnifunc the second time g:LspOmniCompletePending can be checked
to see if LSP server is ready to provide completion items.
Update the client capabilities. Pass buffer number to autocmd handler functions. Send pending file changes to the language server before updating inlay hints and highlights
Magnus Groß [Tue, 11 Jul 2023 16:56:19 +0000 (18:56 +0200)]
Never show diagnostics when they are disabled
A regression was introduced in 6e4ba228eaa0770470060d8d47a360bd05a04ee5
that causes diagnostics to be displayed on buffer reload, even when the
user disabled them.
Fix this by moving the option check directly to DiagsRefresh.
Add the ":LspDiag" command and add sub-commands for the various Lsp
diagnostic functionality. Update the test scripts to use the new set of
commands. Add support for dynamically changing the value of the
diagnostic options. Remove the ":LspDiagHighlightEnable" and the
":LspDiagHighlightDisable" commands (these are replaced by the ":LspDiag
highlight" command)
Yegappan Lakshmanan [Thu, 29 Jun 2023 04:44:00 +0000 (21:44 -0700)]
Add an option (showDiagWithSign) to enable/disable placing signs on lines with diagnostics. Add separate virtual text highlight groups for each type of diagnostic
Girish Palya [Sun, 25 Jun 2023 11:26:37 +0000 (13:26 +0200)]
Make buffer completion responsive for large files
Since buffer completion processes the current buffer everytime user
types something, it will degrade the experience for large files.
This change adds a timeout to buffer completor function. Processing
current buffer is cut short when timeout is exceeded. Setting
timeout to 0 will revert back to existing behaviour.
Default is set to 100 ms, good for scanning 6000 lines on M1 macbook.
It is possible to get fancy by scanning locality of cursor first
but such complication may not be worth the complexity.
Tested on >20k line files (I have to open these large C files
filled with hw specs occasionally).
M autoload/lsp/completion.vim
M autoload/lsp/options.vim
M doc/lsp.txt
Magnus Groß [Fri, 2 Jun 2023 16:28:18 +0000 (18:28 +0200)]
Add Ale integration support
Ale [0] is a famous plugin to show linter warnings and diagnostics. It
already provides extensive functionality and configurability to display
those diagnostics.
In order to allow diagnostics from other plugins (e.g. LSP plugins) to
be shown together with those linter warnings, Ale has API so that those
diagnostics can be sent to Ale.
Ale will then display them as if they came from Ale itself. This is
useful for many reasons, e.g. this ensures a consistent look and allows
the location list for a window to be populated with all diagnostics,
regardless from which plugin they come.
There are other famous LSP plugins, that already integrate with Ale,
e.g. coc.nvim [1] allows this with "diagnostic.displayByAle".
This patch implements the same functionality by adding an "aleSupport"
option that is off by default. If the option is turned on, diagnostics
will be sent to Ale instead of being displayed by this plugin directly.
Girish Palya [Thu, 1 Jun 2023 14:13:57 +0000 (16:13 +0200)]
Fix bug where buffer completion spams
Steps to reproduce:
- Enable buffer completion
- Search for 'xyz' where 'xy' has completions
- Backspace to remove 'z'
- You'll see all items from current buffer shown that are not related
to 'xy'
Girish Palya [Thu, 1 Jun 2023 09:04:43 +0000 (11:04 +0200)]
Add support for hrsh7th/vim-vsnip snippets
Summary:
- Query vim-vsnip plugin for snippet completions and add the items
to the completion list.
- Add a boolean flag to set vsnip completion option
- Update documentation
- Without this enhancement vsnip could only expand LSP provided
snippets
- Inteface to vim-vsnip plugin is based on hrsh7th/cmp-vsnip
Completion is not triggered for non-keyword characters like '#' (ex. #
before #if in C) even though vsnip is capable of such completion,
unless LSP server sets special characters as trigger characters. This
is not a major shortcoming since it will expand once a keyword
character is typed (say, #i in #if). To address this issue some code
reorganization is needed, and perhaps separation of completion
mechanism from the LSP client core.
User can define keymaps for Tab completion as follows:
(<Space> will expand the snippet)
Magnus Groß [Wed, 31 May 2023 22:51:38 +0000 (00:51 +0200)]
Unify completepopup settings
There is not really a reason to have different completepopup settings
depending on if the LSP server supports lazy documentation or not:
In both cases info may be displayed, the only difference being that with
"resolveProvider" the info is to be fetched on demand.
But for both scenarios the formatting of the info popup should be the
same.
This fixes a problem, where in the non-lazydoc branch the info popup is
colored with the PmenuSel highlight group, which is a little bit ugly
when the content is syntax highlighted as well.