A post-modern modal text editor.
 
 
 
 
 
Go to file
google-labs-jules[bot] 9d1adccf62 Fix: Ensure canonical paths for LSP interactions and workspace roots
This commit addresses an issue where Helix could open duplicate tabs for
the same file if that file was accessed via a symlinked path and an LSP
server (e.g., pyright) returned a fully resolved (canonical) path for
"go to definition" or similar actions. This was particularly problematic
when the entire workspace root was under a symlink.

I've implemented the following changes:

1.  **Canonicalize LSP Client Root URIs (`helix-lsp`):**
    - I modified `helix-lsp/src/lib.rs` (specifically `find_lsp_workspace`
      and `start_client`) and `helix-lsp/src/client.rs`
      (`Client::try_add_doc`) to ensure that the LSP client's
      `root_path`, `root_uri`, and `workspace_folders` are stored in
      their fully canonicalized (symlink-resolved) forms. This ensures
      the LSP client operates with a canonical understanding of its
      workspace root(s).

2.  **Canonicalize Incoming LSP URIs (`helix-core`):**
    - I modified `helix-core/src/uri.rs` in the `convert_url_to_uri`
      function. When a `url::Url` with a `file://` scheme is converted
      to a `Uri::File`, the path is now processed using
      `helix_stdx::path::canonicalize` instead of
      `helix_stdx::path::normalize`. This ensures URIs from LSP messages
      are also in canonical form.

3.  **Verified Document Path Storage (`helix-view`):**
    - I confirmed that `Document::set_path` (in `helix-view/src/document.rs`)
      already uses `helix_stdx::path::canonicalize`. This means
      `Document` objects store their paths canonically.

4.  **Verified URI Comparisons (`helix-view`):**
    - I confirmed that lookups like `Editor::document_by_path` (in
      `helix-view/src/editor.rs`) correctly compare canonical paths,
      which, due to the above changes, should ensure consistent matching.

These changes collectively ensure that paths/URIs from different sources
(your input, LSP client configuration, LSP messages) are all resolved to
their canonical forms before comparison or use in lookups, preventing
the erroneous opening of duplicate buffers for symlinked files.

I wrote an integration test (`lsp_goto_definition_symlinked_workspace` in
`helix-term/tests/symlink_lsp_workspace_test.rs`) to
specifically cover the symlinked workspace root scenario. However,
persistent compilation timeouts in the testing environment prevented
this test from being run and validated.
2025-05-21 02:05:38 +00:00
.cargo Add hook/event system 2024-01-23 11:20:19 +09:00
.github CI: Set a timeout for the test suite workflow 2025-05-17 09:16:14 -04:00
book Removed unnecessary apostrophe in keymap.md (#13551) 2025-05-17 07:43:27 -05:00
contrib feat: add ConsoleOnly to desktop entry categories (#13236) 2025-03-31 09:28:50 -05:00
docs fix: typos (#13505) 2025-05-10 10:36:17 -05:00
helix-core Fix: Ensure canonical paths for LSP URI conversion to prevent duplicate tabs 2025-05-21 01:42:33 +00:00
helix-dap syntax: Move config types to a separate module 2025-05-13 18:30:21 -04:00
helix-event chore(msrv): bump from 1.76 to 1.82 (#13275) 2025-04-28 09:48:54 -05:00
helix-loader Replace tree-sitter with tree-house 2025-05-13 18:43:43 -04:00
helix-lsp Fix: Ensure canonical paths for LSP interactions and workspace roots 2025-05-21 02:05:38 +00:00
helix-lsp-types chore(msrv): bump from 1.76 to 1.82 (#13275) 2025-04-28 09:48:54 -05:00
helix-parsec fix(clippy): clippy 1.83 lints (#12150) 2024-12-02 08:23:32 -06:00
helix-stdx chore(msrv): bump from 1.76 to 1.82 (#13275) 2025-04-28 09:48:54 -05:00
helix-term Fix: Ensure canonical paths for LSP interactions and workspace roots 2025-05-21 02:05:38 +00:00
helix-tui build(deps): bump the rust-dependencies group with 5 updates (#13070) 2025-03-11 08:29:38 -05:00
helix-vcs build(deps): bump the rust-dependencies group with 3 updates (#13437) 2025-04-29 10:48:45 +09:00
helix-view Replace tree-sitter with tree-house 2025-05-13 18:43:43 -04:00
runtime Updated python/locals.scm to label `self` and `cls` as `variable.buitin` (#13552) 2025-05-17 09:43:21 -05:00
xtask Replace tree-sitter with tree-house 2025-05-13 18:43:43 -04:00
.envrc direnv: Watch changes to default.nix 2025-03-04 11:31:54 -05:00
.gitattributes Help Linguist identify Tree-sitter queries (#13436) 2025-04-29 08:28:20 -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 3 updates (#13576) 2025-05-20 21:03:55 +09:00
Cargo.toml Replace tree-sitter with tree-house 2025-05-13 18:43:43 -04: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 default.nix: remove ellipsis in argument attrset 2025-05-09 11:57:48 -04:00
flake.lock flake: drop flake-utils dependency 2025-05-09 11:57:48 -04:00
flake.nix fix: typos (#13505) 2025-05-10 10:36:17 -05:00
grammars.nix chore: clean up grammars.nix (#13506) 2025-05-10 07:58:48 -05:00
languages.toml Update tree-sitter-haskell (#13475) 2025-05-17 07:42: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 from 1.76 to 1.82 (#13275) 2025-04-28 09:48:54 -05: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!