Commit graph

13 commits

Author SHA1 Message Date
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
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
Skyler Hawthorne
f486f34ebe
flush writes on force quit (#4397)
When force quitting, we need to block on the pending writes to ensure
that write commands succeed before exiting, and also to avoid a crash
when all the views are gone before the auto format call returns from
the LS.
2022-10-21 13:28:29 +09:00
Skyler Hawthorne
3f07885b35 document should save even if formatter fails 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
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
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
Skyler Hawthorne
5f7c247430 replace phrase in tests 2022-06-19 00:00:31 -04:00
Skyler Hawthorne
665286c199 factor new Application with file arg to function 2022-06-19 00:00:31 -04:00
Skyler Hawthorne
fac36bc5ea add test for write-quit happy path 2022-06-18 23:57:47 -04:00
Skyler Hawthorne
374724f5ac ignore failing write path tests until fixes are merged 2022-06-18 23:57:47 -04:00
Skyler Hawthorne
8d8d389536 rename top level module to satisfy cargo fmt 2022-06-18 23:57:47 -04:00
Renamed from helix-term/tests/integration/write.rs (Browse further)