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.
Magnus Groß [Wed, 31 May 2023 21:44:24 +0000 (23:44 +0200)]
Use getbufoneline() where applicable
This has better performance than getbufline() and as a sideeffect also
fixes a rare issue where the LSP sends invalid data such that
getbufline() reads an empty list and causes the array access to get out
of bounds. With getbufoneline() this neatly falls back to returning the
empty string.
Magnus Groß [Wed, 31 May 2023 20:01:47 +0000 (22:01 +0200)]
Skip invalid servers instead of aborting in LspAddServer()
If the user calls LspAddServer() with a list of servers, where the very
first entry does not exist, but all the remaining ones do, then no
servers are added at all. This doesn't make much sense, as the other
entries might be valid entries.
Fix this by simply continuing with the next entry instead of returning
when encountering an error.
Yegappan Lakshmanan [Sun, 28 May 2023 15:36:20 +0000 (08:36 -0700)]
Markdown text in a completion popup window is not properly rendered. In a Vim9 script, string index is a character index and not a byte index. Use strpart() instead of indexing a string to extract characters