Commit Graph

2854 Commits (bafe5bdb0e79a5ad31bad212a5e9608510b8a93c)

Author SHA1 Message Date
Michael Davis 633c5fbf0f
Update language loader before refreshing theme in `:config-reload`
Since locals are handled during parsing instead of highlighting with
tree-house, we need to call `helix_core::syntax::Loader::set_scopes`
before parsing any documents. During `:config-reload` we previously
reloaded the `Loader` and re-parsed documents and _then_ updated the
theme. So documents were parsed before `Loader::set_scopes` was called
on the new loader.

With this change the `refresh_language_config` helper is inlined into
`refresh_config`. Updating the `Editor`'s `ArcSwap` of the loader is
done before updating the theme so that the `load_configured_theme`
helper can call `set_scopes` with on the new loader.
2025-06-08 15:05:22 -04:00
Axlefublr 637274c4d4
Add `rotate_selections_{first,last}` commands (#13615) 2025-06-06 15:08:41 -05:00
Matt Paras 8eae56f548 merge latest from master 2025-06-05 22:54:31 -07:00
Matt Paras f40100a0cd dont lock the engine when grabbing the docs 2025-06-05 21:35:27 -07:00
Matt Paras 6f4b41c9e8 keep component functions alive for the duration of the life cycle, skip rendering if the function is actually a bool 2025-06-05 16:17:27 -07:00
Ryan Mehri 6c43dc4962
fix: trim whitespace up to the last selection on insert_newline (#13673) 2025-06-03 08:45:19 -05:00
Matt Paras ba1fdac4e2 use inferred steel lsp home location 2025-06-02 18:01:15 -07:00
Matt Paras fe2ab3565f fix theme api 2025-06-01 16:18:23 -07:00
Matt Paras 3149754e85 bake in a high level theme api 2025-06-01 16:11:36 -07:00
Matt Paras bc01dda33a check if a document has been modified 2025-05-31 10:07:13 -07:00
Michael Davis 67f1fe20c3
Fix command line completion replacement for quoted items
With a directory with spaces in the name (for example
`mkdir -p 'Temp/Abc Def'`), completing `Temp/Ab` would create a
completion item `'Temp/AbAbc Def'`. Now it correctly completes
`'Temp/Abc Def'`
2025-05-31 09:56:54 -04:00
Matt Paras 9f581f802b update steel, add new time primitives 2025-05-30 17:23:20 -07:00
Matt Paras c7273d754c add document saved hook 2025-05-29 21:34:47 -07:00
Erasin Wang 733ebcdaeb
Add file indentation style for statusline (#13632) 2025-05-29 08:20:22 -05:00
Matt Paras 977fc9e786 add dynamic option config 2025-05-28 06:38:00 -07:00
Matt Paras c1da27bbab add missing bufferline option 2025-05-28 06:10:57 -07:00
Matt Paras b3d55c0ce9 clean up 2025-05-27 20:28:50 -07:00
Matt Paras 863cf60422 speed up the keymap api 2025-05-27 20:27:21 -07:00
CalebLarsen 2bd7452fe0
Make signature_help more like hover, fix overflow and lack of scrolling in signature_help (#13566)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-05-27 10:18:12 -05:00
CalebLarsen 7dcddf98c6
Append changes to history on jumps (#13619)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-05-27 09:44:47 -05:00
piotrkwarcinski 85e83d9d9a Fix call to exp-picker callback 2025-05-26 22:14:55 +02:00
Axlefublr 2fbe7fc5b5
fix(doc): missing capitalization of `goto_{next,prev}_tabstop` (#13616) 2025-05-26 08:48:32 -05:00
Matt Paras fda1bbf742 add macros for language configuration and lsp configuration 2025-05-24 21:48:36 -07:00
Michael Davis 702a961517
Fix `try_restore_indent` on non-LF documents
On Windows for example the behavior of this function typically diverges
from the usual behavior on Unix. Instead of checking that the inserted
string starts with `'\n'` (untrue for for CRLF line endings) we need to
check that the first grapheme cluster in the string is a line ending.
(All line endings are single grapheme clusters.)
2025-05-24 11:42:29 -04:00
Nik Revenco 1023e8f964
feat: highlight rust string interpolation macros that use `format_args!` (#13533)
Co-authored-by: Nik Revenco <154856872+NikitaRevenco@users.noreply.github.com>
2025-05-24 10:02:32 -05:00
Saheed Adeleye 223ceec10a
Add an `--insensitive`/`-i` flag for `:sort` (#13560)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-05-24 09:55:48 -05:00
Matt Paras 3e5710521a bundle ext library, upgrade steel, fix block on task 2025-05-23 14:35:23 -07:00
Matt Paras aefdab6307 fix arity on acquire-context-lock 2025-05-23 06:42:14 -07:00
Matthew Paras 04697d61f9
Merge pull request #26 from tobiaskohlbau/writeRegisters 2025-05-22 06:24:03 -07:00
Matt Paras aada3b5e42 add ability to ignore the command and close the component 2025-05-21 16:07:42 -07:00
Tobias Kohlbau 6ec04107ca
apply suggested naming
Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
2025-05-21 17:29:13 +02:00
Jérôme Tamba 76029e5840
health: Use lsp name in output wherever possible (#13573)
Also match the DAP/Formatter output style to the LSP style
2025-05-21 09:38:16 -05:00
Matt Paras 67c5a2a99b add function to check for key event 2025-05-20 22:00:47 -07:00
Matt Paras 9f0501d060 when encountering an error in a dynamic component, pop off the stack with the error message 2025-05-20 20:58:24 -07:00
Matt Paras 39614b29b1 typo in theme-scope 2025-05-20 16:09:12 -07:00
Matt Paras 85bd47cd81 fix arity for ctx functions in components 2025-05-20 15:59:20 -07:00
Matt Paras 6de42353fd have docs properly generate on code-gen 2025-05-20 13:58:14 -07:00
Tobias Kohlbau 3147f98258
fix typo in find-workspace
Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
2025-05-20 10:30:46 +02:00
Tobias Kohlbau 29226873c9
allow writing registers from steel
Allow writing into registers specified by it's character. This enables
for example writing into the system clipboard.

Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
2025-05-20 10:15:47 +02:00
Matt Paras f9d83ac52b remove some logging 2025-05-19 22:11:03 -07:00
Matt Paras d451258b28 insert unknown lsps on update 2025-05-19 22:10:41 -07:00
Matt Paras a2a97f1f8f properly handle lsp configs as well 2025-05-19 22:03:55 -07:00
Matt Paras d3fb156824 manually merge each field in the language config 2025-05-19 21:46:05 -07:00
Matt Paras 770d4d33ce refresh language configs for open docs after update 2025-05-19 20:49:30 -07:00
Matt Paras 39f7244b0f fix init file and set up language configs 2025-05-19 20:30:16 -07:00
Matt Paras 54b30330b4 clean up, don't error on bootup if the helix file is missing 2025-05-19 19:16:21 -07:00
Matt Paras c0bb7c29cd rename workspace function 2025-05-19 08:16:20 -07:00
Matt Paras 94927711b4 make sure docs don't show up for globals that aren't commands 2025-05-19 06:56:12 -07:00
Matt Paras e6b0badcd0 fix polluting the command palette with global steel functions 2025-05-18 19:30:44 -07:00
Matt Paras d04c95dc7f more docs 2025-05-17 22:27:59 -07:00
Matt Paras 64e4826782 more documentation 2025-05-17 22:02:51 -07:00
Matt Paras 56a083a222 more documentation of configuration 2025-05-17 18:32:41 -07:00
Matt Paras a48abb7b50 just kidding, actually finish documenting the component api 2025-05-17 13:00:34 -07:00
Matt Paras 3b534acbe3 finish documenting component api 2025-05-17 12:28:10 -07:00
Matt Paras 848f2e2e89 instrument proper components module, start documentation 2025-05-17 11:37:23 -07:00
Michael Davis 3ceae88c3a
Use 'ui.text' as a base style for the syntax highlighter
This fixes a regression from the refactor of the highlighters when
switching to tree-house. The old `StyleIter` used `renderer.text_style`
as the base style rather than `Style::default()` for syntax highlights.
The result was that any text not captured by a syntax highlight query
was styled with no foreground or background, defaulting to the
terminal's foreground/background. This could cause text in markdown
files to look off-colored depending on your terminal configuration.
(Though you wouldn't notice if your 'ui.text' theming matches your
terminal's theming.)
2025-05-16 10:52:47 -04:00
Rock Boynton f157a918a3
Show the primary selection index on statusline (#12326)
Co-authored-by: Rock Boynton <rboynton@anduril.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-05-15 07:53:02 -05:00
Michael Davis 702b1d0a0f
statusline: Avoid unnecessary allocations for `&'static str` spans
Previously the statusline `write` function only accepted a string
and optional Style, so all rendering functions converted text to
strings. Some elements write spans with `&'static str`s, however, making
this unnecessary since `Span<'a>` is a wrapper around `Cow<'a, str>` and
style, and a `Span<'static>` would outlive all required lifetimes.

Moreover many elements could produce `Span<'a>` according to the
lifetime in `RenderContext` in the future, potentially re-borrowing from
the Editor borrow, so this change could save allocations for many
file-type elements (with more future changes). This is not explored in
this patch since the statusline functions currently add bespoke padding
per-element, but with a future refactor to make spacing consistent this
could be possible.

This change refactors the write function to accept a `Span<'a>` and
rewrites some related code to fit the codebase better (preferring `for`
to iterator's `for_each` for example). The new code is more complicated
lifetime-wise but avoids allocations in these cases:

* spacer for mode name when a pane is not focused
* LSP spinner frames
* '●' (workspace) diagnostic indicators
* " W " workspace diagnostic prefix
* file modification indicators
* read-only indicators
* spacer element

... and opens the door to avoid allocation for file name elements in the
future.
2025-05-15 08:33:02 -04:00
Michael Davis b0528bbac4
statusline: Avoid showing only 'W' in workspace-diagnostics element
If you configure a subset of severities to show in the workspace
diagnostics statusline element you can see the 'W' (and surrounding
space) without any diagnostic indicators. This is the case by default
as it's configured to show warnings and errors only - if you have only
hints in your workspace like if you open `application.rs` in Helix for
example then you would see the 'W' and no indicators.

This change checks that any of the configured diagnostics are non-zero
and bails early if there are none.
2025-05-14 17:33:21 -04:00
Matt Paras 81ee8ef4ce test experimental picker callback, use at your own risk (do not use unless you know what you're doing) 2025-05-14 08:05:58 -07:00
Michael Davis aea53523dd
Replace tree-sitter with tree-house 2025-05-13 18:43:43 -04:00
Michael Davis 24e3ccc31b
Add the `syn_loader` to `Document`
This type also exists on `Editor`. This change brings it to the
`Document` as well because the replacement for `Syntax` in the child
commits will eliminate `Syntax`'s copy of `syn_loader`. `Syntax` will
also be responsible for returning the highlighter and query iterators
(which will borrow the loader), so the loader must be separated from
that type.

In the long run, when we make a larger refactor to have
`Document::apply` be a function of the `Editor` instead of the
`Document`, we will be able to drop this field on `Document` - it is
currently only necessary for `Document::apply`. Once we make that
refactor, we will be able to eliminate the surrounding `Arc` in
`Arc<ArcSwap<syntax::Loader>>` and use the `ArcSwap` directly instead.
2025-05-13 18:30:21 -04:00
Michael Davis c94fde8d1c
syntax: Move config types to a separate module 2025-05-13 18:30:21 -04:00
RoloEdits 47547e94ad
perf(statusline): reorder match and specify `u32` for `workspace_diagnostics` (#13512) 2025-05-12 08:27:04 -05:00
piotrkwarcinski de2496d46b formatting 2025-05-11 23:14:48 +02:00
piotrkwarcinski ec53eb429a dots 2025-05-11 23:05:21 +02:00
piotrkwarcinski d9ec722a77 Add documentation 2025-05-11 22:58:35 +02:00
piotrkwarcinski c0c3d69280 Merge remote-tracking branch 'plugin-steel/steel-event-system' into helix-plugin-register-value 2025-05-11 14:58:36 +02:00
Matt Paras e8614ce099 use embedded dependencies instead of depending on external code generated ones 2025-05-10 11:55:27 -07:00
piotrkwarcinski edcb630075 cleanup 2025-05-10 14:49:04 +02:00
piotrkwarcinski 63086eecf7 feat: allow to get a register value from scheme 2025-05-04 22:27:25 +02:00
Daniel Bowring 69b9db2fbb
Add goto_column and extend_to_column commands (#13440) 2025-05-01 09:12:30 -05:00
Joffrey Bluthé 949d9e4433
feat: give formatters access to filename (#13429)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-04-28 17:34:05 -05:00
Sumandora 99b57181d5
Improve auto completion for shell commands (#12883)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-04-27 14:04:56 -05:00
Matt Paras c69f11b428 fix merge 2025-04-27 11:51:14 -05:00
Matt Paras 5c6620b465 remove debug prints 2025-04-27 11:42:15 -05:00
Matt Paras e684c7db1b setup embedding 2025-04-27 11:39:38 -05:00
Matt Paras 35c9a3dc37 start working on some docs 2025-04-27 07:47:46 -05:00
Matt Paras 170e5068cd wip 2025-04-25 22:08:43 -07:00
dependabot[bot] 0815b52e09
build(deps): bump libc in the rust-dependencies group (#13389) 2025-04-22 15:10:48 +09:00
Matthew Paras 9bb634ab4a
Merge pull request #16 from RatCornu/steel
Optionally load init.scm and helix.scm from env var
2025-04-19 09:18:06 -07:00
Matt Paras 85eab83d70 fix command and arg parsing with typed commands 2025-04-19 09:01:40 -07:00
Matt Paras 43b9dd3e65 remove erroneous no such command when the command succeeds 2025-04-08 17:44:50 -07:00
RoloEdits d24e4fcf0f
feat(config): add `[workspace-]diagnostics` fields to statusline (#13288) 2025-04-08 13:58:14 -05:00
dependabot[bot] 5d16aae58e
build(deps): bump the rust-dependencies group across 1 directory with 5 updates (#13301)
Bumps the rust-dependencies group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [smallvec](https://github.com/servo/rust-smallvec) | `1.14.0` | `1.15.0` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.44.1` | `1.44.2` |
| [rustix](https://github.com/bytecodealliance/rustix) | `1.0.3` | `1.0.5` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.8.0` | `2.9.0` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.17` | `1.2.18` |



Updates `smallvec` from 1.14.0 to 1.15.0
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.14.0...v1.15.0)

Updates `tokio` from 1.44.1 to 1.44.2
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.44.1...tokio-1.44.2)

Updates `rustix` from 1.0.3 to 1.0.5
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGES.md)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v1.0.3...v1.0.5)

Updates `indexmap` from 2.8.0 to 2.9.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/main/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.8.0...2.9.0)

Updates `cc` from 1.2.17 to 1.2.18
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.17...cc-v1.2.18)

---
updated-dependencies:
- dependency-name: smallvec
  dependency-version: 1.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-dependencies
- dependency-name: tokio
  dependency-version: 1.44.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: rustix
  dependency-version: 1.0.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: indexmap
  dependency-version: 2.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-dependencies
- dependency-name: cc
  dependency-version: 1.2.18
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-07 21:33:46 -05:00
Jason Fuchs 46f7cdb5a9
feat: add ! alias for sh and | for pipe (#13263) 2025-04-08 01:00:45 +09:00
Dimitri Sabadie 29789f2a9f
Add support for extend_file_{start,end} (#11767) 2025-04-06 13:18:47 -05:00
Rolo 1bc45c8b3a refactor: change empty check to `is_empty` instead of `len > 0` 2025-04-06 12:03:14 -05:00
RoloEdits 01fce51c45
fix(keymap): point to proper `MappableCommand` instead of `Command` (#13214) 2025-03-28 08:51:36 -05:00
Keir Lawson 7929c0719d
Track progress title an display in place of internal token (#13180)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-03-27 12:00:23 -05:00
Matt Paras c9b52761ec unpark the interrupt handler after resuming 2025-03-26 21:37:54 -07:00
Matt Paras 7143dd4850 use new mutex guard 2025-03-25 22:31:39 -07:00
Matt Paras 60c0882fd2 remove old document open/close events 2025-03-25 22:10:43 -07:00
Matt Paras fffa86e682 merge from master 2025-03-25 19:48:34 -07:00
Michael Davis d43de14807
LSP: Avoid requesting document colors for ghost transactions
The point of ghost transactions is to avoid notifying language servers
about changes since the change is meant to be temporary. This is used
for completion while selecting items in the menu: updating the language
server would mess up incomplete completions.

When a document is changed by a ghost transaction the language server
will not be notified so its understanding of the document will not be
synchronized and any positions it sends may be out-of-date. So we should
avoid triggering a request for new document color information when a
document is changed by a ghost transaction.
2025-03-25 08:52:47 -04:00
Nick 5adb4b7413
Allow `:theme` to show current theme (#13192)
Updates the signature for the command to take 0 arguments. This probably
regressed during 0efa8207d8.
2025-03-25 18:43:26 +09:00
Nik Revenco 0ee5850016
Color swatches ( 🟩 green 🟥 #ffaaaa ) (#12308) 2025-03-23 16:07:02 -05:00
Michael Davis 7e7a98560e
LSP: Eagerly decode request results in the client
Previously the `call` helper (and its related functions) returned a
`serde_json::Value` which was then decoded either later in the client
(see signature help and hover) or by the client's caller. This led to
some unnecessary boilerplate in the client:

    let resp = self.call::<MyRequest>(params);
    Some(async move { Ok(serde_json::from_value(resp.await?)?) })

and in the caller. It also allowed for mistakes with the types. The
workspace symbol request's calling code for example mistakenly decoded a
`lsp::WorkspaceSymbolResponse` as `Vec<lsp::SymbolInformation>` - one of
the untagged enum members (so it parsed successfully) but not the
correct type.

With this change, the `call` helper eagerly decodes the response to a
request as the `lsp::request::Request::Result` trait item. This is
similar to the old helper `request` (which has become redundant and has
been eliminated) but all work is done within the same async block which
avoids some awkward lifetimes. The return types of functions like
`Client::text_document_range_inlay_hints` are now more verbose but it is
no longer possible to accidentally decode as an incorrect type.

Additionally `Client::resolve_code_action` now uses the `call_with_ref`
helper to avoid an unnecessary clone.
2025-03-22 14:40:29 -04:00
Michael Davis 6da1a79d80
Add document and LSP lifecycle events, move some callbacks into hooks
This adds events for:

* a document being opened
* a document being closed
* a language server sending the initialized notification
* a language server exiting

and also moves some handling done for these scenarios into hooks,
generally moving more into helix-view. A hook is also added on
`DocumentDidChange` which sends the `text_document_did_change`
notification - this resolves a TODO in `document`.
2025-03-22 11:41:50 -04:00
Michael Davis 2cc33b5c47
Add pull diagnostics `identifier` to LSP diagnostic provider
This includes a change to lsp-types to store the identifier as an Arc
since it will be cloned for each diagnostic.
2025-03-22 09:25:29 -04:00