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. |
||
---|---|---|
.cargo | ||
.github | ||
book | ||
contrib | ||
docs | ||
helix-core | ||
helix-dap | ||
helix-event | ||
helix-loader | ||
helix-lsp | ||
helix-lsp-types | ||
helix-parsec | ||
helix-stdx | ||
helix-term | ||
helix-tui | ||
helix-vcs | ||
helix-view | ||
runtime | ||
xtask | ||
.envrc | ||
.gitattributes | ||
.gitignore | ||
CHANGELOG.md | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE | ||
README.md | ||
base16_theme.toml | ||
default.nix | ||
flake.lock | ||
flake.nix | ||
grammars.nix | ||
languages.toml | ||
logo.svg | ||
logo_dark.svg | ||
logo_light.svg | ||
rust-toolchain.toml | ||
rustfmt.toml | ||
screenshot.png | ||
shell.nix | ||
theme.toml |
README.md
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.
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
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!