The completion component has a separate branch for handling the
Escape key but it can use the `ignore_escape_key` helper added for
signature-help instead.
This should not cause a behavior change - it's just cleaning up the
completion component.
* feat(ui): deprecated completions
Mark deprecated completions using strike-through
(CROSSED_OUT modifier). The deprection information
is taken either from the `deprecated` field of the
completion item or from the completion tags.
The field seems to be the older way of passing
the deprecated information and it was already
marked as deprecated for Symbol. In completion
item the field is still valid but it seems that
the LSP is moving in the general direction of using
tags for this kind of information and as such
relying on tags as well seems reasonable and
future-proof.
Open a new document `test.rs` and type the following:
`di//<esc><C-c>`
The margin calculation pushes the range out of bounds for the comment
marker when there are no characters (newline) after it.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
Char range out of bounds: char range 0..3,
Rope/RopeSlice char length 2', ropey-1.6.0/src/rope.rs:546:37
The debug build catches the error in the transaction: thread 'main'
panicked at 'attempt to subtract with overflow',
helix-core/src/transaction.rs:503:26
So far LSP always required that `PositionEncoding.characters` is an
UTF-16 offset. Now that LSP 3.17 is available in `lsp-types` request
the server to send char offsets (UTF-32) or byte offsets (UTF-8)
instead. For compatability with old servers, UTF-16 remains as the
fallback as required by the standard.
* Make `m` textobject look for pairs enclosing selections
Right now, this textobject only looks for pairs that surround the
cursor. This ensures that the pair found encloses each selection, which
is likely to be intuitively what is expected of this textobject.
* Simplification of match code
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Adjust logic for ensuring surround range encloses selection
Prior, it was missing the case where the start of the selection came
before the opening brace. We also had an off-by-one error where if the
end of the selection was on the closing brace it would not work.
* Refactor to search for the open pair specifically to avoid edge cases
* Adjust wording of autoinfo to reflect new functionality
* Implement tests for surround functionality in new integration style
* Fix handling of skip values
* Fix out of bounds error
* Add `ma` version of tests
* Fix formatting of tests
* Reduce indentation levels for readability, and update comments
* Preserve each selection's direction with enclosing pair surround
* Add test case for multiple cursors resulting in overlap
* Mark known failures as TODO
* Make tests multi-threaded or they fail
* Cargo fmt
* Fix typos in integration test comments
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Example:
```
test
testitem
```
Select line 2 with x, then type Alt-C; Helix will go into an infinite
loop. The saturating_sub keeps the head_row and anchor_row pinned at 0,
and a selection is never made since the first line is too short.
* properly handle LSP position encoding
* add debug assertion to Transaction::change
* Apply suggestions from code review
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
`:write` and other file-saving commands now check the file modification
time before writing to protect against overwriting external changes.
Co-authored-by: Gustavo Noronha Silva <gustavo@noronha.dev.br>
Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
The loop always iterates the number of times the user specified even
if the beginning/end of the document is reached.
For an extreme demonstration try the following commands, Helix will
hang for several seconds.
100000000w
100000000]c
This matches the behavior from 42ad1a9e04
but for the first and last change. The selection rules are the same
as for goto_next/prev_change: additions and modifications select the
added and modified range while deletions are represented with a point.