-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rework positioning/rendering and enable softwrap/virtual text #5420
Conversation
This PR is a large change to many core components of helix and therefore needs testing before merging. You can enable softwrap either using While virtual text is implemented in this PR, it does not include any functionality that actually makes use of it so it's harder to test altough rebasing #3791 would be neat. |
6d96f54
to
2d100cd
Compare
Is this "fully" implemented and usable for editing? |
yeah unless I missed something. There is nothing intentionally left out |
2d100cd
to
125f2e0
Compare
Thanks a lot for working on this, gonna daily drive it a bit but already looks awesome ! To overcome this, I see the following solutions for the defaults:
I personally prefer the first point, mainly because this was NeoVim's behavior once you had remapped vertical motions to use virtual lines, but I'm curious about your thoughts on this. Thanks ! |
I’m going to daily drive this as well!
Is there a reason for the name of the option to not be the same in both contexts? (both |
It's always |
I don't think we should handle vertical movement differently when a count is specified. That seems inconsistent. I will be adding a command for vertical movement that ignores softwrap later. Users that behaviour could change the |
In the above image, I feel like it would be more readable if whole words were split, rather than being split mid-word. It's a bit distracting. |
That's going to complicate things since you'd need to backtrack and determine where a reasonable break would be. It wouldn't work in cases where you're looking at minified JSON either. |
From what I can tell the github code rendering doesn't support this either but I didn't check other editors |
Is the indentation on wrapped lines deliberate though? I think most editors will wrap to the beginning of the line |
VSCode implements this, and I think it uses a config option to determine maximum word length before wrapping (80 columns). Led also implemented it in that way (though of course it wasn't a major editor). VSCode's wrapping implementation is in https://github.com/microsoft/vscode/blob/82db01c21a0d0d08b156b725a37c39cc3714c238/src/vs/editor/common/viewModel/viewModelLines.ts#L60 |
It is deliberate and there is also a config option for it |
I'm not opposed to it, but it could also be done as a follow-up, depends on what @pascalkuthe thinks |
I would very much like the option to split on words rather than in the middle of them, it is set using 'linebreak' in NeoVim. The following is taken from the NeoVim documentation:
|
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
This assert was added during early development of helix-editor#5420 and makes no sense with the current code. We simply forgot to remove it.
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
The line annotation as implemented in helix-editor#5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs).
Allow multiple language server with lsp-workspace-command (#10176) This fix allows for multiple language servers at once which support workspace commands. This was previously broken as just the first language server supporting workspace commands was queried when listing allowed worspace commands. The fix is in two parts. Firstly, querying all workspace commands from all language servers available and using them when actually running the command in `lsp_workspace_command`. Secondly, doing the same in `completers::lsp_workspace_command` such that completion still works as expected. The fix has one remaining issue, which I am unsure how to handle in the best way possible, but which I also don't think should happen often: Multiple language servers may register commands with the same name. This will lead to that command being listed in the popup menu and in the completion list multiple times, which can be possibly confusing. One could disambigue them in the popover menu, but I am not sure the same can be done for completion. When running `lsp-workspace-command` with parameters, this behavior is "fixed" by displaying an error in that case. I am unsure if this is the best fix for this issue in that case, but could not find a better one. Fix language server ID type in lsp_workspace_command (#11105) Minor improvements to comments in selection.rs (#11101) add cursorcolumn and cursorline to base16_transparent theme (#11099) `&Option<T>` -> `Option<&T>` (#11091) * refactor `starting_request_args` to only `ref` non-`Copy` * refactor `needs_recompile` to only `ref` non-`Copy` * refactor `add_workspace_folder` to only `ref` `Some` --------- Co-authored-by: Rudxain <[email protected]> build(deps): bump the rust-dependencies group with 5 updates (#11113) Bumps the rust-dependencies group with 5 updates: | Package | From | To | | --- | --- | --- | | [serde](https://github.com/serde-rs/serde) | `1.0.203` | `1.0.204` | | [imara-diff](https://github.com/pascalkuthe/imara-diff) | `0.1.5` | `0.1.6` | | [clipboard-win](https://github.com/DoumanAsh/clipboard-win) | `5.3.1` | `5.4.0` | | [open](https://github.com/Byron/open-rs) | `5.1.4` | `5.2.0` | | [cc](https://github.com/rust-lang/cc-rs) | `1.0.104` | `1.0.106` | Updates `serde` from 1.0.203 to 1.0.204 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.203...v1.0.204) Updates `imara-diff` from 0.1.5 to 0.1.6 - [Release notes](https://github.com/pascalkuthe/imara-diff/releases) - [Changelog](https://github.com/pascalkuthe/imara-diff/blob/master/CHANGELOG.md) - [Commits](https://github.com/pascalkuthe/imara-diff/compare/v0.1.5...v0.1.6) Updates `clipboard-win` from 5.3.1 to 5.4.0 - [Commits](https://github.com/DoumanAsh/clipboard-win/commits) Updates `open` from 5.1.4 to 5.2.0 - [Release notes](https://github.com/Byron/open-rs/releases) - [Changelog](https://github.com/Byron/open-rs/blob/main/changelog.md) - [Commits](https://github.com/Byron/open-rs/compare/v5.1.4...v5.2.0) Updates `cc` from 1.0.104 to 1.0.106 - [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.0.104...cc-v1.0.106) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: imara-diff dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: clipboard-win dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies - dependency-name: open dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies - dependency-name: cc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Fix heredoc and add ansi_c_string highlights in bash queries (#11118) Add changes for undo in insert mode (#11090) * Add changes before insert mode undo Fixes #11077 * Address edge cases for undo like Kakoune does --------- Co-authored-by: Kaniel Kirby <[email protected]> Co-authored-by: Michael Davis <[email protected]> Update fleet_dark.toml (#11046) Expand tilde for selected paths in goto_file (#10964) Previously `gf` on `~/.config/helix` for example would error if the entire path was selected but succeed and open a picker for the directory contents if the selection was one one-width cursor. We need to expand tildes for all paths instead of just the auto-detected paths. This also refactors the `goto_file` blocks a little so that we construct `paths` once instead of creating the Vec and immediately clearing it when the selection is one single-width cursor. feat: improve hx fish completion (#10853) * feat: improve hx fish completion - add -w and --working-dir options - shorten option description - dynamically call hx --health * feat: improve health check completion - remove header - remove check/x characters * feat: use hx --health languages in completion Add basedpyright langserver (#11121) Update ZSH completions (#11120) Add space back to main text in the tutor after chapter 11 (#11117) Add {pdm,uv}.lock, git/ignore, npmrc to languages (#11131) Documentation: Convert links in the `.desktop` file to absolute paths (#11115) Fix ZSH completions (#11133) refactor(commands): trim end of `pipe`-like output (#10952) Include .yml files in Helm chart templates (#11135) Update Hare grammar (#11130) This change uses <https://git.sr.ht/~ecs/tree-sitter-hare/> that is up-to-date and linked from the official documentation. Add regex injections into bash (#11112) Update tree-sitter-todotxt (#11097) Update to latest commit that allows any non-whitespace character for projects, and contexts. Commit an undo checkpoint before each write (#11062) This fixes the modification indicator when saving from insert mode with a config such as [keys.insert] C-s = ":write" Previously the modification indicator would be stuck showing modified even if the buffer contents matched the disk contents when writing after some changes in insert mode with this binding. In insert mode we do not eagerly write undo checkpoints so that all changes made become one checkpoint as you exit insert mode. When saving, `Document`s `changes` `ChangeSet` would be non-empty and when there are changes we show the buffer as modified. Then switching to normal mode would append the changes to history, bumping the current revision past what it was when last saved. Since the last saved revision and current revision were then unsynced, the modification indicator would always show modified. This matches [Kakoune's behavior]. Kakoune has a different architecture for writes but a very similar system for history, transactions and undo checkpoints (what it calls "undo groups"). Upon saving Kakoune creates an undo checkpoint if there are any uncommitted changes. It does this after the write has gone through since its writing system is different. For our writing system it's cleaner to make the undo checkpoint before performing the save so that the history revision increments before we send the save event. [Kakoune's behavior]: https://github.com/mawww/kakoune/blob/80fcfebca8c62ace6cf2af9487784486af07d2d5/src/buffer.cc#L565-L566 Theme: Kanagawa Dragon (#10172) Implements the Dragon variant of the Kanagawa theme. https://github.com/rebelot/kanagawa.nvim?tab=readme-ov-file Exclude EOL repos from the Repology badge (#11159) Add changelog notes for 24.07 (#10731) * Changelog 2024-05-02 checkpoint: 31273c69e0be3b2d14f0c76d3f6a735e1d332e63 * Changelog 2024-05-06 checkpoint: 61818996c63cb752afb817259a90108f884db1cb * Changelog 2024-05-11 checkpoint: 00e9e5eadef16dd20cd24d303a664faaeb8faa56 * Bump version to 24.05 * Add 24.05 release to AppImage metadata * Fix release number in changelog Co-authored-by: Blaž Hrastnik <[email protected]> * Update release numbers to 24.07 * Changelog 2024-06-15 * Changelog 2024-07-14 checkpoint: c9b484097b045a34b709131fc62e87ba21789d1a * Linkify --------- Co-authored-by: Blaž Hrastnik <[email protected]> Adjust the ruler color of the default theme Make `format_selections` respect document configuration (#11169) Inject the comment grammar into Hare (#11173) Update highlights.scm and injections.scm for blade.php files (#11138) * Update highlights.scm for blade.php files * Update injections.scm to add tree-sitter-comment injection * Fixed the injection issues regarding blade parameters Keep editor from switching to normal mode when loading a Document (#11176) Use an AsyncHook for picker preview highlighting The picker previously used the IdleTimeout event as a trigger for syntax-highlighting the currently selected document in the preview pane. This is a bit ad-hoc now that the event system has landed and we can refactor towards an AsyncHook (like those used for LSP completion and signature-help). This should resolve some odd scenarios where the preview did not highlight because of a race between the idle timeout and items appearing in the picker. Refactor Picker in terms of columns `menu::Item` is replaced with column configurations for each picker which control how a column is displayed and whether it is passed to nucleo for filtering. (This is used for dynamic pickers so that we can filter those items with the dynamic picker callback rather than nucleo.) The picker has a new lucene-like syntax that can be used to filter the picker only on certain criteria. If a filter is not specified, the text in the prompt applies to the picker's configured "primary" column. Adding column configurations for each picker is left for the child commit. Add a special query syntax for Pickers to select columns Now that the picker is defined as a table, we need a way to provide input for each field in the picker. We introduce a small query syntax that supports multiple columns without being too verbose. Fields are specified as `%field pattern`. The default column for a picker doesn't need the `%field` prefix. The field name may be selected by a prefix of the field, for example `%p foo.rs` rather than `%path foo.rs`. Co-authored-by: ItsEthra <[email protected]> Add column configurations for existing pickers This removes the menu::Item implementations for picker item types and adds `Vec<Column<T, D>>` configurations. Replace picker shutdown bool with version number This works nicely for dynamic pickers: we stop any running jobs like global search that are pushing to the injector by incrementing the version number when we start a new request. The boolean only allowed us to shut the picker down once, but with a usize a picker can have multiple "sessions" / "life-cycles" where it receives new options from an injector. Implement Error for InjectorShutdown Bump nucleo to v0.4.1 We will use this in the child commit to improve the picker's running indicator. Nucleo 0.4.0 includes an `active_injectors` member that we can use to detect if anything can push to the picker. When that count drops to zero we can remove the running indicator. Nucleo 0.4.1 contains a fix for crashes with interactive global search on a large directory. Consolidate DynamicPicker into Picker DynamicPicker is a thin wrapper over Picker that holds some additional state, similar to the old FilePicker type. Like with FilePicker, we want to fold the two types together, having Picker optionally hold that extra state. The DynamicPicker is a little more complicated than FilePicker was though - it holds a query callback and current query string in state and provides some debounce for queries using the IdleTimeout event. We can move all of that state and debounce logic into an AsyncHook implementation, introduced here as `DynamicQueryHandler`. The hook receives updates to the primary query and debounces those events so that once a query has been idle for a short time (275ms) we re-run the query. A standard Picker created through `new` for example can be promoted into a Dynamic picker by chaining the new `with_dynamic_query` function, very similar to FilePicker's replacement `with_preview`. The workspace symbol picker has been migrated to the new way of writing dynamic pickers as an example. The child commit will promote global search into a dynamic Picker as well. Remove sym_picker helper fun The parent commit split out the workspace symbol picker to an inline definition so the `workspace` parameter is never passed as `true`. We should consolidate this picker definition into the symbol_picker function. Refactor global_search as a dynamic Picker global_search: Suggest latest '/' register value Add a hidden column for the global search line contents We could expand on this in the future to have different preview modes that you can toggle between with C-t. Currently that binding just hides the preview but it could switch between different preview modes and in one mode hide the path and just show the line contents. Request a UI redraw on Drop of an Injector This fixes the changed files picker when used against a clean worktree for example. Without it the running indicator does not disappear. It also simplifies the dynamic query handler's implementation so that it doesn't need to request a redraw explicitly. Co-authored-by: Pascal Kuthe <[email protected]> avoid collecting columns to a temporary vec Convert LSP URIs into custom URIs This introduces a custom URI type in core meant to be extended later if we want to support other schemes. For now it's just a wrapper over a PathBuf. We use this new URI type to firewall `lsp::Url`. This was previously done in 8141a4a but using a custom URI type is more flexible and will improve the way Pickers handle paths for previews in the child commit(s). Co-authored-by: soqb <[email protected]> Avoid allocations in Picker file preview callback The `FileLocation` and `PathOrId` types can borrow paths rather than requiring them to be owned. This takes a refactor of the preview functions and preview internals within `Picker`. With this change we avoid an unnecessary `PathBuf` clone per render for any picker with a file preview function (i.e. most pickers). This refactor is not fully complete. The `PathOrId` is _sometimes_ an owned `PathBuf`. This is for pragmatic reasons rather than technical ones. We need a further refactor to introduce more core types like `Location` in order to eliminate the Cow and only use `&Path`s within `PathOrId`. This is left for future work as it will be a larger refactor almost entirely fitting into the LSP commands module and helix-core - i.e. mostly unrelated to refactoring the `Picker` code itself. Co-authored-by: Pascal Kuthe <[email protected]> Accept 'IntoIterator<Item = T>' for Picker::new options `Picker::new` loops through the input options to inject each of them, so there's no need to collect into an intermediary Vec. This removes some unnecessary collections. Also, pickers that start with no initial options can now pass an empty slice instead of an empty Vec. Co-authored-by: Luis Useche <[email protected]> Picker: Reset the cursor on prompt change Accept 'IntoIterator<Item = Column<T, D>>' for picker columns This allows us to replace any `vec![..]`s of columns where all columns are static with static slices `[..]`. Picker: Highlight the currently active column We can track the ranges in the input text that correspond to each column and use this information during rendering to apply a new theme key that makes the "active column" stand out. This makes it easier to tell at a glance which column you're entering. implement Add/Sub for position being able to add/subtract positions is very handy when writing rendering code ensure highlight scopes are skipped properly track char_idx in DocFormatter Improve line annotation API The line annotation as implemented in #5420 had two shortcomings: * It required the height of virtual text lines to be known ahead time * It checked for line anchors at every grapheme The first problem made the API impractical to use in practice because almost all virtual text needs to be softwrapped. For example inline diagnostics should be softwrapped to avoid cutting off the diagnostic message (as no scrolling is possible). While more complex virtual text like side by side diffs must dynamically calculate the number of empty lines two align two documents (which requires taking account both softwrap and virtual text). To address this, the API has been refactored to use a trait. The second issue caused some performance overhead and unnecessarily complicated the `DocumentFormatter`. It was addressed by only calling the trait mentioned above at line breaks (instead of always). This allows offers additional flexibility to annotations as it offers the flexibility to align lines (needed for side by side diffs). correctly wrap at text-width streamline text decoration API This commit brings the text decoration API inline with the LineAnnotation API (so they are consistent) resulting in a single streamlined API instead of multiple ADHOK callbacks. fix typo in doc_formatter.rs stable sort diagnostics to avoid flickering render diagnostic inline remove redudant/incorrect view bound check use correct position for cursor in doc popup ignore empty virtual text layers fix scrolling/movement for multiline virtual text only show inline diagnostics after a delay gracefully handle lack of tokio runtime add `:edit` and `:e` as aliases for `:open` (#11186) Vim supports these, and i can't think of any reason helix would want to have a different meaning for `:edit` than `:open`. docs: https://vimhelp.org/editing.txt.html#%3Aedit Regenerate documentation (#11196) build(deps): bump the rust-dependencies group with 3 updates (#11194) Bumps the rust-dependencies group with 3 updates: [thiserror](https://github.com/dtolnay/thiserror), [open](https://github.com/Byron/open-rs) and [cc](https://github.com/rust-lang/cc-rs). Updates `thiserror` from 1.0.61 to 1.0.62 - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.61...1.0.62) Updates `open` from 5.2.0 to 5.3.0 - [Release notes](https://github.com/Byron/open-rs/releases) - [Changelog](https://github.com/Byron/open-rs/blob/main/changelog.md) - [Commits](https://github.com/Byron/open-rs/compare/v5.2.0...v5.3.0) Updates `cc` from 1.0.106 to 1.1.5 - [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.0.106...cc-v1.1.5) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: open dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies - dependency-name: cc dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Fixed headings (# / ##) to match other docs (#11192) fix(commands): change `pipe`-like output trimming (#11183) Fix `select_all_children` command (#11195) Update release docs (#11182) These haven't been updated in a little while. The original plan was to update the version (in `Cargo.toml`) after a release to the next planned release date but the way we release now is to update the version as a part of the release process (just before tagging). Typically this is all taken care of in the CHANGELOG-updating branch along with the other documentation changes like the appdata file. The workflow now is basically just to merge the changelog/release branch, pull, tag and push. Fix a typo in the tutor (#11201) Bring `kanagawa` colours better in line with neovim version (#11187) - Fixes some colours not matching their counterpart in neovim. - Adds `ui.debug` colours - Fix for separators in inactive statuslines global_search: Save search when accepting an option (#11209) The Prompt is set up to push the current line to history when hitting Enter but the Picker doesn't pass the Enter event down to the Prompt (for good reason: we don't want the Prompt's behavior of changing completions when we hit a path separator). We should save the Prompt's line to its configured history register when hitting Enter when there is a selection in the Picker. This currently only applies to `global_search`'s Picker since it's the only Picker to use `Picker::with_history_register`. global_search: Save only the primary query to the history register (#11216) Two changes from the parent commit: * Save only the `Picker::primary_query` - so you don't save other parts of the query, for example `%path foo.rs` while in `global_search`. * Move the saving out of the `if let Some(option) = self.selection()` block. So when you hit enter you save to history whether you have a selection or not. If you want to close the picker without saving to the register you can use C-c or Esc instead. tree-sitter: Update SHA of parser fro the slint language (#11224) There has been a new release with a few minor tweaks to the parser. The queries are fine still. Picker: Skip dynamic query debounce for pastes (#11211) Pastes are probably the last edit one means to make before the query should run so it doesn't need to be debounced. This makes global search much snappier for example when accepting the history suggestion from the '/' register or pasting a pattern from the clipboard or a register. contrib: add nushell completions (#11262) Add `:mv` as an alias for `:move` (#11256) `mv` is the familiar shell command to move or rename a file. Add this to Helix as an alias for `:move`. fix: usage of `node12 which is deprecated` (#11277) * chore: changes from formatting on save * fix: usage of `node12 which is deprecated` Revert `kanagawa` diff colour change from #11187 (#11270) Return document display name from the '%' special register (#11275) build(deps): bump the rust-dependencies group with 5 updates (#11281) Bumps the rust-dependencies group with 5 updates: | Package | From | To | | --- | --- | --- | | [thiserror](https://github.com/dtolnay/thiserror) | `1.0.62` | `1.0.63` | | [toml](https://github.com/toml-rs/toml) | `0.8.14` | `0.8.15` | | [tokio](https://github.com/tokio-rs/tokio) | `1.38.0` | `1.38.1` | | [cc](https://github.com/rust-lang/cc-rs) | `1.1.5` | `1.1.6` | | [libloading](https://github.com/nagisa/rust_libloading) | `0.8.4` | `0.8.5` | Updates `thiserror` from 1.0.62 to 1.0.63 - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.62...1.0.63) Updates `toml` from 0.8.14 to 0.8.15 - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.14...toml-v0.8.15) Updates `tokio` from 1.38.0 to 1.38.1 - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.38.0...tokio-1.38.1) Updates `cc` from 1.1.5 to 1.1.6 - [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.1.5...cc-v1.1.6) Updates `libloading` from 0.8.4 to 0.8.5 - [Commits](https://github.com/nagisa/rust_libloading/compare/0.8.4...0.8.5) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: toml 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-patch dependency-group: rust-dependencies - dependency-name: cc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: libloading dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Consistently maintain view position (#10559) * replicate t-monaghan's changes * remove View.offset in favour of Document.view_data.view_position * improve access patterns for Document.view_data * better borrow checker wrangling with doc_mut!() * reintroduce ensure_cursor_in_view in handle_config_events since we sorted out the borrow checker issues using partial borrows, there's nothing stopping us from going back to the simpler implementation * introduce helper functions on Document .view_offset, set_view_offset * fix rebase breakage Add tutor entry about 2-character label jump (#11273) * Add tutor entry about 2-character label jump * Move gw tutor to chapter 9 * Do not explicitely say which labels are shown following gw Fix typos in 2-character label jump Tutor entry (#11298) just module extension (#11286) Co-authored-by: adept <[email protected]> fix(lsp): `find_completion_range` off-by-one (#11266) Document use of filter columns in pickers (#11218) * Document use of filter columns in pickers. Filtering on columns was implemented in #9647. The only documentation I could find on this feature was the PR itself, and the video demo used a different syntax. * Note that column filters are space-separated. * Note that picker filters can be abbreviated. * Specify correct picker in docs. * Clarify picker filter prefix shortenting. Co-authored-by: Michael Davis <[email protected]> * Move picker docs to their own section. * Update book/src/pickers.md Co-authored-by: Michael Davis <[email protected]> * Improve docs on picker registers, keybinds, and syntax. * Clarify wording around picker queries. Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Ryan Roden-Corrent <[email protected]> Co-authored-by: Michael Davis <[email protected]> Make bash completion behave normally (#11246) Add support for `jjdescription` files (#11271) build(deps): bump gix-attributes from 0.22.2 to 0.22.3 (#11318) Bumps [gix-attributes](https://github.com/Byron/gitoxide) from 0.22.2 to 0.22.3. - [Release notes](https://github.com/Byron/gitoxide/releases) - [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md) - [Commits](https://github.com/Byron/gitoxide/compare/gix-attributes-v0.22.2...gix-attributes-v0.22.3) --- updated-dependencies: - dependency-name: gix-attributes dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> languages: add mdx to markdown filetypes (#11122) Fix example query in pickers.md (#11322) Co-authored-by: Pascal Kuthe <[email protected]> Reorganize Document::apply_impl (#11304) These changes are ported from <https://redirect.github.com/helix-editor/helix/pull/9801>. It's a cleanup of `Document::apply_impl` that uses some early returns to reduce nesting and some reordering of the steps. The early returns bail out of `apply_impl` early if the transaction fails to apply or if the changes are empty (in which case we emit the SelectionDidChange event). It's a somewhat cosmetic refactor that makes the function easier to reason about but it also makes it harder to introduce bugs by mapping positions through empty changesets for example. Co-authored-by: Pascal Kuthe <[email protected]> Improve scrolloff behavior (#11323) * Allow perfect centering of cursor * Fix horizontal scrolloff * Fix copypasta in comment Use fs' mtime to avoid saving problem on out-of-synced network fs (#11142) In the case of network file systems, if the server time is ahead of the local system time, then helix could annoy with messages that the file has already been modified by another application. Fix writing hardlinks (#11340) * don't use backup files with hardlinks * check if the inodes remain the same in the test * move funcs to faccess and use AsRawHandle * use a copy as a backup for hardlinks * delete backup after copy lock unicode width Cargo automatically pumbs the patch version when installed with `cargo install` without the locked flag which creates weird rendering artifacts Update helix-core/Cargo.toml Co-authored-by: Michael Davis <[email protected]> Disable hard link integration test on Android Non-rooted Android typically doesn't have permission to use hard links at all, so this test fails on Android. Lower log level for message about removing clients from the registry Servers stopped with `:lsp-stop` will show this message when the server exits. If the client isn't in the registry there isn't any work to do to remove it so this branch is benign. Tombstone LSP clients stopped with :lsp-stop We use the empty vec in `inner_by_name` as a tombstone value. When the vec is empty `get` should not automatically restart the server. feat(languages): update `just` grammar and queries (#11306) * feat(languages): update `just` grammar and queries Bump the * refactor(syntax): inject shebang by id not name --------- Co-authored-by: Trevor Gross <[email protected]> contrib: nushell: also complete available languages with --health (#11346) new theme named ao (#11063) * new theme named ao * Update runtime/themes/ao.toml Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Michael Davis <[email protected]> Fix panic when starting helix tutor (#11352) Closes #11351 Also fixed some minor issues related to log message contents, and removed unnecessary use of `.as_mut()` as per code review comments on the PR. Documented ulimit fix for error during integration tests (#11356) Remove unnecessary `.as_mut()` call and fix log messages (#11358) These are changes that fell out of commit: d7a3cdea65ef321d53b8dc8417175781b5272049 reduce log noise on file writes (#11361) stable sort lsp edits (#11357) Add theme keys for the picker header area (#11343) * feat: pertty header * 更新 themes.md Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Michael Davis <[email protected]> build(deps): bump the rust-dependencies group with 6 updates (#11371) Fix finding injection layer in tree cursor with nested layers (#11365) The `take_while` should limit the layers to those that can match the input range so we don't always scan the entire `injection_layers`. We can limit `depth == 1` layers to those that start before the search `end`. Deeper layers overlap with shallower layers though so we need to allow those layers as well in the `take_while`. For example ```vue <script setup lang="ts"> const foo = 'bar'.match(/foo/); const bar = foo; </script> ``` L2 and L3 are a typescript layer and the `/foo/` part is a small regex layer. If you used `A-o` before the regex layer you would select the entire typescript layer. The search in `layer_id_containing_byte_range` would not consider the typescript layer since the regex layer comes earlier in `injection_ranges` and that layer's start is after `end`. The regex layer has a depth of `2` though so the change in this commit allows scanning through that layer. Co-authored-by: Pascal Kuthe <[email protected]> update language configuration for Tcl (#11236) The primary executable that comes with Tcl is `tclsh`. Not really sure what `tclish` is, as I initially thought it was a typo. However, there seems to be references to it based on a quick search (e.g. [here](https://wiki.tcl-lang.org/page/Tclish) and [here](https://tclish.sourceforge.net/)), so maybe it's a valid executable that I just haven't been aware of. I was hesitant to replace it and instead opted to just add `tclsh`. Updated Godot support (#11235) - update gdscript highlights - add godot-resource textobjects Vendor the `lsp-types` crate Add helix-lsp-types to workspace Rename `lsp-types` crate to `helix-lsp-types` Replace lsp-types in helix-lsp with helix-lsp-types 'cargo fmt' helix-lsp-types: Resolve clippy lints in tests Resolve unclosed HTML tag doc warning chore: clean up clippy lints (#11377) Using clippy 1.80.0. Also cleans up some that were windows only. fix :move panic when starting a new language server (#11387) * fix move panic * change location of is initialized check output `stderr` in `:sh` popup if shell commands fail (#11239) * refactor(commands): output `stderr` in `:sh` popup * refactor(commands): switch to `from_utf8_lossy` This way something is always displayed. * refactor: no longer log stderr output on failure Add statusline errors when nothing is selected with `s`, `K`, `A-K` (#11370) Update Gleam tree sitter to support label shorthand syntax (#11427) build(deps): bump bitflags from 1.3.2 to 2.6.0 Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.3.2 to 2.6.0. - [Release notes](https://github.com/bitflags/bitflags/releases) - [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md) - [Commits](https://github.com/bitflags/bitflags/compare/1.3.2...2.6.0) --- updated-dependencies: - dependency-name: bitflags dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> build(deps): bump the rust-dependencies group with 9 updates Bumps the rust-dependencies group with 9 updates: | Package | From | To | | --- | --- | --- | | [regex](https://github.com/rust-lang/regex) | `1.10.5` | `1.10.6` | | [dunce](https://gitlab.com/kornelski/dunce) | `1.0.4` | `1.0.5` | | [serde_json](https://github.com/serde-rs/json) | `1.0.121` | `1.0.122` | | [toml](https://github.com/toml-rs/toml) | `0.8.16` | `0.8.19` | | [crossterm](https://github.com/crossterm-rs/crossterm) | `0.27.0` | `0.28.1` | | [tempfile](https://github.com/Stebalien/tempfile) | `3.10.1` | `3.11.0` | | [serde_repr](https://github.com/dtolnay/serde-repr) | `0.1.12` | `0.1.19` | | [which](https://github.com/harryfei/which-rs) | `6.0.1` | `6.0.2` | | [windows-sys](https://github.com/microsoft/windows-rs) | `0.52.0` | `0.59.0` | Updates `regex` from 1.10.5 to 1.10.6 - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.10.5...1.10.6) Updates `dunce` from 1.0.4 to 1.0.5 - [Commits](https://gitlab.com/kornelski/dunce/compare/v1.0.4...v1.0.5) Updates `serde_json` from 1.0.121 to 1.0.122 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.121...v1.0.122) Updates `toml` from 0.8.16 to 0.8.19 - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.16...toml-v0.8.19) Updates `crossterm` from 0.27.0 to 0.28.1 - [Release notes](https://github.com/crossterm-rs/crossterm/releases) - [Changelog](https://github.com/crossterm-rs/crossterm/blob/master/CHANGELOG.md) - [Commits](https://github.com/crossterm-rs/crossterm/commits) Updates `tempfile` from 3.10.1 to 3.11.0 - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.10.1...v3.11.0) Updates `serde_repr` from 0.1.12 to 0.1.19 - [Release notes](https://github.com/dtolnay/serde-repr/releases) - [Commits](https://github.com/dtolnay/serde-repr/compare/0.1.12...0.1.19) Updates `which` from 6.0.1 to 6.0.2 - [Release notes](https://github.com/harryfei/which-rs/releases) - [Changelog](https://github.com/harryfei/which-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/harryfei/which-rs/compare/6.0.1...6.0.2) Updates `windows-sys` from 0.52.0 to 0.59.0 - [Release notes](https://github.com/microsoft/windows-rs/releases) - [Commits](https://github.com/microsoft/windows-rs/compare/0.52.0...0.59.0) --- updated-dependencies: - dependency-name: regex dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: dunce dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: crossterm dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies - dependency-name: serde_repr dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: which dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: windows-sys dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> tui: Port improvement from ratatui on crossterm 0.28 (https://github.com/ratatui-org/ratatui/pull/1072) Fix crossterm compilation on macOS stdx: Include all required windows-sys APIs stdx: PSID now sits under Win32::Foundation stdx: ...and this cast is now unnecessary Add commands for movement by subwords (#8147) * Allow moving by subword * Add tests for subword movement Add .svn as workspace root marker (#11429) * add .svn as workspace-root marker * cargo fmt Added `mesonlsp` as the default LSP for Meson (#11416) * defaulted meson to JCWasmx86/mesonlsp * generated docs for mesonlsp dark_plus: add picker highlights, update underlined modifier syntax, and tweak a few settings (#11415) Support i3wm and sway config (#11424) * Support i3wm and sway config better syntax highlight and fix comment string * typo Add TypeSpec support (#11412) * Add TypeSpec support Adds support for TypeSpec <https://typespec.io> in helix. * Resolve PR comments * Pull in LICENSE Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Michael Davis <[email protected]> fix(picker): no longer `trim` search pattern (#11406) Update HTML highlights (#11400) * Update HTML highlights * Update after review comments Add jq language support (#11393) jq is a language for manipulating JSON data: https://jqlang.github.io/jq/ add verilog comment textobjects (#11388) just: Use updated grammar with recent language changes and correct highlighting (#11380) feat: add thrift hightlight (#11367) Use `try_lock` in `diff_handle` for Diff gutter (#11092) * Use `try_lock` in `diff_handle` for Diff gutter - Add the method `try_load() -> Option<Diff>` to `DiffHandle`, using `try_lock` to avoid deadlocks. - Use said method in `gutter.rs diff()`, which will use a blank `GutterFn` instead when met with a locked `Diff`. * Revert changes * Replace `Mutex` with `RwLock` in `Diff` --------- Co-authored-by: Kaniel Kirby <[email protected]> Update fsharp tree sitter repo reference (#11061) The repository reference used here was a fork from the actual repository, which has now been moved under ionide organization, where it is in active maintenance and development. The commit SHA is the currently latest commit from main branch. The injections.scm is copied as is from the fsharp treesitter repo [queries](https://github.com/ionide/tree-sitter-fsharp/blame/main/queries). The locals.scm is copied from the repo and the capture names are to follow the standard names: - Replace @local.definition.var @local.definition.function, and @local.definition.parameter with @local.definition - Remove (#set! "definition.function.scope" "parent") The highlights.scm is copied as well from the fsharp treesitter repo, but modified here to match helix highlight scopes based on my best guesstimates. The changes made: - Remove @spell scopes - Split @comment into @comment.line and @comment.block - Replace @comment.documentation with @comment.block.documentation - Replace @character.special with @special - Replace @variable.member with @variable.other.member - Replace @type.definition with @type - Replace @function.member with @function.method - Replace @module with @namespace - Replace @constant.macro with @function.macro - Replace @property with @variable.other.member - Replace @variable.member with @variable.other.member - Replace @variable.parameter.builtin with @variable.builtin - Replace @function.call with @function - Replace @number with @constant.numeric.integer and @constant.numeric.float - Replace @boolean with @constant.builtin.boolean - Replace @keyword.conditional with @keyword.control.conditional - Replace @keyword.return with @keyword.control.return - Replace @keyword.repeate with @keyword.control.repeat - Replace @keyword.import with @keyword.control.import - Replace @keyword.modifier with @keyword.storage.modifier - Replace @keyword.type with @keyword.storage.type - Replace @keyword.exception with @keyword.control.exception - Replace @module.builtin with @namespace Provide more details on runtime directory (#11026) * Provide more details on runtime directory * Improve pre-built binaries description Document completion menu bindings (#10994) * Update keymap.md * Update keymap.md * Update keymap.md Update languages.toml - add nixd, closes #10734 (#10767) feat: add iceberg light/dark themes (#10674) * feat: add iceberg light/dark themes * set ui.virtual and ui.virtual.ruler * quote ui.menu.selected key removed duplicate in lang-support MD file with vector dedup. (#10563) Parse and execute macro mappable commands Disallow macro keybindings within command sequences This is a temporary limitation because of the way that command sequences are executed. Each command is currently executed back-to-back synchronously, but macros are by design queued up for the compositor. So macros mixed into a command sequence will behave undesirably: they will be executed after the rest of the static and/or typable commands in the sequence. This is pending a larger refactor of how we handle commands. <https://redirect.github.com/helix-editor/helix/issues/5555> has further details and <https://redirect.github.com/helix-editor/helix/issues/4508> discusses a similar problem faced by the command palette. Add documentation for static/typable/macro commands keep (cursor) position when exactly replacing text (#5930) Whenever a document is changed helix maps various positions like the cursor or diagnostics through the `ChangeSet` applied to the document. Currently, this mapping handles replacements as follows: * Move position to the left for `Assoc::Before` (start of selection) * Move position to the right for `Assoc::After` (end of selection) However, when text is exactly replaced this can produce weird results where the cursor is moved when it shouldn't. For example if `foo` is selected and a separate cursor is placed on each character (`s.<ret>`) and the text is replaced (for example `rx`) then the cursors are moved to the side instead of remaining in place. This change adds a special case to the mapping code of replacements: If the deleted and inserted text have the same (char) length then the position is returned as if the replacement doesn't exist. only keep selections invariant under replacement Keeping selections unchanged if they are inside an exact replacement is intuitive. However, for diagnostics this is not desirable as helix would otherwise fail to remove diagnostics if replacing parts of the document. Add gherkin syntax highlighting (#11083) Co-authored-by: Blaž Hrastnik <[email protected]> refactor(commands): `trim_end` of `sh` output (#11161) build(deps): bump the rust-dependencies group with 4 updates (#11476) Bumps the rust-dependencies group with 4 updates: [serde](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), [tempfile](https://github.com/Stebalien/tempfile) and [cc](https://github.com/rust-lang/cc-rs). Updates `serde` from 1.0.204 to 1.0.207 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.204...v1.0.207) Updates `serde_json` from 1.0.122 to 1.0.124 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.122...v1.0.124) Updates `tempfile` from 3.11.0 to 3.12.0 - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/commits) Updates `cc` from 1.1.7 to 1.1.10 - [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.1.7...cc-v1.1.10) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies - dependency-name: cc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Update everforest themes (#11459) Highlight types and enum members in the rust prelude (#8535) * Add some rust builtins * rust queries: Add everything in the 2021 prelude * Update runtime/queries/rust/highlights.scm Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Michael Davis <[email protected]> Clarify lesson 10.1 wording (#11478) Co-authored-by: Per-gunnar Eriksson <[email protected]> Add/improve textobject queries (#11513) * Add textobject queries for YAML * Add textobject queries for SQL * Add textobject queries for HOCON * Add textobject queries for git-config * Add textobject queries for env * Add textobject queries for Dockerfile * Add textobject queries for docker-compose * Add textobject queries for prisma * Add entry textobject queries for hcl * Add entry textobject queries for Nix * Update docs copy shell completion to nix output (#11518) fix: ensure view is initiated for jump_* commands (#11529) Update gruvbox themes (#11477) build(deps): bump the rust-dependencies group with 7 updates (#11530) Bumps the rust-dependencies group with 7 updates: | Package | From | To | | --- | --- | --- | | [serde](https://github.com/serde-rs/serde) | `1.0.207` | `1.0.208` | | [serde_json](https://github.com/serde-rs/json) | `1.0.124` | `1.0.125` | | [tokio](https://github.com/tokio-rs/tokio) | `1.39.2` | `1.39.3` | | [libc](https://github.com/rust-lang/libc) | `0.2.155` | `0.2.158` | | [pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) | `0.11.0` | `0.12.0` | | [cc](https://github.com/rust-lang/cc-rs) | `1.1.10` | `1.1.13` | | [which](https://github.com/harryfei/which-rs) | `6.0.2` | `6.0.3` | Updates `serde` from 1.0.207 to 1.0.208 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.207...v1.0.208) Updates `serde_json` from 1.0.124 to 1.0.125 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.124...1.0.125) Updates `tokio` from 1.39.2 to 1.39.3 - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.39.2...tokio-1.39.3) Updates `libc` from 0.2.155 to 0.2.158 - [Release notes](https://github.com/rust-lang/libc/releases) - [Changelog](https://github.com/rust-lang/libc/blob/0.2.158/CHANGELOG.md) - [Commits](https://github.com/rust-lang/libc/compare/0.2.155...0.2.158) Updates `pulldown-cmark` from 0.11.0 to 0.12.0 - [Release notes](https://github.com/raphlinus/pulldown-cmark/releases) - [Commits](https://github.com/raphlinus/pulldown-cmark/compare/v0.11.0...v0.12.0) Updates `cc` from 1.1.10 to 1.1.13 - [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.1.10...cc-v1.1.13) Updates `which` from 6.0.2 to 6.0.3 - [Release notes](https://github.com/harryfei/which-rs/releases) - [Changelog](https://github.com/harryfei/which-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/harryfei/which-rs/compare/6.0.2...6.0.3) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: serde_json 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-patch dependency-group: rust-dependencies - dependency-name: libc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: pulldown-cmark dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies - dependency-name: cc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: which dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Add cshtml to html file-types (#11540) lsp: Gracefully ignore invalid diagnostic severity (#11569) build(deps): bump the rust-dependencies group with 4 updates (#11585) Bumps the rust-dependencies group with 4 updates: [serde](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), [cc](https://github.com/rust-lang/cc-rs) and [gix](https://github.com/Byron/gitoxide). Updates `serde` from 1.0.208 to 1.0.209 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.208...v1.0.209) Updates `serde_json` from 1.0.125 to 1.0.127 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/1.0.125...1.0.127) Updates `cc` from 1.1.13 to 1.1.15 - [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.1.13...cc-v1.1.15) Updates `gix` from 0.64.0 to 0.66.0 - [Release notes](https://github.com/Byron/gitoxide/releases) - [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md) - [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.64.0...gix-v0.66.0) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: cc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies - dependency-name: gix dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Change primary selection cursor color for naysayer (#11617) build(deps): bump the rust-dependencies group with 2 updates (#11622) Bumps the rust-dependencies group with 2 updates: [tokio](https://github.com/tokio-rs/tokio) and [rustix](https://github.com/bytecodealliance/rustix). Updates `tokio` from 1.39.3 to 1.40.0 - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.39.3...tokio-1.40.0) Updates `rustix` from 0.38.34 to 0.38.35 - [Release notes](https://github.com/bytecodealliance/rustix/releases) - [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.34...v0.38.35) --- updated-dependencies: - dependency-name: tokio dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-dependencies - dependency-name: rustix dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Supersedes #5008
This PR is a large rework of the core text positioning and rendering code to
remove the assumption that on-screen columns/lines correspond to text columns/
lines. This is required to implement both softwrap and virtual text.
Both of these features are included in this PR, so the original goals outlined
in #5008 can be achieved with this PR.
Implementation
This PR introduces generic
DocFormatter
that positions graphemes from varioussources. This formatter is used both for rendering and for movements/scrolling.
The design is heavily inspired by led, although I streamlined/adjusted some
Details as helix needs are different (especially with the introduction of
virtual text).
The basics of the softwrap implementation from #5008 mostly remains (so indent
carry over, and word splitting are supported) but rendering and positioning are
cleanly separated now and much of the architecture explained in #5008 is not
present anymore as I had to evolve the architecture for the positioning code.
The
DocFormatter
is still a single grapheme iterator (so more efficient)that transverses the entire document. However, it does not deal with syntax
highlighting or rendering at all. It's an iterator that is only concerned witch placing
graphemes from the document and virtual text at the correct position.
Note that the
DocFormatter
does not deal with the contents of line virtual textas that is easily handeled trough the new LineDecoration rendering mechansim.
The
DocFormatter
is constructed from an anchor char index which it backtracksto the last known line breaks. These "known" line breaks are called blocks and
were also described by @cessen in #136. Right now only normal line breaks are
considered as blocks, but the code is written so long lines can be chunked for
improved performance for files with very long text in the future.
I did not implement this logic in this PR as it's only an optimization and can be
implemented later as suggested by @cessen.
I added the functions
visual_offset_from_anchor
/visual_offset_from_block
and
char_idx_at_visual_offset
to theposition
module in helix corethat utilize the
DocFormatter
. These replacevisual_coords_at_pos
andpos_at_visual_cords
respectively. Their names are different to more accuratelyreflect their functions. The old functions have been replaced everywhere except
for the
align_selections
command. I am not sure if virtual text and softwrapshould affect selection alignment and refactoring this function was more
involved, so I left it untouched for now.
I have also updated the vertical movement command to be softwrap aware which
feels much more intuitive than the behavior in other editor like nvim. If there
is demand for vertical movements that ignore softwrap a separate command could
be added that simply sets
softwrap = false
in theTextFormat
before passingit to
move vertically
. Note that many commands (like goto_line_end) are not softwrapaware yet. I am not sure if that is desirable and therefore left it to future work.
The rendering code has been somewhat streamlined and moved to
document.rs
toallow reuse in other views as it had to be rewritten from to utilize
the new
DocFormatter
anyway.Future Work
challenging as the char range of a visual line is only known once rendered, but
the style needs to be applied before the line is rendered
enable sofwrap by default in the future once it had time to mature?