Commit graph

1731 commits

Author SHA1 Message Date
Blaž Hrastnik
30c93994b5 Use a single save_queue on the editor 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
beb3427bfb improve app close failure display 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
bf378e71b0 fix tests 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
31d1bbfddb review comments 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
3f07885b35 document should save even if formatter fails 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
b530a86d1f remove Callback::Compositor variant
To reduce likelihood of accidental discarding of important callbacks
2022-10-18 22:31:39 -04:00
Skyler Hawthorne
b3fc31a211 move language server refresh to document saved event handler 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
af03df3413 fix write scratch buffer to file 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
18c32118b1 Save text in document saved events, use in status message 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
f82a551b98 Rename doc save event names to past tense 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
57de4e6251 various fixes in write-all path 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
d544376590 reset idle timer for all events 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
e5fd5e2a9c fix panic when view of pending write is closed 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
8c667ef8de factor editor event handling into function 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
aaa1450678 fix write-quit with auto format
write-quit will now save all files successfully even when there is auto
formatting
2022-10-18 22:31:39 -04:00
Skyler Hawthorne
c9418582d2 fix modified status with auto format 2022-10-18 22:31:38 -04:00
Skyler Hawthorne
cb23399dee improve reliability of shutdown 2022-10-18 22:31:38 -04:00
Skyler Hawthorne
b8a07f7d15 add conditional noop render back
It makes it much slower without stubbing this out
2022-10-18 22:31:38 -04:00
Skyler Hawthorne
69c9e44ef2 update write-quit to wait for saves 2022-10-18 22:31:38 -04:00
Skyler Hawthorne
e1f7bdb1d2 fix buffer-close 2022-10-18 22:31:38 -04:00
Skyler Hawthorne
83b6042b97 fix(write): do not set new path on document until write succeeds
If a document is written with a new path, currently, in the event that
the write fails, the document still gets its path changed. This fixes
it so that the path is not updated unless the write succeeds.
2022-10-18 22:31:38 -04:00
Skyler Hawthorne
a5a93182cd fix: buffer-close ensuring writes
Make sure buffer-close waits for the document to finish its writes.
2022-10-18 22:31:38 -04:00
Skyler Hawthorne
d706194597 chore(write): serialize write operations within a Document
The way that document writes are handled are by submitting them to the
async job pool, which are all executed opportunistically out of order. It
was discovered that this can lead to write inconsistencies when there
are multiple writes to the same file in quick succession.

This seeks to fix this problem by removing document writes from the
general pool of jobs and into its own specialized event. Now when a
user submits a write with one of the write commands, a request is simply
queued up in a new mpsc channel that each Document makes to handle its own
writes. This way, if multiple writes are submitted on the same document,
they are executed in order, while still allowing concurrent writes for
different documents.
2022-10-18 22:31:38 -04:00
Jonathan LEI
1a772d1b67
Fix deleting word from end of buffer (#4328) 2022-10-18 19:53:58 -05:00
Roberto Vidal
1f74cf45d4
display tree sitter scopes in a popup (#4337) 2022-10-19 00:00:00 +05:30
Philipp Mildenberger
d17ffc47f0
Use the same WalkBuilder configuration for the global search file picker as the default file picker (#4334)
Skip searching .git in global search, similar to how file picker skips listing files in .git.
2022-10-18 22:58:16 +05:30
A-Walrus
8bbddf90ff Replace in_bounds with calculation of end_indent
Instead of repeatedly checking if it is in_bounds, calculate the
max_indent beforehand and just loop. I added a debug_assert to "prove"
that it never tries drawing out of bounds.
2022-10-18 00:38:16 +09:00
A-Walrus
1de02a147c Only draw indent guides within bounds
Better performance, and otherwise very long lines with lots of tabs
will wrap around the u16 and come back on the other side, messing up
the beginning skip_levels.
2022-10-18 00:38:16 +09:00
A-Walrus
2c36e33e0a Make skip_levels a u8 2022-10-18 00:38:16 +09:00
A-Walrus
3ba665d804 Fix rendering of lines longer than 2^16
Before things would be cast to u16 earlier than needed, which would
cause problems for insanely long lines (longer than 2^16 ~ 65 thousand)
2022-10-18 00:38:16 +09:00
Gokul Soumya
4e691d6247
Change diagnostic picker keybind to <space>d (#4229)
Also changes workspace diagnostic picker bindings to <space>D and
changes the debug menu keybind to <space>g, the previous diagnostic
picker keybind. This brings the diagnostic picker bindings more in
line with the jump to next/previous diagnostic bindings which are
currently on ]d and [d.
2022-10-17 16:45:42 +09:00
Michael Davis
5f4f171b73
Fix debug assertion for diagnostic sort order (#4319)
The debug assertion that document diagnostics are sorted incorrectly
panics for cases like `[161..164, 162..162]`. The merging behavior
in the following lines that relies on the assertion only needs the
input ranges to be sorted by `range.start`, so this change simplifies
the assertion to only catch violations of that assumption.
2022-10-17 01:22:04 +05:30
ZJPzjp
0e8e7cae3b
fix :insert-output doc: inserting output **before** each selection (#4286) 2022-10-15 11:07:42 -05:00
Poliorcetics
45e038f4d5
nit: remove a String allocation that is immediately used as an &str (#4277) 2022-10-14 17:35:00 -05:00
Nathaniel Graham
e80beaa7b0
Changed Selection Yank Message (#4275)
Co-authored-by: Nathaniel Graham <ngraham@protonmail.com>
2022-10-14 12:51:15 -05:00
Michael Davis
e16c632760
Apply transactions to the jumplist for undo/redo (#4227)
Undo/redo/earlier/later call `Document::apply_impl` which applies
transactions to the document. These transactions also need to be
applied to the view as in 0aedef0.
2022-10-13 00:57:40 +09:00
Armin Ronacher
7f75458e6f
Fix some commands not showing names in palette (#4223) 2022-10-12 09:02:10 -05:00
Graic
68909dcef4
Fix append cursor location when selection anchor is at end of document (#4147) 2022-10-12 08:34:35 -05:00
Brian Orwe
f4d96b2ca3
Fix confusion with using --hsplit --vsplit on startup at same time (#4202) 2022-10-11 09:25:42 -04:00
Alexis (Poliorcetics) Bourget
b58899bc8e fix: remove unneeded allocations when calling helix_view::Info::new 2022-10-11 15:47:11 +09:00
Michael Davis
65febe0cf4
Overlay all diagnostics with highest severity on top (#4113)
Here we separate the diagnostics by severity and then overlay the Vec
of spans for each severity on top of the highlights. The error
diagnostics end up overlaid on the warning diagnostics, which are
overlaid on the hints, overlaid on info, overlaid on any other severity
(default), then overlaid on the syntax highlights.

This fixes two things:

* Error diagnostics are now always visible when overlapped with other
  diagnostics.
* Ghost text is eliminated.
    * Ghost text was caused by duplicate diagnostics at the EOF:
      overlaps within the merged `Vec<(usize, Range<usize>)>` violate
      assumptions in `helix_core::syntax::Merge`.
    * When we push a new range, we check it against the last range and
      merge the two if they overlap. This is safe because they both
      have the same severity and therefore highlight.

The actual merge is skipped for any of these when they are empty, so
this is very fast in practice. For some data, I threw together an FPS
counter which renders as fast as possible and logs the renders per
second.

With no diagnostics, I see an FPS gain from this change from 868 FPS
to 878 (+1.1%) on a release build on a Rust file. On an Erlang file
with 12 error diagnostics and 6 warnings in view (233 errors and 66
warnings total), I see a decrease in average FPS from 795 to 790
(-0.6%) on a release build.
2022-10-11 15:46:47 +09:00
Pascal Kuthe
1a87cbd508 remove filterting with C-space from picker 2022-10-11 12:25:28 +09:00
Pascal Kuthe
7af599e0af Treat space as a seperator instead of a character in fuzzy picker 2022-10-11 12:25:28 +09:00
Michael Davis
c388e16e09 Add a helper function for applying transactions
It is easy to forget to call `Document::apply` and/or `View::apply` in
the correct order. This commit introduces a helper function which
closes over both calls.
2022-10-11 12:17:32 +09:00
Michael Davis
0aedef0333 Apply transactions to Views
This change adds View::apply calls for all Document::apply call-sites,
ensuring that changes to a document do not leave invalid entries in
the View's jumplist.
2022-10-11 12:17:32 +09:00
Blaž Hrastnik
a85e386298
picker: Highlight the document on idle timeout 2022-10-11 09:53:55 +09:00
Gokul Soumya
001858b11f
Propagate idle timeout event to components (#3172) 2022-10-11 09:10:01 +09:00
A-Walrus
c15f1ea274
Add cursorcolumn (#4084)
* Implement cursorcolumn

* Add documentation

* Separate column style from line with fallback

* Fallback to cursorcolumn first

* Switch to non-fallback try_get_exact

Add new function `try_get_exact`, which doesn't perform fallback,
and use that instead because the fallback behaviour is being handled
manually.
2022-10-09 03:28:42 +09:00
A-Walrus
c927d61791
Fix bugs in search wraparound message (#4101) 2022-10-04 16:49:43 -05:00
dependabot[bot]
7c33b9c76d
build(deps): bump smallvec from 1.9.0 to 1.10.0 (#4093)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-03 18:38:24 -05:00