1016 Commits

Author SHA1 Message Date
Michael Davis
ce351f4b11 Avoid cloning language server names in Document::save
`language_servers` is a `HashMap<String, Arc<Client>>` so the clients
are cheap to clone but not the language server names. The names are
unused in the save future so we can avoid the unnecessary clones by
looking only at the `HashMap::values`.
2025-09-23 10:22:50 -04:00
Sofus
a5d0a0e1c2 Support textDocument/diagnostic specification (Pull diagnostics) (#11315)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-09-23 09:10:58 -05:00
RoloEdits
37fe42d05d fix(lints): clippy 1.89-1.90 (#14223) 2025-09-22 08:44:17 -05:00
Sylvain Terrien
55167c21df feat: flatten single-child dirs in file explorer (#14173) 2025-09-22 08:32:27 -05:00
Karem Abdul-Samad
8acfc55280 feat: add file explorer options (#13888) 2025-09-21 14:56:44 -04:00
Michael Davis
23a647aee8 Support mode 2031 dark/light mode detection (#14356) 2025-09-21 10:41:04 -05:00
Michael Davis
c2b582aa45 tui: Use Crossterm on Windows (#14454) 2025-09-21 09:35:08 -05:00
dependabot[bot]
c0921202a0 build(deps): bump the rust-dependencies group with 6 updates (#14458)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-15 20:35:59 -04:00
Sri Senthil Balaji J
d015eff4aa fix(helix-view/clipboard): use serde generated name for Win32Yank (#14455) 2025-09-15 10:18:49 -05:00
Valentin Cocaud
92b0a2f414 feat(helix-tui): add configuration to manually enable/disable KKP (#14398) 2025-09-12 09:32:22 -05:00
Charles Hall
05a99c2cca fix white/bright white base16 color mixup (#14409) 2025-09-10 08:38:45 -05:00
Michael Davis
83abbe56df Replace Crossterm with Termina
This change switches out the terminal manipulation library to one I've
been working on: Termina. It's somewhat similar to Crossterm API-wise
but is a bit lower-level. It's also influenced a lot by TermWiz - the
terminal manipulation library in WezTerm which we've considered
switching to a few times.

Termina is more verbose than Crossterm as it has a lower level interface
that exposes escape sequences and pushes handling to the application.
API-wise the important piece is that the equivalents of Crossterm's
`poll_internal` / `read_internal` are exposed. This is used for reading
the cursor position in both Crossterm and Termina, for example, but also
now can be used to detect features like the Kitty keyboard protocol and
synchronized output sequences simultaneously.
2025-08-31 12:25:01 -04:00
Michael Davis
b309d72688 Fix bugs in Editor::focus (#14262) 2025-08-31 08:52:40 -04:00
Michael Davis
1941f0b639 Rainbow tree-sitter matches 🌈 (#13530) 2025-07-26 18:02:29 -04:00
Michael Davis
6dc4722665 Enable inline diagnostics by default (#13970) 2025-07-26 17:23:15 -04:00
Muhammad Fathir Irhas
6ea3677b9f Current working directory status (#10998)
Co-authored-by: mfirhas <mfathirirhas@gmail.com>
2025-07-26 17:12:07 -04:00
Nik Revenco
f72b6f758b feat: add workspace_directory and current_working_directory variable expansions (#13068)
Co-authored-by: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com>
2025-07-26 14:58:32 -04:00
Michael Davis
2d5826d194 Complete words from open buffers (#13206) 2025-07-18 09:51:00 -05:00
dependabot[bot]
ab668c2dfc build(deps): bump toml from 0.8.23 to 0.9.2 in the rust-dependencies group (#13955)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-07-16 08:18:17 -05:00
Nik Revenco
e844a4365d fix: bitwise representation for RGB highlight (#13188)
Co-authored-by: Nik Revenco <154856872+NikitaRevenco@users.noreply.github.com>
2025-07-12 11:11:31 -04:00
StratusFearMe21
242353b2ba Add ability to configure atomic saving (#13656)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-07-10 19:12:59 -04:00
Sean Barag
0ca12250bc helix-view: expand primary selection line range in shell commands (#13840) 2025-06-30 09:44:55 -05:00
CalebLarsen
305f8bc165 Re-detect .editorconfig on :config-reload (#13443) 2025-06-30 09:21:37 -05:00
Michael Davis
43963473e3 Add a ConfigDidChange event
This is meant to be minimal for now and is expected to change as the
config system evolves.

Features like word completion should be able to hook into this to
initialize or clear the word index when the toggle for the feature is
turned on or off (respectively).
2025-06-23 11:32:51 -04:00
Jason Williams
2338b44909 DAP: Support the startDebugging reverse request (#13403) 2025-06-23 09:48:05 -05:00
Tatesa Uradnik
837627dd8a feat: allow moving nonexistent file (#13748) 2025-06-16 08:19:28 -05:00
yuri
1315b7e2b1 Feat: inlay hint length limit (#13742) 2025-06-13 11:09:21 -05:00
Erasin Wang
733ebcdaeb Add file indentation style for statusline (#13632) 2025-05-29 08:20:22 -05: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
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
4c630c148a feat(commands): add selection variable expansion (#13467) 2025-05-04 08:43:09 -05:00
RoloEdits
ac3c6ebaff feat(commands): add language variable expansion (#13466) 2025-05-04 08:35:58 -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
RoloEdits
d24e4fcf0f feat(config): add [workspace-]diagnostics fields to statusline (#13288) 2025-04-08 13:58:14 -05:00
Rolo
5b72b59448 perf: use next_back on DoubleEndedIterator 2025-04-06 12:03:14 -05:00
Rolo
f857a98671 refactor: uneeded string conversion for Display type 2025-04-06 12:03:14 -05:00
Michael Davis
e148d8b311 editor: Remove closed Document after updating Views
When closing a document we must wait until all views have been updated
first - either replacing their current document or closing the view -
before we remove the document from the `documents` map. The
`Editor::_refresh` helper is called by `Editor::close`. It accesses each
View's Document to sync changes and ensure that the cursor is in view.
When closing multiple Views at once, `Editor::_refresh` will attempt
to access the closing Document while refreshing a to-be-closed View.
2025-03-30 11:01:17 -04:00
Michael Davis
388a3b78e3 Avoid removing modified documents in Editor::close_document
This fixes a regression from 6da1a79d80. `:buffer-close` on an
unmodified document would cause later panics since the document should
not have been removed. Instead of eagerly removing the document on the
first line we need to wait until we've checked that it's unmodified.
2025-03-25 09:03:32 -04: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
683fac65e7 Refactor DiagnosticProvider as an enum
This resolves a TODO in the core diagnostic module to refactor this
type. It was originally an alias of `LanguageServerId` for simplicity.
Refactoring as an enum is a necessary step towards introducing
"internal" diagnostics - diagnostics emitted by core features such as
a spell checker. Fully supporting this use-case will require further
larger changes to the diagnostic type, but the change to the provider
can be made first.

Note that `Copy` is not derived for `DiagnosticProvider` (as it was
previously because `LanguageServerId` is `Copy`). In the child commits
we will add the `identifier` used in LSP pull diagnostics which is a
string - not `Copy`.
2025-03-22 09:25:29 -04:00
Michael Davis
3a63e85b6a Support EditorConfig (#13056) 2025-03-22 16:06:41 +09:00
Michael Davis
33c17d48ff minor: Move 'execute_lsp_command' helper into helix-view
This is a minor move that will make future refactors of code actions
simpler. We should be able to move nearly all code action functionality
into `helix-view`, save UI stuff like the `menu::Item` implementation
and dealings with the compositor.
2025-03-19 09:41:18 -04:00
trevershick
9d31e4df11 fix: adjust spelling of simlink->symlink (#13128) 2025-03-18 08:03:25 +09:00
Michael Davis
b47c9da3a1 minor: Use a workspace dependency for parking_lot 2025-03-13 12:34:40 -04:00
dependabot[bot]
f9360fb27e build(deps): bump rustix from 0.38.44 to 1.0.2 (#13071)
* build(deps): bump rustix from 0.38.44 to 1.0.2

Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.44 to 1.0.2.
- [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/v0.38.44...v1.0.2)

---
updated-dependencies:
- dependency-name: rustix
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Drop unnecessary unsafe blocks for rustix Uid and Gid types

* Revert spurious downgrade of windows-sys

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-03-11 09:34:08 -05:00
dependabot[bot]
ff558f9105 build(deps): bump the rust-dependencies group with 5 updates (#13070)
Bumps the rust-dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [tempfile](https://github.com/Stebalien/tempfile) | `3.17.1` | `3.18.0` |
| [once_cell](https://github.com/matklad/once_cell) | `1.20.3` | `1.21.0` |
| [serde](https://github.com/serde-rs/serde) | `1.0.218` | `1.0.219` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.43.0` | `1.44.0` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.7.1` | `2.8.0` |


Updates `tempfile` from 3.17.1 to 3.18.0
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.17.1...v3.18.0)

Updates `once_cell` from 1.20.3 to 1.21.0
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.20.3...v1.21.0)

Updates `serde` from 1.0.218 to 1.0.219
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.218...v1.0.219)

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

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

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-dependencies
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-dependencies
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-dependencies
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
  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-03-11 08:29:38 -05:00