aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
Commit message (Collapse)AuthorAge
* 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
|
* Fix tree sitter chunking (#7417)A-Walrus2023-06-21
| | | | | Call as bytes before slicing, that way you can take bytes that aren't aligned to chars. Should technically also be slightly faster since you don't have to check alignment...
* Add config for default line ending (#5621)Alex2023-06-16
|
* Fix next/prev tree-sitter inconsistency (#7332)A-Walrus2023-06-13
| | | | | | | | | * Fix next/prev tree-sitter inconsistency Before there where different results going to next or previous due to sorting not dealing with multiple captures that start/end at the same pos. I chose to prefer longer matches. * Revert unnecessary change
* add move_prev_long_word_end and extend_prev_long_word_end (#6905)vwkd2023-06-07
|
* Add check for a non-zero value for tab width (#7178)Ilya Sovtsov2023-06-07
|
* feat(core): add plaintext matching fallback to tree-sitter matching (#4288)Alex Vinyals2023-06-05
|
* Fix typo in syntax.rs (#7114)Ikko Eltociear Ashimine2023-05-26
| | | seperator -> separator
* Add command to merge non-consecutive ranges (#7053)Szabin2023-05-19
| | | | | | | | | | | * Add command for merging non-consecutive ranges * Add `merge_selections` command to book * Simplify `merge_ranges` Heeded the advice of @the-mikedavis to stop iterating over all ranges and simply merge the first and the last range, as the invariants of `Selection` guarantee that the list of ranges is always sorted and never empty. * Clarify doc comment of `merge_ranges`
* Refactor doc language servers to a HashMap, and the config to use a Vec to ↵Philipp Mildenberger2023-05-18
| | | | retain order
* Simplify Display implementation for LanguageServerFeaturePhilipp Mildenberger2023-05-18
|
* Refactored doc.language_servers and doc.language_servers_with_feature to ↵Philipp Mildenberger2023-05-18
| | | | | | return an iterator and refactor LanguageServerFeature handling to a HashMap (language server name maps to features) Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Simplify Display implementation of LanguageServerFeaturePhilipp Mildenberger2023-05-18
| | | | Co-authored-by: Ivan Tham <pickfire@riseup.net>
* Adds support for multiple language servers per language.Philipp Mildenberger2023-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Language Servers are now configured in a separate table in `languages.toml`: ```toml [langauge-server.mylang-lsp] command = "mylang-lsp" args = ["--stdio"] config = { provideFormatter = true } [language-server.efm-lsp-prettier] command = "efm-langserver" [language-server.efm-lsp-prettier.config] documentFormatting = true languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] } ``` The language server for a language is configured like this (`typescript-language-server` is configured by default): ```toml [[language]] name = "typescript" language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ] ``` or equivalent: ```toml [[language]] name = "typescript" language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ] ``` Each requested LSP feature is priorized in the order of the `language-servers` array. For example the first `goto-definition` supported language server (in this case `typescript-language-server`) will be taken for the relevant LSP request (command `goto_definition`). If no `except-features` or `only-features` is given all features for the language server are enabled, as long as the language server supports these. If it doesn't the next language server which supports the feature is tried. The list of supported features are: - `format` - `goto-definition` - `goto-declaration` - `goto-type-definition` - `goto-reference` - `goto-implementation` - `signature-help` - `hover` - `document-highlight` - `completion` - `code-action` - `workspace-command` - `document-symbols` - `workspace-symbols` - `diagnostics` - `rename-symbol` - `inlay-hints` Another side-effect/difference that comes with this PR, is that only one language server instance is started if different languages use the same language server.