Commit graph

4020 commits

Author SHA1 Message Date
PORTALSURFER
a449192ee9
Added 2 new themes (#4367) 2022-10-21 17:35:02 -05:00
Sora
664064b3cc
Add textobjects.scm for zig (#4409) 2022-10-21 17:32:29 -05:00
Christian Speich
79ef39ab3a syntax: Don't force lower-case for filenames (#4346)
Just like for grammars we currently force a lower-case of the name for
some actions (like filesystem lookup). To make this consistent and less
surprising for users, we remove this lower-casing here.

Note: it is still the preferred way to name both language and grammar in
lower-case

Signed-off-by: Christian Speich <cspeich@emlix.com>
2022-10-21 08:11:25 -05:00
Christian Speich
4b85aeb2b6 grammar: Don't require lower-case (#4346)
Currently we always lower-case the grammar name when loading it. While it
is somewhat of an convention to name tree-sitter grammars in lowercase
there is no rule to enforce it.

This patch removes the lower-casing to allow all possible grammar names.

Signed-off-by: Christian Speich <cspeich@emlix.com>
2022-10-21 08:11:25 -05:00
Alexis (Poliorcetics) Bourget
34389e1d54 nit: Do less allocations in ui::menu::Item::label implementations
This complicates the code a little but it often divides by two the number of allocations done by
the functions. LSP labels especially can easily be called dozens of time in a single menu popup,
when listing references for example.
2022-10-21 07:42:33 -05:00
Alexis (Poliorcetics) Bourget
3aea33a415 nit: move an allocation to happen after a continue, making sure it's
not done for nothing
2022-10-21 07:42:33 -05:00
Skyler Hawthorne
5a848344a9
fix: write-all crash (#4384)
When we do auto formatting, the code that takes the LSP's response and applies
the changes to the document are just getting the currently focused view and
giving that to the function, basically always assuming that the document that
we're applying the change to is in focus, and not in a background view.

This is usually fine for a single view, even if it's a buffer in the
background, because it's still the same view and the selection will get updated
accordingly for when you switch back to it. But it's obviously a problem for
when there are multiple views, because if you don't have the target document in
focus, it will ask the document to update the wrong view, hence the crash.

The problem with this is picking which view to apply any selection change to.
In the absence of any more data points on the views themselves, we simply pick
the first view associated with the document we are saving.
2022-10-21 16:43:22 +09:00
Nimrod
bad49ef2d0
Fix unexpected behavior in delete_word_backward and delete_word_forward (#4392) 2022-10-21 15:08:37 +09: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
Blaž Hrastnik
74a6a2282e
Add undercurl styles to the default theme 2022-10-21 13:27:05 +09:00
Blaž Hrastnik
511d9d8a52
cargo fmt 2022-10-21 13:26:22 +09:00
Charlie Groves
7e29ee6dae
Autosave all when the terminal loses focus (#3178)
* Autosave all when the terminal loses focus

* Correct comment on focus config

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* Need a block_try_flush_writes in all quit_all paths

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-10-21 10:35:02 +09:00
A-Walrus
4ff5feeb0c
Fix shellwords delimiter handling (#4098)
* Fix shellwords delimiter handling

This allows commands such as `:set statusline.center ["file-type"]` to
work. Before the quotes within the list would mess it up.
Also added a test to ensure correct behavior

* Rename Delimiter -> OnWhitespace
2022-10-21 10:06:57 +09:00
Pascal Kuthe
9af7c1c9f3 Sort by fixed diagnostics/is_preffered within codeaction categories 2022-10-21 10:03:00 +09:00
Pascal Kuthe
189aa0bfcf never sort menu items when no fuzzy matching is possible 2022-10-21 10:03:00 +09:00
Pascal Kuthe
dc3527f52d use permalink to vscode repo 2022-10-21 10:03:00 +09:00
Pascal Kuthe
8d8b5d6624 use stable sort instead of allocating new vectors 2022-10-21 10:03:00 +09:00
Pascal Kuthe
c70d762a7b sort autocompletins by fuzzy match 2022-10-21 10:03:00 +09:00
Pascal Kuthe
8673c1ec0c sort codeaction by their kind instead of alphabetically 2022-10-21 10:03:00 +09:00
Kirawi
ce399471f0
simplify encoding test macro (#4385) 2022-10-21 09:58:13 +09:00
Greg Troszak
fbf8078611
Clarify use of HELIX_RUNTIME (#4382) 2022-10-20 19:39:30 -05:00
Skyler Hawthorne
6a0b450f55
Fix multi byte auto pairs (#4024)
* Fix test::print for Unicode

The print function was not generating correct translations when
the input has Unicode (non-ASCII) in it. This is due to its use of
String::len, which gives the length in bytes, not chars.

* Fix multi-code point auto pairs

The current code for auto pairs is counting offsets by summing the
length of the open and closing chars with char::len_utf8. Unfortunately,
this gives back bytes, and the offset needs to be in chars.

Additionally, it was discovered that there was a preexisting bug where
the selection was not computed correctly in the case that the cursor
was:

1. a single grapheme in width
2. this grapheme was more than one char
3. the direction of the cursor is backwards
4. a secondary range

In this case, the offset was not being added into the anchor. This was
fixed.

* migrate auto pairs tests to integration

* review comments
2022-10-21 09:22:20 +09:00
Matouš Dzivjak
e25af1f744
feat(view): re-use align_view function (#4390) 2022-10-20 18:53:05 -05:00
Michael Davis
66238e8556 Silence dead_code warning on AppBuilder::with_config
This function is not currently used but is likely to be useful in
the future, so this change silences the dead_code warning.
2022-10-21 08:43:15 +09:00
Michael Davis
313579d27c Remove language-server configuration in integration tests
This change removes language server configuration from the default
languages.toml config for integration tests. No integration-tests
currently depend on the availability of a language server but if any
future test needs to, it may provide a language server configuration
by passing an override into the `test_syntax_conf` helper.

Language-servers in integration tests cause false-positive failures
when running integration tests in GitHub Actions CI. The Windows
runner appears to have `clangd` installed and all OS runners have
the `R` binary installed but not the `R` language server package.
If a test file created by `tempfile::NamedTempFile` happens to have a
file extension of `r`, the test will most likely fail because the
R language server will fail to start and will become a broken pipe,
meaning that it will fail to shutdown within the timeout, causing a
false-positive failure. This happens surprisingly often in practice.

Language servers (especially rust-analyzer) also emit unnecessary
log output when initializing, which this change silences.
2022-10-21 08:43:15 +09:00
Michael Davis
1243db11a5 Use helix_view::apply_transaction in integration-tests
`helix_view::apply_transaction` closes over `Document::apply` and
`View::apply` to ensure that jumplist entries are updated when a
document changes from a transaction. `Document::apply` shouldn't
be called directly - this helper function should be used instead.
2022-10-21 08:43:15 +09:00
Matouš Dzivjak
4cff625054
chore(view): remove indent_unit helper fn (#4389) 2022-10-20 17:05:04 -05:00
Garrett D'Amore
36f97b6aad
Add support for D (#4372)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-10-20 16:54:17 -05:00
Jared Ramirez
de607830a2
Upgrade rescript tree sitter & highlights (#4356)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-10-20 16:30:16 -05:00
Matouš Dzivjak
eee8362015
fix(commands): no last picker error (#4387) 2022-10-20 15:50:54 -05:00
midnightexigent
d801a6693c
Allow using path suffixes to associate language file-types (#2455)
* feat(syntax): add strategy to associate file to language through pattern

File path will match if it ends with any of the file types provided in the config.
Also used this feature to add support for the .git/config and .ssh/config files

* Add /etc/ssh/ssh_config to languages.toml

* cargo xtask docgen

* Update languages.md

* Update languages.md

* Update book/src/languages.md

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* Update book/src/languages.md

Co-authored-by: Ivan Tham <pickfire@riseup.net>

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2022-10-20 23:13:56 +09:00
Blaž Hrastnik
78c0cdc519
Merge pull request #2267 from dead10ck/fix-write-fail
Write path fixes
2022-10-20 23:11:22 +09:00
Alex
8c9bb23650
Update windows install instructions (#4351) 2022-10-19 17:19:03 -05:00
Fisher Darling
4174b25b3d
Pretty print tree-sitter-subtree expression (#4295) 2022-10-19 17:17:50 -05:00
Sukera
a7e7c2cc05
Add roots for julia to languages.toml (#4361) 2022-10-19 07:53:22 -05:00
Blaž Hrastnik
418a622db9
Merge pull request #4061 from pascalkuthe/undercurl-modifier
Support different kinds of underline rendering (updated)
2022-10-19 13:51:13 +09:00
Skyler Hawthorne
756253b43f fix tree_sitter_scopes 2022-10-19 00:01:00 -04:00
Skyler Hawthorne
9a406b569b reduce LSP timeout to 3s 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
759d55cc81 fail if doc save sender is closed 2022-10-18 22:31:39 -04:00
Skyler Hawthorne
e645804b0a Editor::flush_writes returns an error 2022-10-18 22:31:39 -04:00
Blaž Hrastnik
52ba550098 Use flush_writes in application.close() 2022-10-18 22:31:39 -04:00
Blaž Hrastnik
2a43ee0164 doc.close() now unused 2022-10-18 22:31:39 -04:00
Blaž Hrastnik
1b6f7319cd Wire up save_queue as a part of new_document rather than open 2022-10-18 22:31:39 -04:00
Blaž Hrastnik
55b50d9e83 Seems like this flush is unnecessary 2022-10-18 22:31:39 -04:00
Blaž Hrastnik
b155e861ad Use a write_count to determine how many writes left to flush 2022-10-18 22:31:39 -04:00
Blaž Hrastnik
b0212b3611 Deduplicate flush_writes 2022-10-18 22:31:39 -04:00
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