* Fix completion item text selection priority
According to the Language Server Protocol 3.17 specification:
- filterText is only used for filtering and sorting completion items
- When textEdit is provided, insertText must be ignored
* Fix filtering should be performed on filterText
If `filterText` exists, the filtering target has been changed from `word`.
The filter is defined as follows in the LSP specification:
```
A string that should be used when filtering a set of completion items.
When omitted the label is used as the filter text for this item.
```
* Fix remove unnecessary empty check condition
---------
Co-authored-by: mattn <mattn.jp@gmail.com>
* fix(text_edit): discarded change from the initial buffer
When multiple calls to apply_text_edits, the changes made to the current
buffer are discarded if the following text_edit concerns a file that
is not in the buffer list.
The problem comes from the _switch function, which executes `edit!` when
it detects that the target is not in the buffer list. If a change was
made to the current buffer before that, that change is discarded
(definition of `edit!`).
The fix consists of a different logic: when _switch detects that the
target is not in the buffer list, it calls `badd` prior to switching to
the buffer that has just been added. No more `edit!`, no more discarded
changes.
The added test fails without the patch in the _switch function.
* use better way to have a named buffer
* fix languageId incorrectly set to "ctrlspace"
* remove get_line_count_buf() which incorrectly returned line('$') for hidden buffers
The problem was that current buffer may not be the one requested. Later it
caused vim to throw exception about invalid line number when setting text props,
and that led to initialization failure for some buffers (and lsp_buffer_enabled
autocommand not fired).
* don't register server twice
* skip registering server only if server_info matches
* revert changes to lsp#register_server
---------
Co-authored-by: Krzysztof Sachanowicz <ksachanowicz@striketechnologies.com>
It is convenient to be able to stop all LSP servers, regardless of the
currently active buffer.
Also, it seems confusing that when a server name is specified, it is
only stopped if it is also one handling the current buffer type. I
would imagine it is quite rare to have more than one server handing a
specific buffer type. And if one explicitly specified a name, it seems
reasonable to stop this particular server, regardless of the currently
active buffer.
When set `let g:lsp_use_native_client = 1` to enable native lsp client support,
if call `:LspStopServer` to stop the lsp server, the server stopped but the
status still show it as `running` by `:LspStatus`, this patch try to fix
this issue.
When using typescript-language-server, in content `Math.ab|`, if you type
`<C-X><C-o>` for omni completion, it will be completed with `s`. Then, the
content will become `Math.abs|`. If you continue typing `(`, the `(` will
be removed. Also, if type `<CR>`, a new line will be added, resulting in
`Math.abs|s\nMath.ab`. This patch attempts to fix this issue.
It is sometimes useful to generate `workspace_config` using a callback.
For example, if the produced config needs to include some information
from the actual workspace.
When checking for backspace in `CompleteDone` event, also look at the
line number. If the line number changed, the user probably pressed
something like `<CR>` and not backspace.
Since v9.0.0993 vim performs a full redraw when removing text property
types, which causes flickering because vim-lsp currently removes and
re-adds the property type every time the highlight is updated. To avoid
that, we can just check if the property type already exists on the
given buffer, and only add it if it doesn't exist yet.
* add g:lsp_experimental_native_lsp flag to enable native vim lsp client
* send request and correctly call on_notification
* add support for native client in lsp#client#send_notification
* Add native lsp client support for lsp#client#send_response
* add native notification support
* add support for native stop job
* handle error response for document_formatting.vim and code_action.vim
* add missing return for code action
* fix indent
* undo code action error
* check for a:response to be of type dict as stderr will send string
* use out_cb and err_cb instead of channel callback
* bump has_native_client version check to 8.2.4780 which fixes LSP parsing messages when partial data is received
* rename g:lsp_experimental_native_lsp to g:lsp_use_native_client
* fix s:native_err_cb
* pass env
* disable lsp_use_native_client
* add lsp#utils#has_native_lsp_client()
* clean up log
* handle requests from server
* fix lint issues
* update docs
* Make verbose LspStatus show workspace config
Need the trailing echo to ensure the next lsp server is on a new line.
* Use pretty printing if available
* checkhealth: Print server status and config
Add initial checkhealth support.
See https://github.com/rhysd/vim-healthcheck
Lists server status, advice for failure, and lists workspace config to
help debug issues or understand server state. Doesn't do much error
detecting.
* checkhealth: Print each server config as a section
checkhealth doesn't allow a lot of formatting (no indentation), so it's
hard to make the config output readable. Output each server as a
separate section instead of one giant config block to make the start of
each server easier to see.