Commit Graph

1941 Commits (25d4ebe30d7920bc087f004075048f62f53726af)

Author SHA1 Message Date
Pascal Kuthe 25d4ebe30d don't move cursor while forward deleting in append mode
Currently, when forward deleting (`delete_char_forward` bound to `del`,
`delete_word_forward`, `kill_to_line_end`) the cursor is moved to the
left in append mode (or generally when the cursor is at the end of the
selection). For example in a document `|abc|def`  (|indicates selection)
if enter append mode the cursor is moved to `c` and the selection
becomes: `|abcd|ef`. When deleting forward (`del`) `d` is deleted. The
expectation would be that the selection doesn't shrink so that `del`
again deletes `e` and then `f`. This would look as follows:

`|abcd|ef`
`|abce|f`
`|abcf|`
`|abc |`

This is inline with how other editors like kakoune work.
However, helix currently moves the selection backwards leading to the
following behavior:

`|abcd|ef`
`|abc|ef`
`|ab|ef`
`ef`

This means that `delete_char_forward` essentially acts like
`delete_char_backward` after deleting the first character in append
mode.

To fix the problem the cursor must be moved to the right while deleting
forward (first fix in this commit). Furthermore, when the EOF char is
reached a newline char must be inserted (just like when entering
appendmode) to prevent the cursor from moving to the right
2 years ago
Pascal Kuthe 2c3ccc3e8b cleanup delete_by_selection_insert_mode function 2 years ago
Pascal Kuthe f8225ed921 fix panic when deleting overlapping ranges
Some deletion operations (especially those that use indentation)
can generate overlapping deletion ranges when using multiple cursors.
To fix that problem a new `Transaction::delete` and
`Transaction:delete_by_selection` function were added. These functions
merge overlapping deletion ranges instead of generating an invalid
transaction. This merging of changes is only possible for deletions
and not for other changes and therefore require its own function.

The function has been used in all commands that currently delete
text by using `Transaction::change_by_selection`.
2 years ago
Pascal Kuthe 6842fd4c36 clarify comments about completion savepoints
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
Pascal Kuthe 28b730381c only resolve completion items once 2 years ago
Pascal Kuthe 9c558fc470 ensure correct trigger/start completion offset
When re requesting a completion that already has a selected item we
reuse that selections savepoint. However, the selection has likely
changed since that savepoint which requires us to use the selection
from that savepoint
2 years ago
Pascal Kuthe 30ff7f8db2 resolve completions before applying transactions 2 years ago
Pascal Kuthe 5406e9f629 correctly handle completion rerequest 2 years ago
A-Walrus d5fe08ddb8
Replace DAP vars popup, instead of adding new (#7034) 2 years ago
ZJPzjp 3b8c15618f
Fix warnings from clippy (#7013)
* Fix warnings from clippy

* revert MAIN_SEPARATOR_STR
2 years ago
Kitsu 92c328c088
Add wbc and wbc! commands (#6947) 2 years ago
Alexis-Lapierre b0b3f45b80
Conserve BOM and properly support UTF16 (#6497) 2 years ago
Evgeniy Tatarkin 6a1bb81f10
Sort the buffer picker by most recent access (#2980) 2 years ago
Timothy DeHerrera 9c6c63a2be
inject language based on file extension & shebang (#3970)
* inject language based on file extension

Nodes can now be captured with "injection.filename". If this capture
contains a valid file extension known to Helix, then the content will
be highlighted as that language.

* inject language by shebang

Nodes can now be captured with "injection.shebang". If this capture
contains a valid shebang line known to Helix, then the content will
be highlighted as the language the shebang calls for.

* add documentation for language injection

* nix: fix highlights

The `@` is now highlighted properly on either side of the function arg.

Also, extending the phases with `buildPhase = prev.buildPhase + ''''`
is now highlighted properly.

Fix highlighting of `''$` style escapes (requires tree-sitter-nix bump)

Fix `inherit` highlighting.

* simplify injection_for_match

Split out injection pair logic into its own method to make the overall
flow easier to follow.

Also transform the top-level function into a method on a
HighlightConfiguration.

* markdown: add shebang injection query
2 years ago
jorge 204d1eba4b
feat(commands): add clear-register typable command (#5695)
Co-authored-by: Jorge <chorcheus@tutanota.com>
2 years ago
Vitalii Solodilov 2836ea2ac4
feat: add a config option to exclude declaration from LSP references (#6886)
* feat: added the config option to exclude declaration from reference query

Fixes: #5344

* fix: review

* fix: review
2 years ago
Pascal Kuthe 8f1671eaaa
fix panic in inlay hint computation when view anchor is out of bounds (#6883) 2 years ago
Dimitri Sabadie 096ed0ced4
Add extend_to_first_nonwhitespace (#6837)
Closes #6836
2 years ago
Atticus Sebastiani 228a4af35f
make `:u` alias `:update` (#6835)
* Gave the command update the alias u

* Re added trailing newline

* generated docs
2 years ago
Michael Davis ee7413a3fd
tui: Allow toggling mouse capture at runtime (#6675)
This picks up changes to the `editor.mouse` option at runtime - either
through `:set-option` or `:config-reload`. When the value changes, we
tell the terminal to enable or disable mouse capture sequences.
2 years ago
Pascal Kuthe c3e2db77f7
flip symbol range in LSP goto commands (#6794) 2 years ago
shem 1b016a89d5
Fix crash on opening from suspend state (#6764)
* Fix crash on opening from suspend state (#6725)

* Fix code style

* revert using of the imperative code style. Add panic if couldn't set terminal raw mode

* remove redundant import of core::panic macros

* small refactoring
2 years ago
Aleksey Kuznetsov 7706ff77eb
make :toggle-option print the new value (#6774)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
shem 9f680c69f4
Fix #6669: Theme preview doesn't return theme to normal (#6694)
* Fix #6669: Theme preview doesn't return theme to normal when delete name with Alt-Backspace

* Fix #6669: Return theme preview to normal theme for all remaining keybinds that change the promt text
2 years ago
EsfoNL 2f82bc13e8
Fix crash on opening jumplist (#6672)
Co-authored-by: Esra Fokker <esra.fokker@finalist.nl>
2 years ago
Konstantin Keller f8b7e95481
LSP: Gracefully handle 'workspace/configuration' from a stopped server (#6693) 2 years ago
Daniel Sedlak e856906f76
Fix typos (#6643) 2 years ago
Dmitry Ulyanov dd6e0cce3b
Fix line number display for LSP goto pickers (#6559)
Line numbers are 0-indexed in the LSP spec but 1-indexed for display
and jumping purposes in Helix.
2 years ago
Casper Rogild Storm 9420ba7484
Let..else refactor (#6562) 2 years ago
Pascal Kuthe 1073dd6329
robustly handle invalid LSP ranges (#6512) 2 years ago
Pascal Kuthe 9fe3adcff9
add option to enable/disable lsp snippets 2 years ago
Pascal Kuthe 7a69c40524
Hide signature help if it overlays completion menu (#5523) 2 years ago
Pascal Kuthe ab819d80f1
Correctly reload theme on :config-reload
The current implementation didn't reload the theme if no no theme was
explicitly configured (so the default theme was used). This commit
brings `refresh_theme` in line with the initialization code.
2 years ago
mWalrus e72be52996
Truncate paths in the file picker (#6410) 2 years ago
Pascal Kuthe 5b3dd6a678 implement proper lsp-workspace support
fix typo

Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
2 years ago
Pascal Kuthe 2d10a429eb add workspace config and manual LSP root management
fixup documentation

Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>

fixup typo

Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
2 years ago
Filip Dutescu d59b80514e
feat(debug): highlight current line (#5957)
Add new theme highlight keys, for setting the colour of the breakpoint
character and the current line at which execution has been paused at.
The two new keys are `ui.highlight.frameline` and `ui.debug.breakpoint`.
Highlight according to those keys, both the line at which debugging
is paused at and the breakpoint indicator.

Add an indicator for the current line at which execution is paused
at, themed by the `ui.debug.active` theme scope. Update various themes
to showcase how the new functionality works.

Better icons are dependent on #2869, and as such will be handled in the
future, once it lands.

Closes: #5952

Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
2 years ago
Philipp Mildenberger 198ff2c3f9
Fix clippy lints (#6454) 2 years ago
Pascal Kuthe 9fac574178 do not ignore mouse scrolling when on top of virtual text 2 years ago
Pascal Kuthe 15e751b9a2 make scrolloff calculation consistent
While scrolling (with the `scroll`) command scrolloff was calculated
slightly differently than in `ensure_cursor_in_view` which could cause
the cursor to get stuck while scrolling
2 years ago
Pascal Kuthe d6c8e0c946 allow scrolling past virtual text line
Virtual text lines (either caused by softwrapped inlay hints that take
multiple or line annotations) currently block scrolling downwards.

if the visual offset passed to char_idx_at_visual_offset or
visual_offset_from_block is within a virtual text line then the char
position before the virtual text and a visual offset are returned.
We previously ignored that visual offset and as a result the cursor
would be stuck at the start of the virtual text. This commit fixes
that by simply moving the cursor to the next char (so past the virtual
text) if this visual offset is non-zero
2 years ago
Pascal Kuthe 0ab96cc257 remove incorrect assert
This assert was added during early development of #5420 and makes no
sense with the current code. We simply forgot to remove it.
2 years ago
Francesc Elies 05ee673197
Show diagnostic codes for LSP diagnostics (#6378)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
sarah 28632c6cee
Run shell commands asynchronously (#6373) 2 years ago
exp80 770496511c
Fix highlighting in picker with multiple columns (#6333) 2 years ago
Pascal Kuthe b6a4927f00 discard outdated workspace edits recived from the LS 2 years ago
Pascal Kuthe 3c9d5d0215 discard outdated diagnostics recived by the LS 2 years ago
Thomas Schollenberger 2a27d1b505
Prevent whitespace from rendering inside inlay hints (#6312)
* fix spaces and nbsps showing in inlay hints

* remove origin

* virtual tab + fix unneeded clone

* update virtual tab determining location

* fix clippy lint
2 years ago
Blaž Hrastnik 75ebc1fcbc
fix compilation 2 years ago
Kyle Smith 27aa919f1c
Only complete appropriate arguments for typed commands. (#5966) 2 years ago