Commit graph

1937 commits

Author SHA1 Message Date
Filip Dutescu
44729fbaf9
fix(dap): validate key and index exist when requesting vars (#5628)
Check if the stack frames contain the thread id and the frame before
trying to get the frame id. If case any of the two fails to be
found, provide the user with messages to inform them of the issue and
gracefully return.

Closes: #5625

Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
2023-02-20 13:00:44 +09:00
Filip Dutescu
e3765ac6d2
feat(dap): send Disconnect if Terminated event received (#5532)
Send a `Disconnect` DAP request if the `Terminated` event is received.
According to the specification, if the debugging session was started by
as `launch`, the debuggee should be terminated alongside the session. If
instead the session was started as `attach`, it should not be disposed of.

This default behaviour can be overriden if the `supportTerminateDebuggee`
capability is supported by the adapter, through the `Disconnect` request
`terminateDebuggee` argument, as described in
[the specification][discon-spec].

This also implies saving the starting command for a debug sessions, in
order to decide which behaviour should be used, as well as validating the
capabilities of the adapter, in order to decide what the disconnect should
do.

An additional change made is handling of the `Exited` event, showing a
message if the exit code is different than `0`, for the user to be aware
off the termination failure.

[discon-spec]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect

Closes: #4674

Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
2023-02-20 13:00:00 +09:00
Guillaume
78a1e2db60
feat: show current language when no argument is provided (#5895) 2023-02-16 23:48:35 +09:00
Triton171
a1a6d5f334
Replace incorrect usages of tab_width with indent_width. (#5918) 2023-02-16 23:47:59 +09:00
Erasin
b7fb52d0e4
fix: decode lsp url for workspace_diagnostics_picker (#6016) 2023-02-16 23:33:54 +09:00
Jonathan LEI
9368ac76b3
Ignore invalid file URIs from LSP (#6000) 2023-02-16 14:17:18 +09:00
Pascal Kuthe
c332b16855
ignore case while filtering completions (#6008) 2023-02-16 10:16:51 +09:00
Michael Davis
d8526a752c
Use Popup::ignore_escape_key helper for completion (#6006)
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.
2023-02-16 10:15:25 +09:00
Pascal Kuthe
715c4b24d9
Fix crash in goto_window_center at EOF (#5987) 2023-02-14 13:00:54 -06:00
Matouš Dzivjak
2bebc5042e
feat(ui): deprecated completions (#5932)
* 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.
2023-02-13 11:44:31 +09:00
A-Walrus
8b09b00942
Add :toggle-option command (#4085)
This command toggles the value of boolean options
2023-02-13 11:40:31 +09:00
Gokul Soumya
425315d752 Fix completion doc popup area calculation logic
Earlier the doc popup would draw over the compeltion popup
itself and sometimes over the cursor too.
2023-02-11 16:05:23 +09:00
Gokul Soumya
1562b5ce67 Create popup rect instead of using raw values 2023-02-11 16:05:23 +09:00
Gokul Soumya
0f844ef191 Refactor our Markdown construction in completion doc 2023-02-11 16:05:23 +09:00
Gokul Soumya
937825e8fc Rename completion doc popup area variables 2023-02-11 16:05:23 +09:00
Gokul Soumya
8e9c329952 Use early return in rendering completion doc 2023-02-11 16:05:23 +09:00
Pascal Kuthe
93c7afc4ed
Negotiate LSP Position Encoding (#5894)
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.
2023-02-11 15:50:01 +09:00
Daniel S Poulin
6929a12f29
Make m textobject look for pairs enclosing selections (#3344)
* 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>
2023-02-10 13:52:57 -06:00
lesleyrs
af1157f37c
Add exit code to command failed msg (#5898) 2023-02-10 11:56:56 -06:00
Colton Clemmer
ea3293b4da
Split modification indicator from file statusline elements (#4731) 2023-02-10 11:34:18 -06:00
Pascal Kuthe
8a3ec443f1
Fix new clippy lints (#5892) 2023-02-09 16:27:08 -06:00
Mike Trinkala
9d73a0d112
Fix the infinite loop when copying the cursor to the top of the file (#5888)
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.
2023-02-09 23:28:33 +09:00
Blaž Hrastnik
8a602995fa
Address new clippy lints 2023-02-09 11:44:14 +09:00
Pascal Kuthe
e474779c87
bump msrv to 1.63 (#5570)
* bump msrv to 1.63

* resolve new complex type clippy lints
2023-02-09 11:24:31 +09:00
Clément Delafargue
f386ff795d
Check for external file modifications when writing (#5805)
`: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>
2023-02-08 10:09:19 -06:00
Michael Davis
23ed8c12f1
Select change range for goto_first/last_change commands (#5206)
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.
2023-02-07 12:43:48 +09:00
Skyler Hawthorne
b2e83f81e1
enable rendering in integration tests (#5819)
This will allow testing more of the code base, as well as enable UI-
specific testing.

Debug mode builds are prohibitively slow for the tests, mostly
because of the concurrency write tests. So there is now a profile for
integration tests that sets the optimization level to 2 for a few helix
crates, and lowers the number of rounds of concurrent writes to 1000.
2023-02-04 13:20:23 -08:00
William Etheredge
f7bd7b5eaf
Add :character-info command (#4000) 2023-02-03 08:24:46 -06:00
Pascal Kuthe
350535208f
always commit to history when pasting (#5790) 2023-02-02 14:56:52 -05:00
Skyler Hawthorne
a5233cf5ad disable lsp in integration tests 2023-02-02 14:53:18 -05:00
Filipe Azevedo
8ba0a46274
add picker: current view dir (#4666) 2023-02-02 14:51:11 -05:00
Dylan Bulfin
61e1e6160a
Removing C-j and C-k from completion menu navigation (#5070) 2023-02-02 14:49:17 -05:00
Pascal Kuthe
f0c2e898b4
add substring matching options to picker (#5114) 2023-02-02 14:48:16 -05:00
Gokul Soumya
e31943c4c4
Tabulate buffer picker contents (#5777) 2023-02-02 14:32:05 -05:00
Pascal Kuthe
2949bb018c
fix position translation at EOF with softwrap (#5786) 2023-02-02 13:04:41 -05:00
Pascal Kuthe
6ed2348078
Hide duplicate symlinks from the picker (#5658)
* hide duplicate symlinks from the picker

* Apply suggestions from code review

Co-authored-by: g-re-g <123515925+g-re-g@users.noreply.github.com>

* minor stylistic fix

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

---------

Co-authored-by: g-re-g <123515925+g-re-g@users.noreply.github.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-02-02 11:14:02 -06:00
Michael Davis
685cd383a3
Surround with line-endings on ms<ret> (#4571)
This change makes `ms<ret>` work similarly to `t<ret>` and related
find commands: when the next event is a keypress of Enter, surround
the selection with the document's line-endings.
2023-02-01 16:29:48 -05:00
Pascal Kuthe
4dcf1fe66b
rework positioning/rendering and enable softwrap/virtual text (#5420)
* rework positioning/rendering, enables softwrap/virtual text

This commit is a large rework of the core text positioning and
rendering code in helix to remove the assumption that on-screen
columns/lines correspond to text columns/lines.

A generic `DocFormatter` is introduced that positions graphemes on
and is used both for rendering and for movements/scrolling.
Both virtual text support (inline, grapheme overlay and multi-line)
and a capable softwrap implementation is included.

fix picker highlight

cleanup doc formatter, use word bondaries for wrapping

make visual vertical movement a seperate commnad

estimate line gutter width to improve performance

cache cursor position

cleanup and optimize doc formatter

cleanup documentation

fix typos

Co-authored-by: Daniel Hines <d4hines@gmail.com>

update documentation

fix panic in last_visual_line funciton

improve soft-wrap documentation

add extend_visual_line_up/down commands

fix non-visual vertical movement

streamline virtual text highlighting, add softwrap indicator

fix cursor position if softwrap is disabled

improve documentation of text_annotations module

avoid crashes if view anchor is out of bounds

fix: consider horizontal offset when traslation char_idx -> vpos

improve default configuration

fix: mixed up horizontal and vertical offset

reset view position after config reload

apply suggestions from review

disabled softwrap for very small screens to avoid endless spin

fix wrap_indicator setting

fix bar cursor disappearring on the EOF character

add keybinding for linewise vertical movement

fix: inconsistent gutter highlights

improve virtual text API

make scope idx lookup more ergonomic

allow overlapping overlays

correctly track char_pos for virtual text

adjust configuration

deprecate old position fucntions

fix infinite loop in highlight lookup

fix gutter style

fix formatting

document max-line-width interaction with softwrap

change wrap-indicator example to use empty string

fix: rare panic when view is in invalid state (bis)

* Apply suggestions from code review

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* improve documentation for positoning functions

* simplify tests

* fix documentation of Grapheme::width

* Apply suggestions from code review

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* add explicit drop invocation

* Add explicit MoveFn type alias

* add docuntation to Editor::cursor_cache

* fix a few typos

* explain use of allow(deprecated)

* make gj and gk extend in select mode

* remove unneded debug and TODO

* mark tab_width_at #[inline]

* add fast-path to move_vertically_visual in case softwrap is disabled

* rename first_line to first_visual_line

* simplify duplicate if/else

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-02-01 02:03:19 +09:00
Ole Krüger
4eca4b3079
Support goto-declaration LSP command (#5646) 2023-01-31 05:38:53 -05:00
dependabot[bot]
75eeda69e7
build(deps): bump indoc from 1.0.8 to 2.0.0 (#5742)
Bumps [indoc](https://github.com/dtolnay/indoc) from 1.0.8 to 2.0.0.
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/1.0.8...2.0.0)

---
updated-dependencies:
- dependency-name: indoc
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-30 17:47:30 -06:00
alice
8b25f44f05
build(deps): bump toml from 0.6.0 to 0.7.0 (#5726) 2023-01-30 08:49:26 -06:00
Jonathan LEI
86ae81ec5d
Use filename completer on run-shell-command (#5729) 2023-01-30 08:48:27 -06:00
Miguel Madrid-Mencía
d2d3024337
Fix clippy 1.67 warnings (#5697) 2023-01-27 09:43:46 -06:00
ds-cbo
67a287dd81
keymap: Test backslash escaping in commands 2023-01-25 09:31:58 -06:00
Pascal Kuthe
e83ce72240 refactor: don't deserialize &str from toml
The new version of the `toml` crate is based on `toml_edit` and does
not support zero copy deserialization anymore. So we need to deserialize
`String` instead of `&str` in the keympa
2023-01-24 12:50:46 -06:00
dependabot[bot]
52d854fa62 build(deps): bump toml from 0.5.10 to 0.6.0
Bumps [toml](https://github.com/toml-rs/toml) from 0.5.10 to 0.6.0.
- [Release notes](https://github.com/toml-rs/toml/releases)
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.5.10...toml-v0.6.0)

---
updated-dependencies:
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-24 12:50:46 -06:00
dependabot[bot]
64ec0256d3
build(deps): bump which from 4.3.0 to 4.4.0 (#5655)
Bumps [which](https://github.com/harryfei/which-rs) from 4.3.0 to 4.4.0.
- [Release notes](https://github.com/harryfei/which-rs/releases)
- [Commits](https://github.com/harryfei/which-rs/compare/4.3.0...4.4.0)

---
updated-dependencies:
- dependency-name: which
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 17:25:49 -06:00
Pascal Kuthe
361a834486
Fix selecting a changed file in global search (#5639) 2023-01-23 11:18:44 -06:00
Ivan Tham
a20a96abdc
Remove apply_transaction helper (#5598) 2023-01-21 12:13:43 -06:00
Pascal Kuthe
0e5159ceca
Fix panic for noop selecting join (#5579) 2023-01-18 15:28:47 -06:00