13 Commits

Author SHA1 Message Date
thinca 7484060435 Remove debug log (#1628) 2026-01-01 00:15:53 +09:00
Thomas Bruyelle e05c42fbf0 fix(text_edit): discarded change from the initial buffer (#1552)
* 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
2024-07-19 22:56:11 -07:00
Linda_pp f076e6a7c0 Use 'label' value when 'insertText' or 'filterText' is falsy (#1095)
* 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.
2021-03-14 01:59:08 +09:00
Linda_pp e214f1cfee add test case where newText is null for #1093 (#1094) 2021-03-13 23:50:58 +09:00
hrsh7th 3e207c0ee4 Change text edit implementation to support \r (#718)
* 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>
2020-02-15 00:39:40 +09:00
mattn 701c734c91 Check text_edits is null (#697)
* Check text_edits is null

Some Language Server return null

* Add test for textEdit is null

* Check additionalTextEdits is null
2020-02-01 14:17:01 +09:00
Damien Radtke e566dcd160 Use "P" instead of "p" to insert text (#550)
* Use "P" instead of "p" to insert text
* Update replace command and add test case
2019-11-18 15:42:17 +01:00
Yasuhiro Matsumoto a20a0c1da8 Add test 2019-09-20 18:14:07 +09:00
Yasuhiro Matsumoto 3a6def04b9 Add test 2019-09-09 14:29:17 +09:00
Thomas Faingnaert ed304dbb8a Fix LspDocumentFormat not working as expected (#410)
* Add test

* Fix LspDocumentFormat adding newlines

* Fix manually pressing enter when formatting
2019-07-11 13:41:15 -07:00
mikoto2000 75516719d5 Fix lsp#utils#text_edit#apply_text_edits when end position was newline character. (#388) 2019-06-15 11:08:48 -07:00
Thomas Faingnaert 21d51ffb83 Fix text edits not preserving v:completed_item (#389)
* 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
2019-05-25 12:01:24 -07:00
mikoto2000 900e8619be Fix text edit when insert empty new text (#384)
* 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`
2019-05-20 17:24:41 -07:00