A post-modern modal text editor.
 
 
 
 
 
Go to file
Michael Davis a8c82ea5e1
Add generic Range and Diagnostic types in helix-view
This introduces another `Range` type which is an enum: either the
(character) indices in a rope or a wrapper around `lsp::Range` - the
positions in the document according to the position encoding.

Internally we always use character (typically) or byte indices into the
text to represent positions into the text. LSP however uses row and
column counts where the column meaning depends on the position encoding
negotiated with the server. This makes it difficult to have concepts
like `Diagnostic` be generic between an internal feature (for example
spell checking errors) and LSP. The solution here is direct: use an enum
that represents either format of describing a range of positions.

This change introduces that `Range` and uses it for two purposes:

* `Diagnostic` has been rewritten and moved from helix-core to
  helix-view. The diagnostic type in `helix_view::document` is now a
  wrapper around `helix_view::Diagnostic`, tracking the actual ranges
  into the document.
* The `Location` type in `commands::lsp` has been refactored to use this
  range instead of directly using `lsp::Range`.

The point of this is to support emitting features like diagnostics and
symbols using internal features like a spell checker and tree-sitter
(respectively). Now the spell checking integration can attach
diagnostics itself, roughly like so:

    let provider = DiagnosticProvider::Spelling;
    let diagnostics = /* find spelling mistakes */
        .map(|(word, range)| {
            helix_view::Diagnostic {
                message: format!("Possible spelling mistake '{word}'"),
                severity: Some(Severity::Hint),
                range: helix_view::Range::Document(range),
                provider: provider.clone(),
                ..Default::default()
            }
        })
        .collect();
    editor.handle_diagnostics(
        provider,
        uri,
        Some(doc_version),
        diagnostics,
    );

In addition we can use this to build tree-sitter based symbol pickers
(also see <https://redirect.github.com/helix-editor/helix/pull/12275>).
2025-03-24 09:17:13 -04:00
.cargo Add hook/event system 2024-01-23 11:20:19 +09:00
.github build(deps): bump cachix/install-nix-action from 30 to 31 (#13073) 2025-03-11 08:49:18 -05:00
book Color swatches ( 🟩 green 🟥 #ffaaaa ) (#12308) 2025-03-23 16:07:02 -05:00
contrib Fix Bash completion space regression (#12828) 2025-02-10 10:42:45 -06:00
docs Document installation of rust-analyzer via rustup (#12618) 2025-02-01 19:43:20 -06:00
helix-core Add generic Range and Diagnostic types in helix-view 2025-03-24 09:17:13 -04:00
helix-dap DAP: Drain pending requests on recv failure 2025-02-04 09:09:54 -05:00
helix-event minor: Use a workspace dependency for parking_lot 2025-03-13 12:34:40 -04:00
helix-loader build(grammar): remove `-fPIC` flag from windows build (#13169) 2025-03-23 09:32:56 -05:00
helix-lsp Add generic Range and Diagnostic types in helix-view 2025-03-24 09:17:13 -04:00
helix-lsp-types Add generic Range and Diagnostic types in helix-view 2025-03-24 09:17:13 -04:00
helix-parsec fix(clippy): clippy 1.83 lints (#12150) 2024-12-02 08:23:32 -06:00
helix-stdx fix: adjust spelling of simlink->symlink (#13128) 2025-03-18 08:03:25 +09:00
helix-term Add generic Range and Diagnostic types in helix-view 2025-03-24 09:17:13 -04:00
helix-tui build(deps): bump the rust-dependencies group with 5 updates (#13070) 2025-03-11 08:29:38 -05:00
helix-vcs chore(worker): remove unused lifetime on `EventAccumulator` (#13158) 2025-03-22 16:00:39 +09:00
helix-view Add generic Range and Diagnostic types in helix-view 2025-03-24 09:17:13 -04:00
runtime Make `goto_word` highlights visible (same fix as #12904) (#13174) 2025-03-23 10:27:58 -05:00
xtask xtask: Inline query and theme checks into main module 2025-02-24 10:51:28 -05:00
.envrc direnv: Watch changes to default.nix 2025-03-04 11:31:54 -05:00
.gitattributes Add .gitattributes (#3318) 2022-08-03 08:21:51 -05:00
.gitignore fix: added .DS_Store to gitignore 2024-11-20 16:18:42 -06:00
CHANGELOG.md Fix typos (#12690) 2025-02-02 18:58:29 -06:00
Cargo.lock build(deps): bump the rust-dependencies group with 5 updates (#13131) 2025-03-18 12:52:22 +09:00
Cargo.toml build(deps): bump the rust-dependencies group with 5 updates (#13131) 2025-03-18 12:52:22 +09:00
LICENSE Add the LICENSE file. 2021-05-11 01:44:00 +09:00
README.md Fix repology badge (#11895) 2024-10-16 01:52:50 +09:00
base16_theme.toml base16_default: add styles to newer unthemed features (#10858) 2024-06-23 10:07:13 +09:00
default.nix flake: Avoid setting HELIX_RUNTIME in devShell 2025-03-06 18:40:35 -05:00
flake.lock Clean up Nix Flake & make it easier to customize (#12831) 2025-03-04 10:23:28 -06:00
flake.nix flake: Revert devShell linker to lld 2025-03-07 12:06:33 -05:00
grammars.nix Clean up Nix Flake & make it easier to customize (#12831) 2025-03-04 10:23:28 -06:00
languages.toml add werk language and highlights (#13136) 2025-03-20 08:04:52 -05:00
logo.svg Reduce logo sizes even more (#9211) 2024-01-02 23:16:37 +01:00
logo_dark.svg Reduce logo sizes even more (#9211) 2024-01-02 23:16:37 +01:00
logo_light.svg Reduce logo sizes even more (#9211) 2024-01-02 23:16:37 +01:00
rust-toolchain.toml chore(msrv): bump MSRV from 1.70 to 1.76 2024-11-22 01:17:08 -08:00
rustfmt.toml Add rustfmt.toml to force formatting to use rustfmt defaults 2021-07-23 18:11:22 +09:00
screenshot.png update screenshot (#1879) 2022-03-30 00:16:57 +09:00
shell.nix build(nix): update flake deps, add default.nix file 2022-06-21 17:39:30 -05:00
theme.toml Allow theming directory prompt completions (#12205) 2024-12-17 21:13:42 -06:00

README.md

Helix

Build status GitHub Release Documentation GitHub contributors Matrix Space

Screenshot

A Kakoune / Neovim inspired editor, written in Rust.

The editing model is very heavily based on Kakoune; during development I found myself agreeing with most of Kakoune's design decisions.

For more information, see the website or documentation.

All shortcuts/keymaps can be found in the documentation on the website.

Troubleshooting

Features

  • Vim-like modal editing
  • Multiple selections
  • Built-in language server support
  • Smart, incremental syntax highlighting and code editing via tree-sitter

Although it's primarily a terminal-based editor, I am interested in exploring a custom renderer (similar to Emacs) using wgpu or skulpin.

Note: Only certain languages have indentation definitions at the moment. Check runtime/queries/<lang>/ for indents.scm.

Installation

Installation documentation.

Packaging status

Contributing

Contributing guidelines can be found here.

Getting help

Your question might already be answered on the FAQ.

Discuss the project on the community Matrix Space (make sure to join #helix-editor:matrix.org if you're on a client that doesn't support Matrix Spaces yet).

Credits

Thanks to @jakenvac for designing the logo!