* 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
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.
* use label when filterText is falsy value
* use label when insertText is falsy value on completion done
* Revert "fix inserting "v:null" when newText in textEdit is null (#1093)"
This reverts commit 907f1c9667.
* Revert "add test case where newText is null for #1093 (#1094)"
This reverts commit e214f1cfee.
* Change text edit implementation to support \r
* Fix edit on unloaded buffer
* Add \r\n tests
* Fix for perf
Co-authored-by: mattn <mattn.jp@gmail.com>
* Add test to check v:completed_item after textedits
* Fix v:completed_item being reset after text edits
* Add silent to execute call in apply_text_edits
* Add test of 'lsp#utils#text_edit#apply_text_edits'.
* Fix `lsp#utils#text_edit#apply_text_edits` is delete one character when textEdit command kind is insert.
I fix the problem the apply_text_edits is deleting one character
if "textEdit['range']['start'] equals textEdit['range']['end'] and textEdit['new Text'] is empty".
* Fix tests.
- create new buffer each tests
- add test utility function `s:set_text` and `get_text`
* If the user has "fixendofline" set, append a blank line to preserve the EOF newline
* Break utility function out into its own file and add tests
* Improve EOL detection based on docs and improve tests