aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
Commit message (Collapse)AuthorAge
* Add required-root-patterns for situational lsp activation (#8696)ontley2024-02-12
| | | | | | | | | | | | | | | | | | | * Added required-root-patterns for situational lsp activation using globbing * Replaced filter_map with flatten * updated book to include required-root-patterns option * fixed wrong function name for path * Added globset to helix-core. Moved globset building to config parsing. * Normalize implements AsRef * cargo fmt * Revert "cargo fmt" This reverts commit ca8ce123e8d77d2ae8ed84d5273a9b554101b0db.
* Add glob file type support (#8006)Galen Abell2024-02-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replace FileType::Suffix with FileType::Glob Suffix is rather limited and cannot be used to match files which have semantic meaning based on location + file type (for example, Github Action workflow files). This patch adds support for a Glob FileType to replace Suffix, which encompasses the existing behavior & adds additional file matching functionality. Globs are standard Unix-style path globs, which are matched against the absolute path of the file. If the configured glob for a language is a relative glob (that is, it isn't an absolute path or already starts with a glob pattern), a glob pattern will be prepended to allow matching relative paths from any directory. The order of file type matching is also updated to first match on globs and then on extension. This is necessary as most cases where glob-matching is useful will have already been matched by an extension if glob matching is done last. * Convert file-types suffixes to globs * Use globs for filename matching Trying to match the file-type raw strings against both filename and extension leads to files with the same name as the extension having the incorrect syntax. * Match dockerfiles with suffixes It's common practice to add a suffix to dockerfiles based on their context, e.g. `Dockerfile.dev`, `Dockerfile.prod`, etc. * Make env filetype matching more generic Match on `.env` or any `.env.*` files. * Update docs * Use GlobSet to match all file type globs at once * Update todo.txt glob patterns * Consolidate language Configuration and Loader creation This is a refactor that improves the error handling for creating the `helix_core::syntax::Loader` from the default and user language configuration. * Fix integration tests * Add additional starlark file-type glob --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Respect injections in movement::move_parent_node_endMichael Davis2024-01-28
|
* Use injection syntax trees for bracket matchingMichael Davis2024-01-28
| | | | | | | | 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.
* highlighting: Gate multiple captures behind `#is-not? local` predicates (#9390)Michael Davis2024-01-25
|
* Fix typo in string representation of GotoReference (#9395)Matthew Toohey2024-01-22
|
* Create helix-stdx crate for stdlib extensionsMichael Davis2024-01-18
| | | | | | | | | | | | | 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).
* Select subtree within injections in :tree-sitter-subtree (#9309)Michael Davis2024-01-15
| | | | | | | `: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.
* Bump tree-sitter to latest master (#9317)Michael Davis2024-01-15
| | | | * query capture names now return `&str`s rather than `String`s * the `#any-of?` predicate is now supported
* ignore empty TS nodes in match bracketPascal Kuthe2024-01-15
|
* don't crash in plaintext bracket match (mm) on empty filePascal Kuthe2024-01-15
|
* Change path normalization strategy to not resolve symlinks (#9330)woojiq2024-01-14
|
* Initialize diagnostics when opening a document (#8873)Philipp Mildenberger2024-01-09
|
* make diagnostics stick to word boundariesPascal Kuthe2023-12-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add config to mark diagnostic sources as persistentPascal Kuthe2023-12-27
|
* fix `:indent-style` crash (#9087)TornaxO72023-12-15
| | | | | | | * removing unreachable statement in `:indent-style` * update checks when setting indent line and update docs * `cargo xtask docgen`
* Simplify implementation of `add_indent_level`.Daniel Ebert2023-12-15
| | | | | Increase hybrid indent heuristic attempt limit to 4. Clarify the fallback logic in indent heuristic docs.
* Make the indent heuristic configurableDaniel Ebert2023-12-15
|
* Improve relative indent computation.Daniel Ebert2023-12-15
| | | | Add tests to ensure that relative & absolute indent computation are consistent.
* Implement relative indent queries,Daniel Ebert2023-12-15
| | | | | i.e. also take into account the indentation of a previous line when computing the indentation for a new line.
* bump MSRV to 1.70.0 (#8877)Cole Helbling2023-11-25
| | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Default 'roots' field of language configMichael Davis2023-11-14
| | | | | | | 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.
* Fix precedence order of @align captures in indent computation (#8659)Triton1712023-10-29
| | | precedence when multiple occur on the same line in an indent query.
* Revert "Pin tree-sitter to the 0.20.10 release (#8396)"Blaž Hrastnik2023-10-26
| | | | | | | | 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 2ebcc4dbeb306cc285d47bd1d21d72c7e57ecb72.
* Pin tree-sitter to the 0.20.10 release (#8396)Michael Davis2023-10-25
|
* don't break on hyphen with :reflow (#8569)Stephen Seo2023-10-21
|
* Fix various typos (#8233)Alexis Mousset2023-09-10
|
* Don't use word splitting during fuzzy matching (#8192)Pascal Kuthe2023-09-06
|
* transition to nucleo for fuzzy matching (#7814)Pascal Kuthe2023-08-30
| | | | | | | | | | | | | | | | | | * 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>
* Remove unnecessary `Err` from `get_canonicalized_path` (#8009)nkitsaini2023-08-20
| | | | Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Update tree-sitter to latest master (#7998)Michael Davis2023-08-19
|
* Prevent GraphemeStrs created from Strings from leaking (#7920)Dillard Robertson2023-08-13
|
* Implement @align (and @anchor) indent query.Daniel Ebert2023-08-11
|
* Fix YAML auto indentSkyler Hawthorne2023-08-10
| | | | | | | | | 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
* add node boundary movementSkyler Hawthorne2023-08-01
|
* Use refactored Registers typeMichael Davis2023-07-31
| | | | | | | 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.
* Add '#' and '.' special registersMichael Davis2023-07-31
| | | | | | | | | | | | | | | | | | 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.
* Reformat with nightly rustfmt for better let-else formatting (#7721)Philipp Mildenberger2023-07-27
|
* Prefer RopeSlice to &Rope in helix_core::syntaxMichael Davis2023-07-27
| | | | | | | | | | | | | | | Pascal and I discussed this and we think it's generally better to take a 'RopeSlice' rather than a '&Rope'. The code block rendering function in the markdown component module is a good example for how this can be useful: we can remove an allocation of a rope and instead directly turn a '&str' into a 'RopeSlice' which is very cheap. A change to prefer 'RopeSlice' to '&Rope' whenever the rope isn't modified would be nice, but it would be a very large diff (around 500+ 500-). Starting off with just the syntax functions seems like a nice middle-ground, and we can remove a Rope allocation because of it. Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* use a single query for injectionsPascal Kuthe2023-07-17
| | | | In the past we used two separate queries for combined and normal injections. There was no real reason for this (except historical/slightly easier implementation). Instead, we now use a single query and simply check if an injection corresponds to a combined injection or not.
* fix crash when encountering overlapping injectionsPascal Kuthe2023-07-17
|
* Fix crash when cwd is deleted (#7185)Yomain2023-07-11
|
* search buffer contents during global search (#5652)Pascal Kuthe2023-07-11
|
* correctly map unsorted positions (#7471)Pascal Kuthe2023-06-28
| | | | | | | | | | | * correctly map unsorted positions * Fix typo Co-authored-by: Michael Davis <mcarsondavis@gmail.com> --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* move normalize fastpath into normalize functionPascal Kuthe2023-06-25
|
* map positions through changes in O(N)Pascal Kuthe2023-06-25
|
* Allow any indent size from 1 to 16 (#7429)Scott Driggers2023-06-23
|
* make TS matching fallback to plaintextPascal Kuthe2023-06-22
|
* Avoid false positives in non-fuzzy bracket matchPascal Kuthe2023-06-22
|
* match pairs which don't form a standalone TS nodePascal Kuthe2023-06-22
|