Commit Graph

734 Commits (a1b13e570d77d0ac01ce2e9d6e8a810dcc05e019)

Author SHA1 Message Date
mattwparas fd4c689369 address comments on rope library 2024-02-19 20:36:41 -08:00
mattwparas 38f344c21c removing the language and theme configurations in favor of a better implementation in the future 2024-02-04 10:21:05 -08:00
mattwparas 392275ddb2 merge latest from master 2024-01-30 20:07:31 -08:00
Michael Davis 035b8eabdb Respect injections in movement::move_parent_node_end 2024-01-28 18:13:33 +09:00
Michael Davis 5e0b3cc28b Use injection syntax trees for bracket matching
Previously we used the root syntax tree for bracket matching. We can use
the new functionality in `Syntax` for finding the correct syntax tree
for a given byte range though so we use the correct syntax tree within
injections. This improves bracket matching behavior within HTML
injections like script or style tags for example.
2024-01-28 18:13:33 +09:00
Michael Davis cda8ea991e
highlighting: Gate multiple captures behind `#is-not? local` predicates (#9390) 2024-01-25 14:10:58 +09:00
Matthew Toohey f5f08becef
Fix typo in string representation of GotoReference (#9395) 2024-01-22 23:06:20 +09:00
Michael Davis 1f916e65cf Create helix-stdx crate for stdlib extensions
helix-stdx is meant to carry extensions to the stdlib or low-level
dependencies that are useful in all other crates. This commit starts
with all of the path functions from helix-core and the CWD tracking that
lived in helix-loader.

The CWD tracking in helix-loader was previously unable to call the
canonicalization functions in helix-core. Switching to our custom
canonicalization code should make no noticeable difference though
since `std::env::current_dir` returns a canonicalized path with
symlinks resolved (at least on unix).
2024-01-18 10:57:53 +09:00
Michael Davis eca3ccff76
Select subtree within injections in :tree-sitter-subtree (#9309)
`:tree-sitter-subtree` could previously only print subtrees of nodes
in the root injection layer. We can improve on that by finding the layer
that contains the given byte range and printing the subtree within that
layer. That gives more useful results when a selection is within an
injection layer.
2024-01-15 15:34:38 +09:00
Michael Davis 3011df4f35
Bump tree-sitter to latest master (#9317)
* query capture names now return `&str`s rather than `String`s
* the `#any-of?` predicate is now supported
2024-01-15 15:33:26 +09:00
Pascal Kuthe 445f7a273a ignore empty TS nodes in match bracket 2024-01-15 15:32:07 +09:00
Pascal Kuthe 2fb7e50b54 don't crash in plaintext bracket match (mm) on empty file 2024-01-15 15:32:07 +09:00
woojiq 3f88a3f4e6
Change path normalization strategy to not resolve symlinks (#9330) 2024-01-14 08:46:32 -06:00
Philipp Mildenberger 41ca46cf8c
Initialize diagnostics when opening a document (#8873) 2024-01-09 10:01:04 +09:00
mattwparas 01996b2bec No more passing around the helix context for every function call 2024-01-01 21:18:07 -08:00
Pascal Kuthe 515ef17207 make diagnostics stick to word boundaries
Diagnostics are currently extended if text is inserted at their end. This is
desirable when inserting text after an identifier. For example consider:

let foo = 2;
    --- unused variable

Renaming the identifier should extend the diagnostic:

let foobar = 2;
    ------ unused variable

This is currently implemented in helix but as a consequence adding whitespaces
or a type hint also extends the diagnostic:

let foo      = 2;
    -------- unused variable
let foo: Bar = 2;
    -------- unused variable

In these cases the diagnostic should remain unchanged:

let foo      = 2;
    --- unused variable
let foo: Bar = 2;
    --- unused variable

As a heuristic helix will now only extend diagnostics that end on a word char
if new chars are appended to the word (so not for punctuation/ whitespace).
The idea for this mapping was inspired for the word level tracking vscode uses
for many positions. While VSCode doesn't currently update diagnostics after
receiving publishDiagnostic it does use this system for inlay hints for example.
Similarly, the new association mechanism implemented here can be used for word
level tracking of inlay hints.

A similar mapping function is implemented for word starts. Together
these can be used to make a diagnostic stick to a word. If that word
is removed that diagnostic is automatically removed too. This is the exact
same behavior VSCode inlay hints eixibit.
2023-12-27 15:28:14 +09:00
Pascal Kuthe 8653e1b02f Add config to mark diagnostic sources as persistent 2023-12-27 15:28:14 +09:00
TornaxO7 914c83420b
fix `:indent-style` crash (#9087)
* removing unreachable statement in `:indent-style`

* update checks when setting indent line and update docs

* `cargo xtask docgen`
2023-12-15 19:05:04 +01:00
Daniel Ebert 723a132bdf Simplify implementation of `add_indent_level`.
Increase hybrid indent heuristic attempt limit to 4.
Clarify the fallback logic in indent heuristic docs.
2023-12-15 15:59:54 +09:00
Daniel Ebert 938a710904 Make the indent heuristic configurable 2023-12-15 15:59:54 +09:00
Daniel Ebert 559bfc1f5e Improve relative indent computation.
Add tests to ensure that relative & absolute indent computation are consistent.
2023-12-15 15:59:54 +09:00
Daniel Ebert d29a66f267 Implement relative indent queries,
i.e. also take into account the indentation of a previous
line when computing the indentation for a new line.
2023-12-15 15:59:54 +09:00
Cole Helbling 8b0ae3d279
bump MSRV to 1.70.0 (#8877)
* rust-toolchain.toml: bump MSRV to 1.70.0

With Firefox 120 released on 21 November 2023, the MSRV is now 1.70.0.

* Fix cargo fmt with Rust 1.70.0

* Fix cargo clippy with Rust 1.70.0

* Fix cargo doc with Rust 1.70.0

* rust-toolchain.toml: add clippy component

* .github: bump dtolnay/rust-toolchain to 1.70

* helix-term: bump rust-version to 1.70

* helix-view/gutter: use checked_ilog10 to count digits

* helix-core/syntax: use MAIN_SEPARATOR_STR constant

* helix-view/handlers/dap: use Display impl for displaying process spawn error

* WIP: helix-term/commands: use checked math to assert ranges cannot overlap
2023-11-25 13:55:49 +01:00
Michael Davis 8b2d97eb56 Default 'roots' field of language config
Previously roots needed to be specified by every language and `[]` was
used as an explicit default. Root files don't make sense for every
language (for example TOML) so I think we should allow languages to
not explicitly mention the key and have the `[]` default automatically.
2023-11-14 11:56:53 +09:00
Triton171 ef0c31db02
Fix precedence order of @align captures in indent computation (#8659)
precedence when multiple occur on the same line in an indent query.
2023-10-29 17:48:58 +01:00
Blaž Hrastnik 5ce1c30f77
Revert "Pin tree-sitter to the 0.20.10 release (#8396)"
We only reverted so that the latest release would use a stable
tree-sitter version hosted on crates.io. We do want the improvements
on nightly.

This reverts commit 2ebcc4dbeb.
2023-10-26 15:58:10 +09:00
Michael Davis 2ebcc4dbeb
Pin tree-sitter to the 0.20.10 release (#8396) 2023-10-26 01:08:46 +09:00
Stephen Seo 31f50bf5bf
don't break on hyphen with :reflow (#8569) 2023-10-21 07:58:36 -05:00
mattwparas db3e9ed31d Merge remote-tracking branch 'origin' into mwp-steel-integration 2023-09-14 08:53:23 -07:00
Alexis Mousset 83ac53a109
Fix various typos (#8233) 2023-09-10 15:31:12 -05:00
Pascal Kuthe e6cdc5f9d3
Don't use word splitting during fuzzy matching (#8192) 2023-09-06 23:03:48 +09:00
Pascal Kuthe 0cb595e226
transition to nucleo for fuzzy matching (#7814)
* transition to nucleo for fuzzy matching

* drop flakey test case

since the picker streams in results now any test that relies
on the picker containing results is potentially flakely

* use crates.io version of nucleo

* Fix typo in commands.rs

Co-authored-by: Skyler Hawthorne <skyler@dead10ck.com>

---------

Co-authored-by: Skyler Hawthorne <skyler@dead10ck.com>
2023-08-30 13:26:21 +09:00
mattwparas 18fa67d157 more clean up 2023-08-24 20:01:49 -07:00
mattwparas 279f5eddb3 add feature flag 2023-08-24 18:12:15 -07:00
mattwparas 7b6e733892 remove dead code 2023-08-24 08:37:00 -07:00
mattwparas 768b483e40 more dead code 2023-08-24 08:32:44 -07:00
mattwparas 42c9997487 merge in master 2023-08-23 08:49:29 -07:00
nkitsaini 22f4f313f1
Remove unnecessary `Err` from `get_canonicalized_path` (#8009)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-08-20 21:11:32 +02:00
mattwparas 72aa2d9520 indenting full in steel now 2023-08-19 22:13:56 -07:00
Michael Davis 01a1e5ec2a
Update tree-sitter to latest master (#7998) 2023-08-20 00:21:18 +09:00
mattwparas 08ab867b1b indent stuff 2023-08-18 22:02:08 -07:00
mattwparas d0d9f7b5b0 more integration, not pretty but still making progress 2023-08-17 20:48:37 -07:00
Dillard Robertson 01776e6851
Prevent GraphemeStrs created from Strings from leaking (#7920) 2023-08-12 20:13:06 -05:00
Daniel Ebert eab0d4fa4b Implement @align (and @anchor) indent query. 2023-08-11 23:44:02 +09:00
Skyler Hawthorne 7078e84007 Fix YAML auto indent
YAML indents queries are tweaked to fix auto indent behavior.

A new capture type `indent.always` is introduced to address use cases
where combining indent captures on a single line is desired.

Fixes #6661
2023-08-11 06:22:22 +09:00
mattwparas 1fb2df48e1 wip 2023-08-09 22:24:29 -07:00
Skyler Hawthorne 93acb53812 add node boundary movement 2023-08-01 09:41:42 -05:00
Michael Davis baceb02a09 Use refactored Registers type
This is an unfortunately noisy change: we need to update virtually all
callsites that access the registers. For reads this means passing in the
Editor and for writes this means handling potential failure when we
can't write to a clipboard register.
2023-07-31 15:05:38 +09:00
Michael Davis da2afe7353 Add '#' and '.' special registers
These come from Kakoune:

* '#' is the selection index register. It's read-only and produces the
  selection index numbers, 1-indexed.
* '.' is the selection contents register. It is also read-only and
  mirrors the contents of the current selections when read.

We switch the iterators returned from Selection's `fragments` and
`slices` methods to ExactSizeIterators because:

* The selection contents register can simply return the fragments
  iterator.
* ExactSizeIterator is already implemented for iterators over Vecs, so
  it's essentially free.
* The `len` method can be useful on its own.
2023-07-31 15:05:38 +09:00
Philipp Mildenberger 8a28f30593
Reformat with nightly rustfmt for better let-else formatting (#7721) 2023-07-27 11:57:19 +09:00