on master help sign in
248 files changed+12027−4313
since splitsnapshots
unifiedsplit
.envrc+1 .github/ISSUE_TEMPLATE/bug_report.yaml+10 .github/workflows/build.yml+15−7 .github/workflows/cachix.yml+3−3 .github/workflows/gh-pages.yml+5−5 .github/workflows/release.yml+13−13 CHANGELOG.md+260 Cargo.lock+538−609 Cargo.toml+14−1 README.md+1−1 VERSION−1 book/custom.css+1−1 book/src/configuration.md+27−9 book/src/generated/lang-support.md+28−11 book/src/generated/typable-cmd.md+4−1 book/src/guides/adding_languages.md+2 book/src/guides/indent.md+319−43 book/src/guides/injection.md+1−1 book/src/install.md+30−6 book/src/keymap.md+15−14 book/src/languages.md+3−1 book/src/themes.md+9−1 book/src/usage.md+2−2 book/theme/index.hbs+18−15 contrib/Helix.appdata.xml+15 contrib/Helix.desktop+3−1 docs/CONTRIBUTING.md+10−3 docs/releases.md+12−5 flake.lock+12−35 flake.nix+27−24 grammars.nix+24−21 helix-core/Cargo.toml+18−14 helix-core/src/diagnostic.rs+4 helix-core/src/fuzzy.rs+43 helix-core/src/graphemes.rs+1−1 helix-core/src/indent.rs+586−127 helix-core/src/lib.rs+1 helix-core/src/path.rs+2−2 helix-core/src/syntax.rs+24−8 helix-core/src/transaction.rs+73−14 helix-core/src/wrap.rs+3−1 helix-core/tests/data/indent/cpp.cpp+48 helix-core/tests/data/indent/indent.rs−1 helix-core/tests/data/indent/languages.toml+13 helix-core/tests/indent.rs+151−23 helix-dap/Cargo.toml+11−9 helix-event/Cargo.toml+16 helix-event/src/lib.rs+8 helix-event/src/redraw.rs+49 helix-loader/Cargo.toml+12−11 helix-loader/build.rs+14−4 helix-loader/src/lib.rs+13−4 helix-lsp/Cargo.toml+15−14 helix-lsp/src/client.rs+87−13 helix-lsp/src/lib.rs+32−28 helix-parsec/Cargo.toml+8−7 helix-term/Cargo.toml+30−25 helix-term/src/application.rs+111−75 helix-term/src/args.rs+29 helix-term/src/commands.rs+334−149 helix-term/src/commands/dap.rs+13−4 helix-term/src/commands/lsp.rs+12−2 helix-term/src/commands/typed.rs+872−663 helix-term/src/compositor.rs+12 helix-term/src/health.rs+44−16 helix-term/src/keymap.rs+14−14 helix-term/src/main.rs+17−1 helix-term/src/ui/completion.rs+17−1 helix-term/src/ui/document.rs+60−24 helix-term/src/ui/editor.rs+91−46 helix-term/src/ui/fuzzy_match.rs−239 helix-term/src/ui/fuzzy_match/test.rs−47 helix-term/src/ui/lsp.rs+3−1 helix-term/src/ui/markdown.rs+12−5 helix-term/src/ui/menu.rs+58−40 helix-term/src/ui/mod.rs+88−145 helix-term/src/ui/picker.rs+353−319 helix-term/src/ui/popup.rs+27−7 helix-term/tests/integration.rs+1−1 helix-term/tests/test/commands.rs+46 helix-term/tests/test/commands/write.rs+122−3 helix-term/tests/test/helpers.rs+9−1 helix-term/tests/test/languages/go.rs+41 helix-term/tests/test/languages/mod.rs+4 helix-term/tests/test/languages/yaml.rs+819 helix-term/tests/test/movement.rs+39 helix-term/tests/test/picker.rs−80 helix-term/tests/test/splits.rs+3−3 helix-tui/Cargo.toml+15−15 helix-tui/src/backend/crossterm.rs+51−33 helix-tui/src/buffer.rs+2−2 helix-tui/src/terminal.rs−14 helix-vcs/Cargo.toml+12−10 helix-vcs/src/diff.rs+6−19 helix-vcs/src/diff/worker.rs+3−9 helix-vcs/src/diff/worker/test.rs+1−5 helix-vcs/src/git.rs+5−5 helix-view/Cargo.toml+21−18 helix-view/src/clipboard.rs+7−2 helix-view/src/document.rs+72−40 helix-view/src/editor.rs+103−71 helix-view/src/gutter.rs+4−5 helix-view/src/handlers/dap.rs+1−3 helix-view/src/input.rs+65−1 helix-view/src/register.rs+12−10 helix-view/src/theme.rs+6 languages.toml+464−194 logo.svg+1−1 runtime/queries/_typescript/highlights.scm+5−3 runtime/queries/_typescript/locals.scm+17 runtime/queries/agda/highlights.scm+124 runtime/queries/bash/indents.scm+1 runtime/queries/blueprint/highlights.scm+5 runtime/queries/c/indents.scm+18−1 runtime/queries/comment/highlights.scm+8−8 runtime/queries/common-lisp/indents.scm+1 runtime/queries/dart/highlights.scm+3−1 runtime/queries/dbml/highlights.scm+44 runtime/queries/fsharp/locals.scm+25 runtime/queries/gas/highlights.scm+21 runtime/queries/gas/injections.scm+2 runtime/queries/gas/textobjects.scm+2 runtime/queries/gemini/highlights.scm+26 runtime/queries/gleam/highlights.scm+16−5 runtime/queries/gn/highlights.scm+42 runtime/queries/gn/injections.scm+15 runtime/queries/gn/locals.scm+16 runtime/queries/go/highlights.scm+13−5 runtime/queries/go/locals.scm+10−2 runtime/queries/haskell/highlights.scm+24−11 runtime/queries/janet/highlights.scm+1 runtime/queries/jinja/highlights.scm+7 runtime/queries/jinja/injections.scm+4 runtime/queries/json5/highlights.scm+11 runtime/queries/kdl/highlights.scm+4−4 runtime/queries/kdl/indents.scm+3 runtime/queries/kdl/textobjects.scm+27 runtime/queries/kotlin/highlights.scm+4−1 runtime/queries/kotlin/locals.scm+15 runtime/queries/log/highlights.scm+10 runtime/queries/lpf/highlights.scm+19 runtime/queries/markdown.inline/injections.scm+4−1 runtime/queries/nix/injections.scm+14 runtime/queries/nu/folds.scm−4 runtime/queries/nu/highlights.scm+276−44 runtime/queries/nu/injections.scm+1−1 runtime/queries/nu/locals.scm−13 runtime/queries/nunjucks/highlights.scm+1 runtime/queries/nunjucks/injections.scm+1 runtime/queries/ocaml/highlights.scm+2 runtime/queries/perl/highlights.scm−2 runtime/queries/perl/indents.scm+29 runtime/queries/perl/injections.scm+2 runtime/queries/perl/textobjects.scm+14 runtime/queries/pod/highlights.scm+61 runtime/queries/purescript/highlights.scm+164−1 runtime/queries/purescript/injections.scm+2−1 runtime/queries/purescript/locals.scm+4−1 runtime/queries/purescript/textobjects.scm+13 runtime/queries/python/highlights.scm+6 runtime/queries/python/indents.scm+9 runtime/queries/racket/indents.scm+1 runtime/queries/robot/highlights.scm+51−13 runtime/queries/ron/highlights.scm+43−1 runtime/queries/ron/indents.scm+12−1 runtime/queries/ron/injections.scm+2−1 runtime/queries/rust/highlights.scm+7 runtime/queries/rust/indents.scm+69−2 runtime/queries/rust/injections.scm+6 runtime/queries/rust/locals.scm+14−1 runtime/queries/rust/textobjects.scm+4−1 runtime/queries/scheme/highlights.scm+5 runtime/queries/scheme/indents.scm+43 runtime/queries/slint/highlights.scm+118−72 runtime/queries/slint/indents.scm+6−5 runtime/queries/slint/injections.scm+2 runtime/queries/slint/locals.scm+1−1 runtime/queries/smali/folds.scm+12 runtime/queries/smali/highlights.scm+216 runtime/queries/smali/indents.scm+31 runtime/queries/smali/injections.scm+2 runtime/queries/smali/locals.scm+42 runtime/queries/sql/highlights.scm+317−231 runtime/queries/strace/highlights.scm+8 runtime/queries/templ/highlights.scm+99 runtime/queries/templ/injections.scm+4 runtime/queries/todotxt/highlights.scm+6 runtime/queries/typst/highlights.scm+77 runtime/queries/typst/injections.scm+6 runtime/queries/unison/highlights.scm+21−6 runtime/queries/yaml/indents.scm+35−1 runtime/queries/yaml/injections.scm+52 runtime/queries/yuck/highlights.scm+1−1 runtime/themes/README.md+8 runtime/themes/autumn.toml+62−65 runtime/themes/autumn_night.toml+6−6 runtime/themes/catppuccin_frappe.toml+2 runtime/themes/catppuccin_latte.toml+2 runtime/themes/catppuccin_macchiato.toml+2 runtime/themes/catppuccin_mocha.toml+11 runtime/themes/cyan_light.toml+154 runtime/themes/darcula-solid.toml+1−4 runtime/themes/darcula.toml+10−4 runtime/themes/dracula.toml+2 runtime/themes/everblush.toml+1 runtime/themes/gruber-darker.toml+114 runtime/themes/horizon-dark.toml+80 runtime/themes/jellybeans.toml+1−1 runtime/themes/licenses/everforest.LICENSE+21 runtime/themes/licenses/modus_vivendi.LICENSE+5 runtime/themes/licenses/modus_vivendi_deuteranopia.LICENSE+5 runtime/themes/licenses/modus_vivendi_tinted.LICENSE+5 runtime/themes/licenses/modus_vivendi_tritanopia.LICENSE+5 runtime/themes/licenses/poimandres.LICENSE+21 runtime/themes/licenses/serika-syntax.LICENSE+21 runtime/themes/licenses/sonokai.LICENSE+21 runtime/themes/licenses/starlight.LICENSE+24 runtime/themes/material_darker.toml+20 runtime/themes/material_deep_ocean.toml+123 runtime/themes/material_oceanic.toml+21 runtime/themes/material_palenight.toml+19 runtime/themes/modus_operandi.toml+194 runtime/themes/modus_operandi_deuteranopia.toml+46 runtime/themes/modus_operandi_tinted.toml+45 runtime/themes/modus_operandi_tritanopia.toml+73 runtime/themes/modus_vivendi.toml+242 runtime/themes/modus_vivendi_deuteranopia.toml+158 runtime/themes/modus_vivendi_tinted.toml+144 runtime/themes/modus_vivendi_tritanopia.toml+186 runtime/themes/molokai.toml+1−1 runtime/themes/monokai.toml+5 runtime/themes/naysayer.toml+2−2 runtime/themes/nightfox.toml+2−2 runtime/themes/noctis.toml+26−26 runtime/themes/nord-night.toml+23 runtime/themes/nord.toml+23−13 runtime/themes/onedark.toml+1 runtime/themes/papercolor-dark.toml+67−116 runtime/themes/papercolor-light.toml+194−103 runtime/themes/poimandres.toml+113 runtime/themes/poimandres_storm.toml+19 runtime/themes/rose_pine.toml+31−29 runtime/themes/starlight.toml+113 runtime/themes/yellowed.toml+135 runtime/themes/zenburn.toml+1−1 runtime/tutor+157−3 rust-toolchain.toml+2−2 xtask/Cargo.toml+12−6
.envrc+1
@@ -1,5 +1,6 @@
11watch_file shell.nix
22watch_file flake.lock
3+watch_file rust-toolchain.toml
34
45# try to use flakes, if it fails use normal nix (ie. shell.nix)
56use flake || use nix
.github/ISSUE_TEMPLATE/bug_report.yaml+10
@@ -55,6 +55,16 @@ body:
5555 placeholder: wezterm 20220101-133340-7edc5b5a
5656 validations:
5757 required: true
58+ - type: input
59+ id: installation-method
60+ attributes:
61+ label: Installation Method
62+ description: >
63+ How you installed Helix - from a package manager like Homebrew or the
64+ AUR, built from source, downloaded a binary from the releases page, etc.
65+ placeholder: "source / brew / nixpkgs / flake / releases page"
66+ validations:
67+ required: true
5868 - type: input
5969 id: helix-version
6070 attributes:
.github/workflows/build.yml+15−7
@@ -14,7 +14,7 @@ jobs:
1414 runs-on: ubuntu-latest
1515 steps:
1616 - name: Checkout sources
17− uses: actions/checkout@v3
17+ uses: actions/checkout@v4
1818 - name: Install stable toolchain
1919 uses: helix-editor/rust-toolchain@v1
2020 with:
@@ -22,6 +22,8 @@ jobs:
2222 override: true
2323
2424 - uses: Swatinem/rust-cache@v2
25+ with:
26+ shared-key: "build"
2527
2628 - name: Run cargo check
2729 run: cargo check
@@ -34,12 +36,14 @@ jobs:
3436 HELIX_LOG_LEVEL: info
3537 steps:
3638 - name: Checkout sources
37− uses: actions/checkout@v3
39+ uses: actions/checkout@v4
3840
3941 - name: Install stable toolchain
40− uses: dtolnay/rust-toolchain@1.65
42+ uses: dtolnay/rust-toolchain@1.70
4143
4244 - uses: Swatinem/rust-cache@v2
45+ with:
46+ shared-key: "build"
4347
4448 - name: Cache test tree-sitter grammar
4549 uses: actions/cache@v3
@@ -63,14 +67,16 @@ jobs:
6367 runs-on: ubuntu-latest
6468 steps:
6569 - name: Checkout sources
66− uses: actions/checkout@v3
70+ uses: actions/checkout@v4
6771
6872 - name: Install stable toolchain
69− uses: dtolnay/rust-toolchain@1.65
73+ uses: dtolnay/rust-toolchain@1.70
7074 with:
7175 components: rustfmt, clippy
7276
7377 - uses: Swatinem/rust-cache@v2
78+ with:
79+ shared-key: "build"
7480
7581 - name: Run cargo fmt
7682 run: cargo fmt --all --check
@@ -88,12 +94,14 @@ jobs:
8894 runs-on: ubuntu-latest
8995 steps:
9096 - name: Checkout sources
91− uses: actions/checkout@v3
97+ uses: actions/checkout@v4
9298
9399 - name: Install stable toolchain
94− uses: dtolnay/rust-toolchain@1.65
100+ uses: dtolnay/rust-toolchain@1.70
95101
96102 - uses: Swatinem/rust-cache@v2
103+ with:
104+ shared-key: "build"
97105
98106 - name: Validate queries
99107 run: cargo xtask query-check
.github/workflows/cachix.yml+3−3
@@ -11,13 +11,13 @@ jobs:
1111 runs-on: ubuntu-latest
1212 steps:
1313 - name: Checkout sources
14− uses: actions/checkout@v3
14+ uses: actions/checkout@v4
1515
1616 - name: Install nix
17− uses: cachix/install-nix-action@v22
17+ uses: cachix/install-nix-action@v24
1818
1919 - name: Authenticate with Cachix
20− uses: cachix/cachix-action@v12
20+ uses: cachix/cachix-action@v13
2121 with:
2222 name: helix
2323 authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
.github/workflows/gh-pages.yml+5−5
@@ -11,7 +11,7 @@ jobs:
1111 deploy:
1212 runs-on: ubuntu-latest
1313 steps:
14− - uses: actions/checkout@v3
14+ - uses: actions/checkout@v4
1515
1616 - name: Setup mdBook
1717 uses: peaceiris/actions-mdbook@v1
@@ -26,16 +26,16 @@ jobs:
2626 OUTDIR=$(basename ${{ github.ref }})
2727 echo "OUTDIR=$OUTDIR" >> $GITHUB_ENV
2828
29− - name: Deploy
29+ - name: Deploy stable
3030 uses: peaceiris/actions-gh-pages@v3
31+ if: startswith(github.ref, 'refs/tags/')
3132 with:
3233 github_token: ${{ secrets.GITHUB_TOKEN }}
3334 publish_dir: ./book/book
34− destination_dir: ./${{ env.OUTDIR }}
3535
36− - name: Deploy stable
36+ - name: Deploy
3737 uses: peaceiris/actions-gh-pages@v3
38− if: startswith(github.ref, 'refs/tags/')
3938 with:
4039 github_token: ${{ secrets.GITHUB_TOKEN }}
4140 publish_dir: ./book/book
41+ destination_dir: ./${{ env.OUTDIR }}
.github/workflows/release.yml+13−13
@@ -23,7 +23,7 @@ jobs:
2323 runs-on: ubuntu-latest
2424 steps:
2525 - name: Checkout sources
26− uses: actions/checkout@v3
26+ uses: actions/checkout@v4
2727
2828 - name: Install stable toolchain
2929 uses: dtolnay/rust-toolchain@stable
@@ -36,7 +36,7 @@ jobs:
3636 - name: Bundle grammars
3737 run: tar cJf grammars.tar.xz -C runtime/grammars/sources .
3838
39− - uses: actions/upload-artifact@v3
39+ - uses: actions/upload-artifact@v4
4040 with:
4141 name: grammars
4242 path: grammars.tar.xz
@@ -70,11 +70,11 @@ jobs:
7070 rust: stable
7171 target: aarch64-unknown-linux-gnu
7272 cross: true
73− - build: riscv64-linux
74− os: ubuntu-latest
75− rust: stable
76− target: riscv64gc-unknown-linux-gnu
77− cross: true
73+ # - build: riscv64-linux
74+ # os: ubuntu-latest
75+ # rust: stable
76+ # target: riscv64gc-unknown-linux-gnu
77+ # cross: true
7878 - build: x86_64-macos
7979 os: macos-latest
8080 rust: stable
@@ -103,10 +103,10 @@ jobs:
103103
104104 steps:
105105 - name: Checkout sources
106− uses: actions/checkout@v3
106+ uses: actions/checkout@v4
107107
108108 - name: Download grammars
109− uses: actions/download-artifact@v3
109+ uses: actions/download-artifact@v4
110110
111111 - name: Move grammars under runtime
112112 if: "!startsWith(matrix.os, 'windows')"
@@ -220,7 +220,7 @@ jobs:
220220 fi
221221 cp -r runtime dist
222222
223− - uses: actions/upload-artifact@v3
223+ - uses: actions/upload-artifact@v4
224224 with:
225225 name: bins-${{ matrix.build }}
226226 path: dist
@@ -231,9 +231,9 @@ jobs:
231231 runs-on: ubuntu-latest
232232 steps:
233233 - name: Checkout sources
234− uses: actions/checkout@v3
234+ uses: actions/checkout@v4
235235
236− - uses: actions/download-artifact@v3
236+ - uses: actions/download-artifact@v4
237237
238238 - name: Build archive
239239 shell: bash
@@ -288,7 +288,7 @@ jobs:
288288 overwrite: true
289289
290290 - name: Upload binaries as artifact
291− uses: actions/upload-artifact@v3
291+ uses: actions/upload-artifact@v4
292292 if: env.preview == 'true'
293293 with:
294294 name: release
CHANGELOG.md+260
@@ -1,3 +1,263 @@
1+# 23.10 (2023-10-24)
2+
3+A big shout out to all the contributors! We had 118 contributors in this release.
4+
5+Breaking changes:
6+
7+- Support multiple language servers per language ([#2507](https://github.com/helix-editor/helix/pull/2507))
8+ - This is a breaking change to language configuration
9+
10+Features:
11+
12+- Support multiple language servers per language ([#2507](https://github.com/helix-editor/helix/pull/2507), [#7082](https://github.com/helix-editor/helix/pull/7082), [#7286](https://github.com/helix-editor/helix/pull/7286), [#8374](https://github.com/helix-editor/helix/pull/8374))
13+- Add a statusline element for the selected register ([#7222](https://github.com/helix-editor/helix/pull/7222))
14+- Add `%`, `#`, `.`, `*` and `+` special registers ([#6985](https://github.com/helix-editor/helix/pull/6985))
15+- Add initial support for LSP DidChangeWatchedFiles notifications ([#7665](https://github.com/helix-editor/helix/pull/7665))
16+- Search buffer contents in `global_search` ([#5652](https://github.com/helix-editor/helix/pull/5652))
17+- Add a "smart tab" command that intelligently jumps the cursor on tab ([#4443](https://github.com/helix-editor/helix/pull/4443))
18+- Add a statusline element for whether a file is read-only ([#7222](https://github.com/helix-editor/helix/pull/7222), [#7875](https://github.com/helix-editor/helix/pull/7875))
19+- Syntax highlight regex prompts ([#7738](https://github.com/helix-editor/helix/pull/7738))
20+- Allow defining alignment in indent queries ([#5355](https://github.com/helix-editor/helix/pull/5355))
21+- Show visual feedback in `surround_replace` ([#7588](https://github.com/helix-editor/helix/pull/7588))
22+- Switch to Nucleo for fuzzy matching ([#7814](https://github.com/helix-editor/helix/pull/7814), [#8148](https://github.com/helix-editor/helix/pull/8148), [#8192](https://github.com/helix-editor/helix/pull/8192), [#8194](https://github.com/helix-editor/helix/pull/8194))
23+- Insert a trailing newline on write ([#8157](https://github.com/helix-editor/helix/pull/8157))
24+- Add a `-w`/`--working-dir` CLI flag for specifying a working directory on startup ([#8223](https://github.com/helix-editor/helix/pull/8223), [#8498](https://github.com/helix-editor/helix/pull/8498), [#8520](https://github.com/helix-editor/helix/pull/8520))
25+- Accept a `+N` CLI argument to set the first file's line number ([#8521](https://github.com/helix-editor/helix/pull/8521))
26+- Accept Helix-specific ignore files in `.helix/ignore` and `~/.config/helix/ignore` ([#8099](https://github.com/helix-editor/helix/pull/8099))
27+
28+Commands:
29+
30+- `merge_selections` (`A-minus`) - merge all selections into one selection that covers all ranges ([#7053](https://github.com/helix-editor/helix/pull/7053))
31+- `move_prev_long_word_end` and `extend_prev_long_word_end` - move/extend to the end of the previous WORD ([#6905](https://github.com/helix-editor/helix/pull/6905))
32+- `reverse_selection_contents` - swaps the values of each selection so they are reversed ([#7329](https://github.com/helix-editor/helix/pull/7329))
33+- Add `:rl` and `:rla` aliases for `:reload` and `:reload-all` ([#7158](https://github.com/helix-editor/helix/pull/7158))
34+- `yank_joined` - join the selections and yank to the selected register ([#7195](https://github.com/helix-editor/helix/pull/7195))
35+- `:write-all!` (`:wa!`) - forcibly write all buffers to disk and create any necessary subdirectories ([#7577](https://github.com/helix-editor/helix/pull/7577))
36+- `:redraw` - clear re-render the UI ([#6949](https://github.com/helix-editor/helix/pull/6949))
37+- `:tree-sitter-highlight-name` - show the theme scope name of the highlight under the cursor ([#8170](https://github.com/helix-editor/helix/pull/8170))
38+
39+Usability improvements:
40+
41+- Allow cycling option values at runtime ([#4411](https://github.com/helix-editor/helix/pull/4411), [#7240](https://github.com/helix-editor/helix/pull/7240), [#7877](https://github.com/helix-editor/helix/pull/7877))
42+- Exit gracefully on termination signals ([#7236](https://github.com/helix-editor/helix/pull/7236))
43+- Add plaintext matching fallback to tree-sitter pair matching ([#4288](https://github.com/helix-editor/helix/pull/4288))
44+- Persist register selection in pending keymaps ([0e08349](https://github.com/helix-editor/helix/commit/0e08349))
45+- Propagate the count and register to command palette commands ([b394997](https://github.com/helix-editor/helix/commit/b394997))
46+- Auto indent on `insert_at_line_start` ([#5837](https://github.com/helix-editor/helix/pull/5837))
47+- Add a config option to control whether LSP completions are automatically inserted on preview ([#7189](https://github.com/helix-editor/helix/pull/7189))
48+- Add a config option for default line endings ([#5621](https://github.com/helix-editor/helix/pull/5621), [#7357](https://github.com/helix-editor/helix/pull/7357))
49+- Allow ANSI colors in themes ([#5119](https://github.com/helix-editor/helix/pull/5119))
50+- Match pairs that don't form a standalone tree-sitter node ([#7242](https://github.com/helix-editor/helix/pull/7242))
51+- Allow indent sizes of up to 16 columns ([#7429](https://github.com/helix-editor/helix/pull/7429))
52+- Improve performance of mapping positions through changes ([#7408](https://github.com/helix-editor/helix/pull/7408), [8d39a81](https://github.com/helix-editor/helix/commit/8d39a81), [#7471](https://github.com/helix-editor/helix/pull/7471))
53+- Mark buffers created from stdin as modified ([#7431](https://github.com/helix-editor/helix/pull/7431))
54+- Forcibly shut down uninitialized language servers ([#7449](https://github.com/helix-editor/helix/pull/7449))
55+- Add filename completer for shell prompts ([#7569](https://github.com/helix-editor/helix/pull/7569))
56+- Allow binding F13-F24 ([#7672](https://github.com/helix-editor/helix/pull/7672))
57+- Resolve LSP code actions ([#7677](https://github.com/helix-editor/helix/pull/7677), [#8421](https://github.com/helix-editor/helix/pull/8421))
58+- Save an undo checkpoint before accepting completions ([#7747](https://github.com/helix-editor/helix/pull/7747))
59+- Include gitignored files in debugger completions ([#7936](https://github.com/helix-editor/helix/pull/7936))
60+- Make editor remember the last search register ([#5244](https://github.com/helix-editor/helix/pull/5244))
61+- Open directories with `goto_file` ([#7909](https://github.com/helix-editor/helix/pull/7909))
62+- Use relative path to open buffer in `goto_file` (`gf`) ([#7965](https://github.com/helix-editor/helix/pull/7965))
63+- Support `default` color in themes ([#8083](https://github.com/helix-editor/helix/pull/8083), [#8114](https://github.com/helix-editor/helix/pull/8114))
64+- Toggle between relative and absolute line numbers when the terminal loses focus ([#7955](https://github.com/helix-editor/helix/pull/7955))
65+- Lower default idle-timeout to 250ms ([060e73a](https://github.com/helix-editor/helix/commit/060e73a))
66+- Allow theming diff gutters separately from other diff colors ([#8343](https://github.com/helix-editor/helix/pull/8343))
67+- Style bold/italic/strikethrough in markdown doc popups ([#8385](https://github.com/helix-editor/helix/pull/8385))
68+- Maintain the cursor position and view when splitting with `:hsplit`/`:vsplit` ([#8109](https://github.com/helix-editor/helix/pull/8109))
69+- Accept `-` in macros outside of `<`/`>` ([#8475](https://github.com/helix-editor/helix/pull/8475))
70+- Show all language servers for each language in `--health` ([#7315](https://github.com/helix-editor/helix/pull/7315))
71+- Don't break on hyphens in `:reflow` ([#8569](https://github.com/helix-editor/helix/pull/8569))
72+
73+Fixes:
74+
75+- Update diagnostics correctly on language server exit ([#7111](https://github.com/helix-editor/helix/pull/7111))
76+- Fix off-by-one in `select_references_to_symbol_under_cursor` ([#7132](https://github.com/helix-editor/helix/pull/7132))
77+- Extend selection with repeat-last-motion only if the original motion extended the selection ([#7159](https://github.com/helix-editor/helix/pull/7159))
78+- Fix undefined behavior in the diff gutter ([#7227](https://github.com/helix-editor/helix/pull/7227))
79+- Check that tab width is non-zero ([#7178](https://github.com/helix-editor/helix/pull/7178))
80+- Fix styles being overwritten in table rows with multiple cells ([#7281](https://github.com/helix-editor/helix/pull/7281))
81+- Add file for `--log` CLI arg in help text ([#7307](https://github.com/helix-editor/helix/pull/7307))
82+- Fix underflow when repeating a completion that has a negative shift position ([#7322](https://github.com/helix-editor/helix/pull/7322))
83+- Prefer longer matches in `select_next_sibling` and `select_prev_sibling` ([#7332](https://github.com/helix-editor/helix/pull/7332))
84+- Preview scratch buffers in the jumplist picker ([#7331](https://github.com/helix-editor/helix/pull/7331))
85+- Fix chunking by bytes in tree-sitter parsing ([#7417](https://github.com/helix-editor/helix/pull/7417))
86+- Discard LSP publishDiagnostic from uninitialized servers ([#7467](https://github.com/helix-editor/helix/pull/7467))
87+- Use negotiated position encoding for LSP workspace edits ([#7469](https://github.com/helix-editor/helix/pull/7469))
88+- Fix error message for unknown gutter types in config ([#7534](https://github.com/helix-editor/helix/pull/7534))
89+- Fix `:log-open` when `--log` CLI arg is specified ([#7573](https://github.com/helix-editor/helix/pull/7573), [#7585](https://github.com/helix-editor/helix/pull/7585))
90+- Fix debouncing of LSP messages to fix the last message sticking around ([#7538](https://github.com/helix-editor/helix/pull/7538), [#8023](https://github.com/helix-editor/helix/pull/8023))
91+- Fix crash when the current working directory is deleted ([#7185](https://github.com/helix-editor/helix/pull/7185))
92+- Fix piping to Helix on macOS ([#5468](https://github.com/helix-editor/helix/pull/5468))
93+- Fix crash when parsing overlapping injections ([#7621](https://github.com/helix-editor/helix/pull/7621))
94+- Clear the statusline when the prompt is visible ([#7646](https://github.com/helix-editor/helix/pull/7646))
95+- Fix range formatting error message typo ([#7823](https://github.com/helix-editor/helix/pull/7823))
96+- Skip rendering gutters when gutter width exceeds view width ([#7821](https://github.com/helix-editor/helix/pull/7821))
97+- Center the picker preview using visual lines ([#7837](https://github.com/helix-editor/helix/pull/7837))
98+- Align view correctly for background buffers opened with `A-ret` ([#7691](https://github.com/helix-editor/helix/pull/7691))
99+- Fix cursor resetting to block when quitting via a keybind ([#7931](https://github.com/helix-editor/helix/pull/7931))
100+- Remove path completions for the `:new` command ([#8010](https://github.com/helix-editor/helix/pull/8010))
101+- Use binary path resolved by `which` for formatter commands ([#8064](https://github.com/helix-editor/helix/pull/8064))
102+- Handle crossterm's `hidden` modifier ([#8120](https://github.com/helix-editor/helix/pull/8120))
103+- Clear completion when switching between windows with the mouse ([#8118](https://github.com/helix-editor/helix/pull/8118))
104+- Eagerly remove the last picker (`<space>'`) when the picker has many items ([#8127](https://github.com/helix-editor/helix/pull/8127))
105+- Fix find commands for buffers with non-LF line-endings ([#8111](https://github.com/helix-editor/helix/pull/8111))
106+- Detect the tmux clipboard provider on macOS ([#8182](https://github.com/helix-editor/helix/pull/8182))
107+- Fix syntax highlighting in dynamic picker preview pane ([#8206](https://github.com/helix-editor/helix/pull/8206))
108+- Recognize HTML code tags with attributes as code in markdown previews ([#8397](https://github.com/helix-editor/helix/pull/8397))
109+- Fix multicursor snippet placeholder directions ([#8423](https://github.com/helix-editor/helix/pull/8423))
110+- Only show diagnostic highlights when diagnostics are enabled for a language server ([#8551](https://github.com/helix-editor/helix/pull/8551))
111+
112+Themes:
113+
114+- Improve the selection color in `ferra` ([#7138](https://github.com/helix-editor/helix/pull/7138))
115+- Add `variable.other.member` theming to `spacebones_light` ([#7125](https://github.com/helix-editor/helix/pull/7125))
116+- Update `autumn` and theme the soft-wrap indicator ([#7229](https://github.com/helix-editor/helix/pull/7229))
117+- Add `gruvbox_dark_soft` ([#7139](https://github.com/helix-editor/helix/pull/7139))
118+- Add `merionette` ([#7186](https://github.com/helix-editor/helix/pull/7186))
119+- Add `zed_onedark` and `zed_onelight` ([#7250](https://github.com/helix-editor/helix/pull/7250))
120+- Use light-gray for `onedarker` inlay hint theming ([#7433](https://github.com/helix-editor/helix/pull/7433))
121+- Update the Nord theme to follow the style guidelines ([#7490](https://github.com/helix-editor/helix/pull/7490))
122+- Tune `dark_plus` inlay hint colors ([#7611](https://github.com/helix-editor/helix/pull/7611))
123+- Add `naysayer` ([#7570](https://github.com/helix-editor/helix/pull/7570))
124+- Add `kaolin-dark`, `kaolin-light` and `kaolin-valley-dark` ([#7151](https://github.com/helix-editor/helix/pull/7151))
125+- Fix selection highlighting in gruvbox variants ([#7717](https://github.com/helix-editor/helix/pull/7717))
126+- Add soft-wrap indicator to `gruvbox` ([#7736](https://github.com/helix-editor/helix/pull/7736))
127+- Add missing palette definitions in `everforest_dark` ([#7739](https://github.com/helix-editor/helix/pull/7739))
128+- Increase diagnostics clarity in `pop-dark` ([#7702](https://github.com/helix-editor/helix/pull/7702))
129+- Add `vim_dark_high_contrast` ([#7785](https://github.com/helix-editor/helix/pull/7785))
130+- Add `new_moon` ([#7834](https://github.com/helix-editor/helix/pull/7834))
131+- Add `yellowed` ([#7849](https://github.com/helix-editor/helix/pull/7849))
132+- Improve comment readability for `autumn` ([#7939](https://github.com/helix-editor/helix/pull/7939))
133+- Distinguish active bufferline buffer in `monokai` ([#7983](https://github.com/helix-editor/helix/pull/7983))
134+- Update ruler colors in `nord` ([#7995](https://github.com/helix-editor/helix/pull/7995))
135+- Update Catppuccin themes ([#8102](https://github.com/helix-editor/helix/pull/8102))
136+- Add text focus scope and diagnostics undercurls for `nord` ([#8165](https://github.com/helix-editor/helix/pull/8165))
137+- Add material theme collection ([#8211](https://github.com/helix-editor/helix/pull/8211))
138+- Improve indent line color in `dracula` ([#8266](https://github.com/helix-editor/helix/pull/8266))
139+- Clean up and refactor `papercolor` to use inheritance ([#8276](https://github.com/helix-editor/helix/pull/8276))
140+- Fix `zenburn` inlay hint color ([#8278](https://github.com/helix-editor/helix/pull/8278)a)
141+- Fix picker crash when previewing an invalid range ([e9d0bd7](https://github.com/helix-editor/helix/commit/e9d0bd7))
142+- Correctly center items in the picker preview ([13d4463](https://github.com/helix-editor/helix/commit/13d4463))
143+- Add `cyan_light` ([#8293](https://github.com/helix-editor/helix/pull/8293), [#8587](https://github.com/helix-editor/helix/pull/8587))
144+- Theme HTML tags in `onedark` ([#8409](https://github.com/helix-editor/helix/pull/8409))
145+- Refine `darcula` and `darcula-solid` themes ([#8412](https://github.com/helix-editor/helix/pull/8412))
146+- Improve `nord` highlights ([#8414](https://github.com/helix-editor/helix/pull/8414))
147+- Add `nord-night` ([#8549](https://github.com/helix-editor/helix/pull/8549))
148+
149+New languages:
150+
151+- Blueprint ([#7213](https://github.com/helix-editor/helix/pull/7213), [#8161](https://github.com/helix-editor/helix/pull/8161))
152+- Forth ([#7256](https://github.com/helix-editor/helix/pull/7256), [#7334](https://github.com/helix-editor/helix/pull/7334))
153+- t32 ([#7140](https://github.com/helix-editor/helix/pull/7140), [#7811](https://github.com/helix-editor/helix/pull/7811))
154+- WebC ([#7290](https://github.com/helix-editor/helix/pull/7290))
155+- Persistent DSL for Haskell ([#7261](https://github.com/helix-editor/helix/pull/7261))
156+- F# ([#7619](https://github.com/helix-editor/helix/pull/7619), [#8024](https://github.com/helix-editor/helix/pull/8024))
157+- Wren ([#7765](https://github.com/helix-editor/helix/pull/7765), [#7819](https://github.com/helix-editor/helix/pull/7819))
158+- Unison ([#7724](https://github.com/helix-editor/helix/pull/7724))
159+- Todo.txt ([#7835](https://github.com/helix-editor/helix/pull/7835))
160+- Jinja and Handlebars ([#7233](https://github.com/helix-editor/helix/pull/7233))
161+- Pod ([#7907](https://github.com/helix-editor/helix/pull/7907))
162+- Strace ([#7928](https://github.com/helix-editor/helix/pull/7928))
163+- Gemini ([#8070](https://github.com/helix-editor/helix/pull/8070))
164+- GNU Assembler (GAS) ([#8291](https://github.com/helix-editor/helix/pull/8291))
165+- JSON5 ([#8473](https://github.com/helix-editor/helix/pull/8473))
166+- TEMPL ([#8540](https://github.com/helix-editor/helix/pull/8540))
167+
168+Updated languages and queries:
169+
170+- Add one to the ruler numbers for git-commit ([#7072](https://github.com/helix-editor/helix/pull/7072))
171+- Recognize XAML files as XML ([#7083](https://github.com/helix-editor/helix/pull/7083))
172+- Recognize `Cargo.lock` as TOML ([#7095](https://github.com/helix-editor/helix/pull/7095))
173+- Use Rust grammar for Cairo ([c6d1430](https://github.com/helix-editor/helix/commit/c6d1430))
174+- Update tree-sitter-nickel ([#7059](https://github.com/helix-editor/helix/pull/7059), [#7551](https://github.com/helix-editor/helix/pull/7551))
175+- Tune auto-pair characters for Nickel ([#7059](https://github.com/helix-editor/helix/pull/7059))
176+- Recognize `Vagrantfile` as Ruby ([#7112](https://github.com/helix-editor/helix/pull/7112))
177+- Recognize hidden justfiles as Just ([#7088](https://github.com/helix-editor/helix/pull/7088))
178+- Update Java and TypeScript highlight queries ([#7145](https://github.com/helix-editor/helix/pull/7145))
179+- Recognize `.zimrc` as Bash ([#7146](https://github.com/helix-editor/helix/pull/7146))
180+- Recognize `.gir` as XML ([#7152](https://github.com/helix-editor/helix/pull/7152))
181+- Update tree-sitter-scala ([#7147](https://github.com/helix-editor/helix/pull/7147))
182+- Recognize make file-type as Makefile ([#7212](https://github.com/helix-editor/helix/pull/7212))
183+- Update tree-sitter-verilog ([#7262](https://github.com/helix-editor/helix/pull/7262))
184+- Update tree-sitter-cpp ([#7285](https://github.com/helix-editor/helix/pull/7285))
185+- Support core mode for delve debugger ([#7300](https://github.com/helix-editor/helix/pull/7300))
186+- Add Fortran comment injections ([#7305](https://github.com/helix-editor/helix/pull/7305))
187+- Switch Vue language server to `vue-language-server` ([#7312](https://github.com/helix-editor/helix/pull/7312))
188+- Update tree-sitter-sql ([#7387](https://github.com/helix-editor/helix/pull/7387), [#8464](https://github.com/helix-editor/helix/pull/8464))
189+- Replace the MATLAB tre-sitter grammar ([#7388](https://github.com/helix-editor/helix/pull/7388), [#7442](https://github.com/helix-editor/helix/pull/7442), [#7491](https://github.com/helix-editor/helix/pull/7491), [#7493](https://github.com/helix-editor/helix/pull/7493), [#7511](https://github.com/helix-editor/helix/pull/7511), [#7532](https://github.com/helix-editor/helix/pull/7532), [#8040](https://github.com/helix-editor/helix/pull/8040))
190+- Highlight TOML table headers ([#7441](https://github.com/helix-editor/helix/pull/7441))
191+- Recognize `cppm` file-type as C++ ([#7492](https://github.com/helix-editor/helix/pull/7492))
192+- Refactor ecma language queries into private and public queries ([#7207](https://github.com/helix-editor/helix/pull/7207))
193+- Update tree-sitter-dart ([#7576](https://github.com/helix-editor/helix/pull/7576))
194+- Add shebang for nushell files ([#7606](https://github.com/helix-editor/helix/pull/7606))
195+- Recognize systemd files as INI ([#7592](https://github.com/helix-editor/helix/pull/7592))
196+- Update TypeScript, TSX and Svelte grammars ([#6874](https://github.com/helix-editor/helix/pull/6874))
197+- Enable inlay hints in the Svelte language server ([#7622](https://github.com/helix-editor/helix/pull/7622))
198+- Recognize `Brewfile`s as Ruby ([#7629](https://github.com/helix-editor/helix/pull/7629))
199+- Add more file-types for R ([#7633](https://github.com/helix-editor/helix/pull/7633))
200+- Switch tree-sitter-perl to official upstream parser ([#7644](https://github.com/helix-editor/helix/pull/7644), [#7947](https://github.com/helix-editor/helix/pull/7947))
201+- Fix predicate typo in comment highlights ([#7732](https://github.com/helix-editor/helix/pull/7732))
202+- Update tree-sitter-prql ([#7771](https://github.com/helix-editor/helix/pull/7771))
203+- Recognize `.gitf` as JSON ([#7781](https://github.com/helix-editor/helix/pull/7781))
204+- Switch V language server to `v-analyzer` ([#7760](https://github.com/helix-editor/helix/pull/7760))
205+- Add protobuf language servers ([#7796](https://github.com/helix-editor/helix/pull/7796))
206+- Update tree-sitter-zig ([#7803](https://github.com/helix-editor/helix/pull/7803))
207+- Update tree-sitter-hare ([#7784](https://github.com/helix-editor/helix/pull/7784))
208+- Add Java indent queries ([#7844](https://github.com/helix-editor/helix/pull/7844))
209+- Update tree-sitter-scheme ([979933b](https://github.com/helix-editor/helix/commit/979933b))
210+- Recognize `scm` as Scheme instead of TSQ ([5707151](https://github.com/helix-editor/helix/commit/5707151))
211+- Update tree-sitter-git-commit ([#7831](https://github.com/helix-editor/helix/pull/7831))
212+- Update JavaScript, TypeScript and TSX grammars ([#7852](https://github.com/helix-editor/helix/pull/7852))
213+- Update tree-sitter-nu ([#7873](https://github.com/helix-editor/helix/pull/7873))
214+- Fix YAML indentation ([#6768](https://github.com/helix-editor/helix/pull/6768))
215+- Add `csharp-ls`, Pyright, Pylyzer and add roots for Python ([#7897](https://github.com/helix-editor/helix/pull/7897), [#8032](https://github.com/helix-editor/helix/pull/8032))
216+- Update tree-sitter-slint ([#7893](https://github.com/helix-editor/helix/pull/7893))
217+- Recognize more ZSH file-types as Bash ([#7930](https://github.com/helix-editor/helix/pull/7930))
218+- Recognize `star` extension as Starlark ([#7922](https://github.com/helix-editor/helix/pull/7922))
219+- Fix inline HTML tag highlighting in markdown ([#7960](https://github.com/helix-editor/helix/pull/7960))
220+- Update tree-sitter-robot ([#7970](https://github.com/helix-editor/helix/pull/7970))
221+- Highlight Dart 3 `sealed` and `base` keywords ([#7974](https://github.com/helix-editor/helix/pull/7974))
222+- Add configuration for `ltex-ls` to the default `languages.toml` ([#7838](https://github.com/helix-editor/helix/pull/7838))
223+- Update tree-sitter-strace ([#8087](https://github.com/helix-editor/helix/pull/8087))
224+- Update tree-sitter-gleam, enable auto-format ([#8085](https://github.com/helix-editor/helix/pull/8085))
225+- Update tree-sitter-esdl ([#8222](https://github.com/helix-editor/helix/pull/8222))
226+- Expand ignore file-types ([#8220](https://github.com/helix-editor/helix/pull/8220))
227+- Recognize feed related formats as XML ([#8232](https://github.com/helix-editor/helix/pull/8232))
228+- Improve YAML injections ([#8217](https://github.com/helix-editor/helix/pull/8217))
229+- Add shebangs for TypeScript, Julia, Java and OCaml ([95e994a](https://github.com/helix-editor/helix/commit/95e994a))
230+- Highlight abbreviations in Scheme ([ef23847](https://github.com/helix-editor/helix/commit/ef23847))
231+- Remove backtic auto-pair in OCaml ([#8260](https://github.com/helix-editor/helix/pull/8260))
232+- Recognize `flake.lock` as JSON ([#8304](https://github.com/helix-editor/helix/pull/8304))
233+- Add Python test script injection for Nix ([b4494e1](https://github.com/helix-editor/helix/commit/b4494e1))
234+- Fix Nix comment injection precedence ([37e48f4](https://github.com/helix-editor/helix/commit/37e48f4))
235+- Recognize editorconfig files as INI ([#8308](https://github.com/helix-editor/helix/pull/8308))
236+- Recognize `.babelrc` as JSON ([#8309](https://github.com/helix-editor/helix/pull/8309))
237+- Switch Purescript to its own tree-sitter parser ([#8306](https://github.com/helix-editor/helix/pull/8306), [#8338](https://github.com/helix-editor/helix/pull/8338), [#8527](https://github.com/helix-editor/helix/pull/8527))
238+- Update Unison highlights ([#8315](https://github.com/helix-editor/helix/pull/8315))
239+- Recognize `.webmanifest` as JSON ([#8342](https://github.com/helix-editor/helix/pull/8342))
240+- Recognize polkit policy files as XML ([#8369](https://github.com/helix-editor/helix/pull/8369))
241+- Recognize polkit rules files as JavaScript ([#8370](https://github.com/helix-editor/helix/pull/8370))
242+- Update Go highlight queries ([#8399](https://github.com/helix-editor/helix/pull/8399))
243+- Add shebangs for Makefiles ([#8410](https://github.com/helix-editor/helix/pull/8410))
244+- Add file-type associations from VSCode ([#8388](https://github.com/helix-editor/helix/pull/8388))
245+- Add validation to JSON/CSS language server configs ([#8433](https://github.com/helix-editor/helix/pull/8433))
246+- Add a configuration for the tailwind language server ([#8442](https://github.com/helix-editor/helix/pull/8442))
247+- Add a configuration for the ansible language server ([#7973](https://github.com/helix-editor/helix/pull/7973))
248+- Add a configuration for the GraphQL language server ([#8492](https://github.com/helix-editor/helix/pull/8492))
249+- Indent while statements in Bash ([#8528](https://github.com/helix-editor/helix/pull/8528))
250+- Update tree-sitter-haskell and queries ([#8558](https://github.com/helix-editor/helix/pull/8558))
251+
252+Packaging:
253+
254+- Add an overlay to the Nix flake ([#7078](https://github.com/helix-editor/helix/pull/7078))
255+- Check for `git` before fetching or building grammars ([#7320](https://github.com/helix-editor/helix/pull/7320))
256+- Refactor Nix flake to use Crane ([#7763](https://github.com/helix-editor/helix/pull/7763))
257+- Remove the aarch64 appimage from the release CI ([#7832](https://github.com/helix-editor/helix/pull/7832))
258+- Add desktop and icon files to Nix flake output ([#7979](https://github.com/helix-editor/helix/pull/7979))
259+- Build flake packages with the latest stable Rust ([#8133](https://github.com/helix-editor/helix/pull/8133))
260+
1261# 23.05 (2023-05-18)
2262
326323.05 is a smaller release focusing on fixes. There were 88 contributors in this release. Thank you all!
Cargo.lock+538−609
@@ -19,41 +19,22 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
1919
2020[[package]]
2121name = "ahash"
22−version = "0.7.6"
23−source = "registry+https://github.com/rust-lang/crates.io-index"
24−checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
25−dependencies = [
26− "getrandom",
27− "once_cell",
28− "version_check",
29−]
30−
31−[[package]]
32−name = "ahash"
33−version = "0.8.3"
22+version = "0.8.6"
3423source = "registry+https://github.com/rust-lang/crates.io-index"
35−checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
24+checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
3625dependencies = [
3726 "cfg-if",
3827 "getrandom",
3928 "once_cell",
4029 "version_check",
30+ "zerocopy",
4131]
4232
4333[[package]]
4434name = "aho-corasick"
45−version = "0.7.20"
35+version = "1.1.2"
4636source = "registry+https://github.com/rust-lang/crates.io-index"
47−checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
48−dependencies = [
49− "memchr",
50−]
51−
52−[[package]]
53−name = "aho-corasick"
54−version = "1.0.2"
55−source = "registry+https://github.com/rust-lang/crates.io-index"
56−checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
37+checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
5738dependencies = [
5839 "memchr",
5940]
@@ -81,9 +62,9 @@ dependencies = [
8162
8263[[package]]
8364name = "anyhow"
84−version = "1.0.72"
65+version = "1.0.76"
8566source = "registry+https://github.com/rust-lang/crates.io-index"
86−checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854"
67+checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355"
8768
8869[[package]]
8970name = "arc-swap"
@@ -107,7 +88,7 @@ dependencies = [
10788 "cc",
10889 "cfg-if",
10990 "libc",
110− "miniz_oxide 0.7.1",
91+ "miniz_oxide",
11192 "object",
11293 "rustc-demangle",
11394]
@@ -120,15 +101,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
120101
121102[[package]]
122103name = "bitflags"
123−version = "2.3.3"
104+version = "2.4.1"
124105source = "registry+https://github.com/rust-lang/crates.io-index"
125−checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
106+checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
126107
127108[[package]]
128109name = "bstr"
129−version = "1.6.0"
110+version = "1.8.0"
130111source = "registry+https://github.com/rust-lang/crates.io-index"
131−checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05"
112+checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c"
132113dependencies = [
133114 "memchr",
134115 "regex-automata",
@@ -150,12 +131,6 @@ version = "3.12.0"
150131source = "registry+https://github.com/rust-lang/crates.io-index"
151132checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
152133
153−[[package]]
154−name = "bytecount"
155−version = "0.6.3"
156−source = "registry+https://github.com/rust-lang/crates.io-index"
157−checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c"
158−
159134[[package]]
160135name = "bytes"
161136version = "1.4.0"
@@ -170,9 +145,12 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
170145
171146[[package]]
172147name = "cc"
173−version = "1.0.79"
148+version = "1.0.84"
174149source = "registry+https://github.com/rust-lang/crates.io-index"
175−checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
150+checksum = "0f8e7c90afad890484a21653d08b6e209ae34770fb5ee298f9c699fcc1e5c856"
151+dependencies = [
152+ "libc",
153+]
176154
177155[[package]]
178156name = "cfg-if"
@@ -193,25 +171,23 @@ dependencies = [
193171
194172[[package]]
195173name = "chrono"
196−version = "0.4.26"
174+version = "0.4.31"
197175source = "registry+https://github.com/rust-lang/crates.io-index"
198−checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5"
176+checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
199177dependencies = [
200178 "android-tzdata",
201179 "iana-time-zone",
202180 "num-traits",
203− "winapi",
181+ "windows-targets 0.48.0",
204182]
205183
206184[[package]]
207185name = "clipboard-win"
208−version = "4.5.0"
186+version = "5.0.0"
209187source = "registry+https://github.com/rust-lang/crates.io-index"
210−checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362"
188+checksum = "c57002a5d9be777c1ef967e33674dac9ebd310d8893e4e3437b14d5f0f6372cc"
211189dependencies = [
212190 "error-code",
213− "str-buf",
214− "winapi",
215191]
216192
217193[[package]]
@@ -245,6 +221,12 @@ version = "0.8.4"
245221source = "registry+https://github.com/rust-lang/crates.io-index"
246222checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
247223
224+[[package]]
225+name = "cov-mark"
226+version = "1.1.0"
227+source = "registry+https://github.com/rust-lang/crates.io-index"
228+checksum = "9ffa3d3e0138386cd4361f63537765cac7ee40698028844635a54495a92f67f3"
229+
248230[[package]]
249231name = "crc32fast"
250232version = "1.3.2"
@@ -254,13 +236,56 @@ dependencies = [
254236 "cfg-if",
255237]
256238
239+[[package]]
240+name = "crossbeam-channel"
241+version = "0.5.8"
242+source = "registry+https://github.com/rust-lang/crates.io-index"
243+checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
244+dependencies = [
245+ "cfg-if",
246+ "crossbeam-utils",
247+]
248+
249+[[package]]
250+name = "crossbeam-deque"
251+version = "0.8.3"
252+source = "registry+https://github.com/rust-lang/crates.io-index"
253+checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
254+dependencies = [
255+ "cfg-if",
256+ "crossbeam-epoch",
257+ "crossbeam-utils",
258+]
259+
260+[[package]]
261+name = "crossbeam-epoch"
262+version = "0.9.15"
263+source = "registry+https://github.com/rust-lang/crates.io-index"
264+checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
265+dependencies = [
266+ "autocfg",
267+ "cfg-if",
268+ "crossbeam-utils",
269+ "memoffset",
270+ "scopeguard",
271+]
272+
273+[[package]]
274+name = "crossbeam-utils"
275+version = "0.8.16"
276+source = "registry+https://github.com/rust-lang/crates.io-index"
277+checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
278+dependencies = [
279+ "cfg-if",
280+]
281+
257282[[package]]
258283name = "crossterm"
259−version = "0.26.1"
284+version = "0.27.0"
260285source = "registry+https://github.com/rust-lang/crates.io-index"
261−checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
286+checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
262287dependencies = [
263− "bitflags 1.3.2",
288+ "bitflags 2.4.1",
264289 "crossterm_winapi",
265290 "filedescriptor",
266291 "futures-core",
@@ -274,9 +299,9 @@ dependencies = [
274299
275300[[package]]
276301name = "crossterm_winapi"
277−version = "0.9.0"
302+version = "0.9.1"
278303source = "registry+https://github.com/rust-lang/crates.io-index"
279−checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c"
304+checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
280305dependencies = [
281306 "winapi",
282307]
@@ -305,7 +330,7 @@ dependencies = [
305330 "proc-macro2",
306331 "quote",
307332 "scratch",
308− "syn 2.0.28",
333+ "syn 2.0.38",
309334]
310335
311336[[package]]
@@ -322,7 +347,7 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5"
322347dependencies = [
323348 "proc-macro2",
324349 "quote",
325− "syn 2.0.28",
350+ "syn 2.0.38",
326351]
327352
328353[[package]]
@@ -339,9 +364,9 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
339364
340365[[package]]
341366name = "encoding_rs"
342−version = "0.8.32"
367+version = "0.8.33"
343368source = "registry+https://github.com/rust-lang/crates.io-index"
344−checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
369+checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
345370dependencies = [
346371 "cfg-if",
347372]
@@ -363,34 +388,19 @@ checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1"
363388
364389[[package]]
365390name = "errno"
366−version = "0.3.1"
367−source = "registry+https://github.com/rust-lang/crates.io-index"
368−checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
369−dependencies = [
370− "errno-dragonfly",
371− "libc",
372− "windows-sys 0.48.0",
373−]
374−
375−[[package]]
376−name = "errno-dragonfly"
377−version = "0.1.2"
391+version = "0.3.8"
378392source = "registry+https://github.com/rust-lang/crates.io-index"
379−checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
393+checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
380394dependencies = [
381− "cc",
382395 "libc",
396+ "windows-sys 0.52.0",
383397]
384398
385399[[package]]
386400name = "error-code"
387−version = "2.3.1"
401+version = "3.0.0"
388402source = "registry+https://github.com/rust-lang/crates.io-index"
389−checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21"
390−dependencies = [
391− "libc",
392− "str-buf",
393−]
403+checksum = "281e452d3bad4005426416cdba5ccfd4f5c1280e10099e21db27f7c1c28347fc"
394404
395405[[package]]
396406name = "etcetera"
@@ -403,6 +413,15 @@ dependencies = [
403413 "windows-sys 0.48.0",
404414]
405415
416+[[package]]
417+name = "faster-hex"
418+version = "0.9.0"
419+source = "registry+https://github.com/rust-lang/crates.io-index"
420+checksum = "a2a2b11eda1d40935b26cf18f6833c526845ae8c41e58d09af6adeb6f0269183"
421+dependencies = [
422+ "serde",
423+]
424+
406425[[package]]
407426name = "fastrand"
408427version = "2.0.0"
@@ -429,54 +448,36 @@ dependencies = [
429448 "winapi",
430449]
431450
432−[[package]]
433−name = "filetime"
434−version = "0.2.21"
435−source = "registry+https://github.com/rust-lang/crates.io-index"
436−checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153"
437−dependencies = [
438− "cfg-if",
439− "libc",
440− "redox_syscall 0.2.16",
441− "windows-sys 0.48.0",
442−]
443−
444451[[package]]
445452name = "flate2"
446−version = "1.0.25"
453+version = "1.0.27"
447454source = "registry+https://github.com/rust-lang/crates.io-index"
448−checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841"
455+checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010"
449456dependencies = [
450457 "crc32fast",
451− "miniz_oxide 0.6.2",
458+ "miniz_oxide",
452459]
453460
454−[[package]]
455−name = "fnv"
456−version = "1.0.7"
457−source = "registry+https://github.com/rust-lang/crates.io-index"
458−checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
459−
460461[[package]]
461462name = "form_urlencoded"
462−version = "1.2.0"
463+version = "1.2.1"
463464source = "registry+https://github.com/rust-lang/crates.io-index"
464−checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
465+checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
465466dependencies = [
466467 "percent-encoding",
467468]
468469
469470[[package]]
470471name = "futures-core"
471−version = "0.3.28"
472+version = "0.3.30"
472473source = "registry+https://github.com/rust-lang/crates.io-index"
473−checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
474+checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
474475
475476[[package]]
476477name = "futures-executor"
477−version = "0.3.28"
478+version = "0.3.29"
478479source = "registry+https://github.com/rust-lang/crates.io-index"
479−checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
480+checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc"
480481dependencies = [
481482 "futures-core",
482483 "futures-task",
@@ -485,15 +486,15 @@ dependencies = [
485486
486487[[package]]
487488name = "futures-task"
488−version = "0.3.28"
489+version = "0.3.30"
489490source = "registry+https://github.com/rust-lang/crates.io-index"
490−checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
491+checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
491492
492493[[package]]
493494name = "futures-util"
494−version = "0.3.28"
495+version = "0.3.30"
495496source = "registry+https://github.com/rust-lang/crates.io-index"
496−checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
497+checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
497498dependencies = [
498499 "futures-core",
499500 "futures-task",
@@ -502,15 +503,6 @@ dependencies = [
502503 "slab",
503504]
504505
505−[[package]]
506−name = "fuzzy-matcher"
507−version = "0.3.7"
508−source = "registry+https://github.com/rust-lang/crates.io-index"
509−checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94"
510−dependencies = [
511− "thread_local",
512−]
513−
514506[[package]]
515507name = "getrandom"
516508version = "0.2.9"
@@ -530,15 +522,13 @@ checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e"
530522
531523[[package]]
532524name = "gix"
533−version = "0.48.0"
525+version = "0.57.0"
534526source = "registry+https://github.com/rust-lang/crates.io-index"
535−checksum = "c1e74cea676de7f53a79f3c0365812b11f6814b81e671b8ee4abae6ca09c7881"
527+checksum = "721c7497ab24b665ed5a1eb2b3526936aa60068e61ba260651f7e77c52feec69"
536528dependencies = [
537529 "gix-actor",
538− "gix-attributes",
539530 "gix-commitgraph",
540531 "gix-config",
541− "gix-credentials",
542532 "gix-date",
543533 "gix-diff",
544534 "gix-discover",
@@ -547,19 +537,16 @@ dependencies = [
547537 "gix-glob",
548538 "gix-hash",
549539 "gix-hashtable",
550− "gix-ignore",
551− "gix-index",
552540 "gix-lock",
553− "gix-mailmap",
554− "gix-negotiate",
541+ "gix-macros",
555542 "gix-object",
556543 "gix-odb",
557544 "gix-pack",
558545 "gix-path",
559− "gix-prompt",
560546 "gix-ref",
561547 "gix-refspec",
562548 "gix-revision",
549+ "gix-revwalk",
563550 "gix-sec",
564551 "gix-tempfile",
565552 "gix-trace",
@@ -567,10 +554,8 @@ dependencies = [
567554 "gix-url",
568555 "gix-utils",
569556 "gix-validate",
570− "gix-worktree",
571− "log",
572557 "once_cell",
573− "signal-hook",
558+ "parking_lot",
574559 "smallvec",
575560 "thiserror",
576561 "unicode-normalization",
@@ -578,81 +563,46 @@ dependencies = [
578563
579564[[package]]
580565name = "gix-actor"
581−version = "0.23.0"
566+version = "0.29.0"
582567source = "registry+https://github.com/rust-lang/crates.io-index"
583−checksum = "1969b77b9ee4cc1755c841987ec6f7622aaca95e952bcafb76973ae59d1b8716"
568+checksum = "886014c4865b93ce268f1d3eddd4fd3261242c3f3ee61eb36009f913016a9059"
584569dependencies = [
585570 "bstr",
586571 "btoi",
587572 "gix-date",
588573 "itoa",
589− "nom",
590− "thiserror",
591−]
592−
593−[[package]]
594−name = "gix-attributes"
595−version = "0.14.1"
596−source = "registry+https://github.com/rust-lang/crates.io-index"
597−checksum = "e3772b0129dcd1fc73e985bbd08a1482d082097d2915cb1ee31ce8092b8e4434"
598−dependencies = [
599− "bstr",
600− "gix-glob",
601− "gix-path",
602− "gix-quote",
603− "kstring",
604− "log",
605− "smallvec",
606− "thiserror",
607− "unicode-bom",
608−]
609−
610−[[package]]
611−name = "gix-bitmap"
612−version = "0.2.5"
613−source = "registry+https://github.com/rust-lang/crates.io-index"
614−checksum = "311e2fa997be6560c564b070c5da2d56d038b645a94e1e5796d5d85a350da33c"
615−dependencies = [
616574 "thiserror",
575+ "winnow 0.5.28",
617576]
618577
619578[[package]]
620579name = "gix-chunk"
621−version = "0.4.3"
580+version = "0.4.6"
622581source = "registry+https://github.com/rust-lang/crates.io-index"
623−checksum = "39db5ed0fc0a2e9b1b8265993f7efdbc30379dec268f3b91b7af0c2de4672fdd"
582+checksum = "2ade37ef69870de0ed966b97c57a3a947a22ff3482a52c3b99b205f77bcb08fb"
624583dependencies = [
625584 "thiserror",
626585]
627586
628−[[package]]
629−name = "gix-command"
630−version = "0.2.6"
631−source = "registry+https://github.com/rust-lang/crates.io-index"
632−checksum = "bb49ab557a37b0abb2415bca2b10e541277dff0565deb5bd5e99fd95f93f51eb"
633−dependencies = [
634− "bstr",
635−]
636−
637587[[package]]
638588name = "gix-commitgraph"
639−version = "0.17.1"
589+version = "0.23.0"
640590source = "registry+https://github.com/rust-lang/crates.io-index"
641−checksum = "ed42baa50075d41c1a0931074ce1a97c5797c7c6fe7591d9f1f2dcd448532c26"
591+checksum = "e7559ea9cefee188cd88b05afcc8e3ef7a3cb4a5c647bccf06b981e591b02b77"
642592dependencies = [
643593 "bstr",
644594 "gix-chunk",
645595 "gix-features",
646596 "gix-hash",
647− "memmap2 0.7.1",
597+ "memmap2",
648598 "thiserror",
649599]
650600
651601[[package]]
652602name = "gix-config"
653−version = "0.25.1"
603+version = "0.33.0"
654604source = "registry+https://github.com/rust-lang/crates.io-index"
655−checksum = "817688c7005a716d9363e267913526adea402dabd947f4ba63842d10cc5132af"
605+checksum = "9c35dc7f9c00a42bbc9cfa1ca2ec0a78ad1b76ff0736d3d35dfd612962244467"
656606dependencies = [
657607 "bstr",
658608 "gix-config-value",
@@ -661,49 +611,32 @@ dependencies = [
661611 "gix-path",
662612 "gix-ref",
663613 "gix-sec",
664− "log",
665614 "memchr",
666− "nom",
667615 "once_cell",
668616 "smallvec",
669617 "thiserror",
670618 "unicode-bom",
619+ "winnow 0.5.28",
671620]
672621
673622[[package]]
674623name = "gix-config-value"
675−version = "0.12.3"
624+version = "0.14.2"
676625source = "registry+https://github.com/rust-lang/crates.io-index"
677−checksum = "83960be5e99266bcf55dae5a24731bbd39f643bfb68f27e939d6b06836b5b87d"
626+checksum = "39f388cb2396aee82d6f460a2e7770659bdf8854e9e5478f7d2b1324a9698284"
678627dependencies = [
679− "bitflags 2.3.3",
628+ "bitflags 2.4.1",
680629 "bstr",
681630 "gix-path",
682631 "libc",
683632 "thiserror",
684633]
685634
686−[[package]]
687−name = "gix-credentials"
688−version = "0.16.1"
689−source = "registry+https://github.com/rust-lang/crates.io-index"
690−checksum = "75a75565e0e6e7f80cfa4eb1b05cc448c6846ddd48dcf413a28875fbc11ee9af"
691−dependencies = [
692− "bstr",
693− "gix-command",
694− "gix-config-value",
695− "gix-path",
696− "gix-prompt",
697− "gix-sec",
698− "gix-url",
699− "thiserror",
700−]
701−
702635[[package]]
703636name = "gix-date"
704−version = "0.7.0"
637+version = "0.8.2"
705638source = "registry+https://github.com/rust-lang/crates.io-index"
706−checksum = "8e9a04a1d2387c955ec91059d56b673000dd24f3c07cad08ed253e36381782bf"
639+checksum = "9d85f4a01e0d05c3de585e28bae514d4baf01655e3fc3f14ce6f30bf62405345"
707640dependencies = [
708641 "bstr",
709642 "itoa",
@@ -713,21 +646,21 @@ dependencies = [
713646
714647[[package]]
715648name = "gix-diff"
716−version = "0.32.0"
649+version = "0.39.0"
717650source = "registry+https://github.com/rust-lang/crates.io-index"
718−checksum = "aaf5d9b9b521b284ebe53ee69eee33341835ec70edc314f36b2100ea81396121"
651+checksum = "ac0e75f5afd2f6c47c800b6b0a000a08045739d0450d20482e8faa42543f62d1"
719652dependencies = [
653+ "bstr",
720654 "gix-hash",
721655 "gix-object",
722− "imara-diff",
723656 "thiserror",
724657]
725658
726659[[package]]
727660name = "gix-discover"
728−version = "0.21.1"
661+version = "0.28.0"
729662source = "registry+https://github.com/rust-lang/crates.io-index"
730−checksum = "272aad20dc63dedba76615373dd8885fb5aebe4795e5b5b0aa2a24e63c82085c"
663+checksum = "f0b63ce2ad81632ac1a84ac370f85a5e580c3261580bd85ea17ff35d3a0bba18"
731664dependencies = [
732665 "bstr",
733666 "dunce",
@@ -740,9 +673,9 @@ dependencies = [
740673
741674[[package]]
742675name = "gix-features"
743−version = "0.31.1"
676+version = "0.37.0"
744677source = "registry+https://github.com/rust-lang/crates.io-index"
745−checksum = "06142d8cff5d17509399b04052b64d2f9b3a311d5cff0b1a32b220f62cd0d595"
678+checksum = "befe7edea299a824504b5acc96d7a3a538125b38c42f3a8379f6912a29c90c81"
746679dependencies = [
747680 "crc32fast",
748681 "flate2",
@@ -758,20 +691,20 @@ dependencies = [
758691
759692[[package]]
760693name = "gix-fs"
761−version = "0.3.0"
694+version = "0.9.0"
762695source = "registry+https://github.com/rust-lang/crates.io-index"
763−checksum = "bb15956bc0256594c62a2399fcf6958a02a11724217eddfdc2b49b21b6292496"
696+checksum = "007017ce93b819ea52c0ec68306f7d72212a2d307c3d70f1548c7141c015d0a1"
764697dependencies = [
765698 "gix-features",
766699]
767700
768701[[package]]
769702name = "gix-glob"
770−version = "0.9.1"
703+version = "0.15.0"
771704source = "registry+https://github.com/rust-lang/crates.io-index"
772−checksum = "c18bdff83143d61e7d60da6183b87542a870d026b2a2d0b30170b8e9c0cd321a"
705+checksum = "61fb116c2516d3a1170e010118f639944a6389872c875a008960cdab2a44ac72"
773706dependencies = [
774− "bitflags 2.3.3",
707+ "bitflags 2.4.1",
775708 "bstr",
776709 "gix-features",
777710 "gix-path",
@@ -779,64 +712,30 @@ dependencies = [
779712
780713[[package]]
781714name = "gix-hash"
782−version = "0.11.3"
715+version = "0.14.0"
783716source = "registry+https://github.com/rust-lang/crates.io-index"
784−checksum = "a0dd58cdbe7ffa4032fc111864c80d5f8cecd9a2c9736c97ae7e5be834188272"
717+checksum = "c52c3170a17b6031833cd2eb4ad7bc23f2755d06e6e70f78dec21d42e8fe1b30"
785718dependencies = [
786− "hex",
719+ "faster-hex",
787720 "thiserror",
788721]
789722
790723[[package]]
791724name = "gix-hashtable"
792−version = "0.2.3"
725+version = "0.5.0"
793726source = "registry+https://github.com/rust-lang/crates.io-index"
794−checksum = "9e133bc56d938eaec1c675af7c681a51de9662b0ada779f45607b967a10da77a"
727+checksum = "40a838e6366a5e5b84668b6997ce0981b833136468e8ba949f424c0ef2927eba"
795728dependencies = [
796729 "gix-hash",
797− "hashbrown 0.14.0",
730+ "hashbrown 0.14.3",
798731 "parking_lot",
799732]
800733
801−[[package]]
802−name = "gix-ignore"
803−version = "0.4.1"
804−source = "registry+https://github.com/rust-lang/crates.io-index"
805−checksum = "ca801f2d0535210f77b33e2c067d565aedecacc82f1b3dbce26da1388ebc4634"
806−dependencies = [
807− "bstr",
808− "gix-glob",
809− "gix-path",
810− "unicode-bom",
811−]
812−
813−[[package]]
814−name = "gix-index"
815−version = "0.20.0"
816−source = "registry+https://github.com/rust-lang/crates.io-index"
817−checksum = "68099abdf6ee50ae3c897e8b05de96871cbe54d52a37cdf559101f911b883562"
818−dependencies = [
819− "bitflags 2.3.3",
820− "bstr",
821− "btoi",
822− "filetime",
823− "gix-bitmap",
824− "gix-features",
825− "gix-hash",
826− "gix-lock",
827− "gix-object",
828− "gix-traverse",
829− "itoa",
830− "memmap2 0.7.1",
831− "smallvec",
832− "thiserror",
833−]
834−
835734[[package]]
836735name = "gix-lock"
837−version = "7.0.0"
736+version = "12.0.0"
838737source = "registry+https://github.com/rust-lang/crates.io-index"
839−checksum = "328f50aad713ab606caeaf834459ef915ccdfbb9133ac6cd54616d601aa9249f"
738+checksum = "6cf112ddee94223c119a8534dad027740dc3aba3365ac5edeef8a7f6660c74db"
840739dependencies = [
841740 "gix-tempfile",
842741 "gix-utils",
@@ -844,38 +743,21 @@ dependencies = [
844743]
845744
846745[[package]]
847−name = "gix-mailmap"
848−version = "0.15.0"
849−source = "registry+https://github.com/rust-lang/crates.io-index"
850−checksum = "1787e3c37fc43b1f7c0e3be6196c6837b3ba5f869190dfeaa444b816f0a7f34b"
851−dependencies = [
852− "bstr",
853− "gix-actor",
854− "gix-date",
855− "thiserror",
856−]
857−
858−[[package]]
859−name = "gix-negotiate"
860−version = "0.4.0"
746+name = "gix-macros"
747+version = "0.1.2"
861748source = "registry+https://github.com/rust-lang/crates.io-index"
862−checksum = "4e7bce64d4452dd609f44d04b14b29da2e0ad2c45fcdf4ce1472a5f5f8ec21c2"
749+checksum = "fc207b64189cf71bcb17fc841ab99a5d63d0845546b611e2703ce467f659323a"
863750dependencies = [
864− "bitflags 2.3.3",
865− "gix-commitgraph",
866− "gix-date",
867− "gix-hash",
868− "gix-object",
869− "gix-revwalk",
870− "smallvec",
871− "thiserror",
751+ "proc-macro2",
752+ "quote",
753+ "syn 2.0.38",
872754]
873755
874756[[package]]
875757name = "gix-object"
876−version = "0.32.0"
758+version = "0.40.0"
877759source = "registry+https://github.com/rust-lang/crates.io-index"
878−checksum = "a953f3d7ffad16734aa3ab1d05807972c80e339d1bd9dde03e0198716b99e2a6"
760+checksum = "e4c77e47ffba92127faf632a841fce23d19547e269bd8b88e68961a70eab4e93"
879761dependencies = [
880762 "bstr",
881763 "btoi",
@@ -884,18 +766,17 @@ dependencies = [
884766 "gix-features",
885767 "gix-hash",
886768 "gix-validate",
887− "hex",
888769 "itoa",
889− "nom",
890770 "smallvec",
891771 "thiserror",
772+ "winnow 0.5.28",
892773]
893774
894775[[package]]
895776name = "gix-odb"
896−version = "0.49.1"
777+version = "0.56.0"
897778source = "registry+https://github.com/rust-lang/crates.io-index"
898−checksum = "f6418cff00ecc2713b58c8e04bff30dda808fbba1a080e7248b299d069894a01"
779+checksum = "a3254f2005cc7553ea78e85e816a09150c6f7a64e6b7627b8d1fdc56721bea73"
899780dependencies = [
900781 "arc-swap",
901782 "gix-date",
@@ -912,21 +793,19 @@ dependencies = [
912793
913794[[package]]
914795name = "gix-pack"
915−version = "0.39.1"
796+version = "0.46.0"
916797source = "registry+https://github.com/rust-lang/crates.io-index"
917−checksum = "414935138d90043ea5898de7a93f02c2558e52652492719470e203ef26a8fd0a"
798+checksum = "02ebc8cd657eec207d82d8f876ca402361308ecd3c87a47935b0299506257b4f"
918799dependencies = [
919800 "clru",
920801 "gix-chunk",
921− "gix-diff",
922802 "gix-features",
923803 "gix-hash",
924804 "gix-hashtable",
925805 "gix-object",
926806 "gix-path",
927807 "gix-tempfile",
928− "gix-traverse",
929− "memmap2 0.7.1",
808+ "memmap2",
930809 "parking_lot",
931810 "smallvec",
932811 "thiserror",
@@ -934,9 +813,9 @@ dependencies = [
934813
935814[[package]]
936815name = "gix-path"
937−version = "0.8.3"
816+version = "0.10.2"
938817source = "registry+https://github.com/rust-lang/crates.io-index"
939−checksum = "dfca182d2575ded2ed38280f1ebf75cd5d3790b77e0872de07854cf085821fbe"
818+checksum = "10931652a3da126990ac93bce1b1c600cc99d7c268d712b6360ed52174ce1b68"
940819dependencies = [
941820 "bstr",
942821 "gix-trace",
@@ -945,24 +824,11 @@ dependencies = [
945824 "thiserror",
946825]
947826
948−[[package]]
949−name = "gix-prompt"
950−version = "0.5.2"
951−source = "registry+https://github.com/rust-lang/crates.io-index"
952−checksum = "8dfd363fd89a40c1e7bff9c9c1b136cd2002480f724b0c627c1bc771cd5480ec"
953−dependencies = [
954− "gix-command",
955− "gix-config-value",
956− "parking_lot",
957− "rustix 0.37.15",
958− "thiserror",
959−]
960−
961827[[package]]
962828name = "gix-quote"
963−version = "0.4.5"
829+version = "0.4.9"
964830source = "registry+https://github.com/rust-lang/crates.io-index"
965−checksum = "3874de636c2526de26a3405b8024b23ef1a327bebf4845d770d00d48700b6a40"
831+checksum = "6c43530cb94a7759807e6f8d180e17ac9c65673b891645c6c433831dc0cf4342"
966832dependencies = [
967833 "bstr",
968834 "btoi",
@@ -971,9 +837,9 @@ dependencies = [
971837
972838[[package]]
973839name = "gix-ref"
974−version = "0.32.1"
840+version = "0.40.0"
975841source = "registry+https://github.com/rust-lang/crates.io-index"
976−checksum = "39453f4e5f23cddc2e6e4cca2ba20adfdbec29379e3ca829714dfe98ae068ccd"
842+checksum = "baa951b3b850d6d1be4f900768e49af20b76bf9505beac22af723d57249a2f1d"
977843dependencies = [
978844 "gix-actor",
979845 "gix-date",
@@ -985,16 +851,16 @@ dependencies = [
985851 "gix-path",
986852 "gix-tempfile",
987853 "gix-validate",
988− "memmap2 0.7.1",
989− "nom",
854+ "memmap2",
990855 "thiserror",
856+ "winnow 0.5.28",
991857]
992858
993859[[package]]
994860name = "gix-refspec"
995−version = "0.13.0"
861+version = "0.21.0"
996862source = "registry+https://github.com/rust-lang/crates.io-index"
997−checksum = "b8e76ff1f82fba295a121e31ab02f69642994e532c45c0c899aa393f4b740302"
863+checksum = "88c61f849d58c06e3068a0b601cf10127d2a07cdad00a725ed66cf303f76f6b3"
998864dependencies = [
999865 "bstr",
1000866 "gix-hash",
@@ -1006,9 +872,9 @@ dependencies = [
1006872
1007873[[package]]
1008874name = "gix-revision"
1009−version = "0.17.0"
875+version = "0.25.0"
1010876source = "registry+https://github.com/rust-lang/crates.io-index"
1011−checksum = "237428a7d3978e8572964e1e45d984027c2acc94df47e594baa6c4b0da7c9922"
877+checksum = "bcbbf91f4200c5c76802ef5f057b96f5a336827508881fe55a780be71a794d22"
1012878dependencies = [
1013879 "bstr",
1014880 "gix-date",
@@ -1016,14 +882,15 @@ dependencies = [
1016882 "gix-hashtable",
1017883 "gix-object",
1018884 "gix-revwalk",
885+ "gix-trace",
1019886 "thiserror",
1020887]
1021888
1022889[[package]]
1023890name = "gix-revwalk"
1024−version = "0.3.0"
891+version = "0.11.0"
1025892source = "registry+https://github.com/rust-lang/crates.io-index"
1026−checksum = "028d50fcaf8326a8f79a359490d9ca9fb4e2b51ac9ac86503560d0bcc888d2eb"
893+checksum = "33ab66354d83f70f2730391747d0c75f94ef3c3dd40ebde2e206db9faaf7a0a7"
1027894dependencies = [
1028895 "gix-commitgraph",
1029896 "gix-date",
@@ -1036,42 +903,40 @@ dependencies = [
1036903
1037904[[package]]
1038905name = "gix-sec"
1039−version = "0.8.3"
906+version = "0.10.2"
1040907source = "registry+https://github.com/rust-lang/crates.io-index"
1041−checksum = "ede298863db2a0574a14070991710551e76d1f47c9783b62d4fcbca17f56371c"
908+checksum = "a9963f38a42144253ed4d571882d7db5ef644c12e6726e4b75135597cc9d0e1a"
1042909dependencies = [
1043− "bitflags 2.3.3",
910+ "bitflags 2.4.1",
1044911 "gix-path",
1045912 "libc",
1046− "windows",
913+ "windows 0.52.0",
1047914]
1048915
1049916[[package]]
1050917name = "gix-tempfile"
1051−version = "7.0.0"
918+version = "12.0.0"
1052919source = "registry+https://github.com/rust-lang/crates.io-index"
1053−checksum = "4fac8310c17406ea619af72f42ee46dac795110f68f41b4f4fa231b69889c6a2"
920+checksum = "e76a494bd530e1a1309188ff971825a24f159c76c2db0bf71fa5dfb469a2c915"
1054921dependencies = [
1055922 "gix-fs",
1056923 "libc",
1057924 "once_cell",
1058925 "parking_lot",
1059− "signal-hook",
1060− "signal-hook-registry",
1061926 "tempfile",
1062927]
1063928
1064929[[package]]
1065930name = "gix-trace"
1066−version = "0.1.2"
931+version = "0.1.5"
1067932source = "registry+https://github.com/rust-lang/crates.io-index"
1068−checksum = "103eac621617be3ebe0605c9065ca51a223279a23218aaf67d10daa6e452f663"
933+checksum = "bda62acb44dd86a40c7c3762a5403cfc1ac789ea559df54085cedf79864f809e"
1069934
1070935[[package]]
1071936name = "gix-traverse"
1072−version = "0.29.0"
937+version = "0.36.0"
1073938source = "registry+https://github.com/rust-lang/crates.io-index"
1074−checksum = "e3cdfd54598db4fae57d5ae6f52958422b2d13382d2745796bfe5c8015ffa86e"
939+checksum = "8661fab39985c9214e56d81a63ceb5886ac948cec2fba76c39494d1e0e307ea8"
1075940dependencies = [
1076941 "gix-commitgraph",
1077942 "gix-date",
@@ -1085,9 +950,9 @@ dependencies = [
1085950
1086951[[package]]
1087952name = "gix-url"
1088−version = "0.20.1"
953+version = "0.26.0"
1089954source = "registry+https://github.com/rust-lang/crates.io-index"
1090−checksum = "beaede6dbc83f408b19adfd95bb52f1dbf01fb8862c3faf6c6243e2e67fcdfa1"
955+checksum = "10a0129c1e8b52736d7c5128300a4485dbc85863001371e2771ac1754bd89fd7"
1091956dependencies = [
1092957 "bstr",
1093958 "gix-features",
@@ -1099,94 +964,71 @@ dependencies = [
1099964
1100965[[package]]
1101966name = "gix-utils"
1102−version = "0.1.4"
967+version = "0.1.7"
1103968source = "registry+https://github.com/rust-lang/crates.io-index"
1104−checksum = "7058c94f4164fcf5b8457d35f6d8f6e1007f9f7f938c9c7684a7e01d23c6ddde"
969+checksum = "ab9277a5e32e85d53f738096d872a4a9b76067ad471894ad31bd99c8fa2da1dc"
1105970dependencies = [
1106971 "fastrand",
1107972]
1108973
1109974[[package]]
1110975name = "gix-validate"
1111−version = "0.7.6"
1112−source = "registry+https://github.com/rust-lang/crates.io-index"
1113−checksum = "8d092b594c8af00a3a31fe526d363ee8a51a6f29d8496cdb991ed2f01ec0ec13"
1114−dependencies = [
1115− "bstr",
1116− "thiserror",
1117−]
1118−
1119−[[package]]
1120−name = "gix-worktree"
1121−version = "0.21.1"
976+version = "0.8.2"
1122977source = "registry+https://github.com/rust-lang/crates.io-index"
1123−checksum = "c1363b9aa66b9e14412ac04e1f759827203f491729d92172535a8ce6cde02efa"
978+checksum = "f805ebbdbaa4bfd98e2ee43e6d14099b8a4d9141f5d7b8202fea4d48e44263e7"
1124979dependencies = [
1125980 "bstr",
1126− "filetime",
1127− "gix-attributes",
1128− "gix-features",
1129− "gix-fs",
1130− "gix-glob",
1131− "gix-hash",
1132− "gix-ignore",
1133− "gix-index",
1134− "gix-object",
1135− "gix-path",
1136− "io-close",
1137981 "thiserror",
1138982]
1139983
1140984[[package]]
1141985name = "globset"
1142−version = "0.4.13"
986+version = "0.4.14"
1143987source = "registry+https://github.com/rust-lang/crates.io-index"
1144−checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
988+checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"
1145989dependencies = [
1146− "aho-corasick 1.0.2",
990+ "aho-corasick",
1147991 "bstr",
1148− "fnv",
1149992 "log",
1150− "regex",
993+ "regex-automata",
994+ "regex-syntax",
1151995]
1152996
1153997[[package]]
1154998name = "grep-matcher"
1155−version = "0.1.6"
999+version = "0.1.7"
11561000source = "registry+https://github.com/rust-lang/crates.io-index"
1157−checksum = "3902ca28f26945fe35cad349d776f163981d777fee382ccd6ef451126f51b319"
1001+checksum = "47a3141a10a43acfedc7c98a60a834d7ba00dfe7bec9071cbfc19b55b292ac02"
11581002dependencies = [
11591003 "memchr",
11601004]
11611005
11621006[[package]]
11631007name = "grep-regex"
1164−version = "0.1.11"
1008+version = "0.1.12"
11651009source = "registry+https://github.com/rust-lang/crates.io-index"
1166−checksum = "997598b41d53a37a2e3fc5300d5c11d825368c054420a9c65125b8fe1078463f"
1010+checksum = "f748bb135ca835da5cbc67ca0e6955f968db9c5df74ca4f56b18e1ddbc68230d"
11671011dependencies = [
1168− "aho-corasick 0.7.20",
11691012 "bstr",
11701013 "grep-matcher",
11711014 "log",
1172− "regex",
1173− "regex-syntax 0.6.29",
1174− "thread_local",
1015+ "regex-automata",
1016+ "regex-syntax",
11751017]
11761018
11771019[[package]]
11781020name = "grep-searcher"
1179−version = "0.1.11"
1021+version = "0.1.13"
11801022source = "registry+https://github.com/rust-lang/crates.io-index"
1181−checksum = "5601c4b9f480f0c9ebb40b1f6cbf447b8a50c5369223937a6c5214368c58779f"
1023+checksum = "ba536ae4f69bec62d8839584dd3153d3028ef31bb229f04e09fb5a9e5a193c54"
11821024dependencies = [
11831025 "bstr",
1184− "bytecount",
11851026 "encoding_rs",
11861027 "encoding_rs_io",
11871028 "grep-matcher",
11881029 "log",
1189− "memmap2 0.5.10",
1030+ "memchr",
1031+ "memmap2",
11901032]
11911033
11921034[[package]]
@@ -1194,37 +1036,36 @@ name = "hashbrown"
11941036version = "0.12.3"
11951037source = "registry+https://github.com/rust-lang/crates.io-index"
11961038checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
1197−dependencies = [
1198− "ahash 0.7.6",
1199−]
12001039
12011040[[package]]
12021041name = "hashbrown"
1203−version = "0.14.0"
1042+version = "0.14.3"
12041043source = "registry+https://github.com/rust-lang/crates.io-index"
1205−checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
1044+checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
12061045dependencies = [
1207− "ahash 0.8.3",
1046+ "ahash",
12081047 "allocator-api2",
12091048]
12101049
12111050[[package]]
12121051name = "helix-core"
1213−version = "0.6.0"
1052+version = "23.10.0"
12141053dependencies = [
1215− "ahash 0.8.3",
1054+ "ahash",
12161055 "arc-swap",
1217− "bitflags 2.3.3",
1056+ "bitflags 2.4.1",
12181057 "chrono",
12191058 "dunce",
12201059 "encoding_rs",
12211060 "etcetera",
1222− "hashbrown 0.14.0",
1061+ "hashbrown 0.14.3",
12231062 "helix-loader",
12241063 "imara-diff",
12251064 "indoc",
12261065 "log",
1066+ "nucleo",
12271067 "once_cell",
1068+ "parking_lot",
12281069 "quickcheck",
12291070 "regex",
12301071 "ropey",
@@ -1243,7 +1084,7 @@ dependencies = [
12431084
12441085[[package]]
12451086name = "helix-dap"
1246−version = "0.6.0"
1087+version = "23.10.0"
12471088dependencies = [
12481089 "anyhow",
12491090 "fern",
@@ -1256,9 +1097,17 @@ dependencies = [
12561097 "which",
12571098]
12581099
1100+[[package]]
1101+name = "helix-event"
1102+version = "23.10.0"
1103+dependencies = [
1104+ "parking_lot",
1105+ "tokio",
1106+]
1107+
12591108[[package]]
12601109name = "helix-loader"
1261−version = "0.6.0"
1110+version = "23.10.0"
12621111dependencies = [
12631112 "anyhow",
12641113 "cc",
@@ -1277,7 +1126,7 @@ dependencies = [
12771126
12781127[[package]]
12791128name = "helix-lsp"
1280−version = "0.6.0"
1129+version = "23.10.0"
12811130dependencies = [
12821131 "anyhow",
12831132 "futures-executor",
@@ -1299,11 +1148,11 @@ dependencies = [
12991148
13001149[[package]]
13011150name = "helix-parsec"
1302−version = "0.6.0"
1151+version = "23.10.0"
13031152
13041153[[package]]
13051154name = "helix-term"
1306−version = "0.6.0"
1155+version = "23.10.0"
13071156dependencies = [
13081157 "anyhow",
13091158 "arc-swap",
@@ -1312,11 +1161,11 @@ dependencies = [
13121161 "crossterm",
13131162 "fern",
13141163 "futures-util",
1315− "fuzzy-matcher",
13161164 "grep-regex",
13171165 "grep-searcher",
13181166 "helix-core",
13191167 "helix-dap",
1168+ "helix-event",
13201169 "helix-loader",
13211170 "helix-lsp",
13221171 "helix-tui",
@@ -1326,7 +1175,9 @@ dependencies = [
13261175 "indoc",
13271176 "libc",
13281177 "log",
1178+ "nucleo",
13291179 "once_cell",
1180+ "open",
13301181 "pulldown-cmark",
13311182 "serde",
13321183 "serde_json",
@@ -1337,14 +1188,15 @@ dependencies = [
13371188 "tokio",
13381189 "tokio-stream",
13391190 "toml",
1191+ "url",
13401192 "which",
13411193]
13421194
13431195[[package]]
13441196name = "helix-tui"
1345−version = "0.6.0"
1197+version = "23.10.0"
13461198dependencies = [
1347− "bitflags 2.3.3",
1199+ "bitflags 2.4.1",
13481200 "cassowary",
13491201 "crossterm",
13501202 "helix-core",
@@ -1358,12 +1210,13 @@ dependencies = [
13581210
13591211[[package]]
13601212name = "helix-vcs"
1361−version = "0.6.0"
1213+version = "23.10.0"
13621214dependencies = [
13631215 "anyhow",
13641216 "arc-swap",
13651217 "gix",
13661218 "helix-core",
1219+ "helix-event",
13671220 "imara-diff",
13681221 "log",
13691222 "parking_lot",
@@ -1373,17 +1226,18 @@ dependencies = [
13731226
13741227[[package]]
13751228name = "helix-view"
1376−version = "0.6.0"
1229+version = "23.10.0"
13771230dependencies = [
13781231 "anyhow",
13791232 "arc-swap",
1380− "bitflags 2.3.3",
1233+ "bitflags 2.4.1",
13811234 "chardetng",
13821235 "clipboard-win",
13831236 "crossterm",
13841237 "futures-util",
13851238 "helix-core",
13861239 "helix-dap",
1240+ "helix-event",
13871241 "helix-loader",
13881242 "helix-lsp",
13891243 "helix-tui",
@@ -1392,7 +1246,7 @@ dependencies = [
13921246 "log",
13931247 "once_cell",
13941248 "parking_lot",
1395− "rustix 0.38.4",
1249+ "rustix",
13961250 "serde",
13971251 "serde_json",
13981252 "slotmap",
@@ -1412,25 +1266,13 @@ dependencies = [
14121266 "libc",
14131267]
14141268
1415−[[package]]
1416−name = "hermit-abi"
1417−version = "0.3.2"
1418−source = "registry+https://github.com/rust-lang/crates.io-index"
1419−checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
1420−
1421−[[package]]
1422−name = "hex"
1423−version = "0.4.3"
1424−source = "registry+https://github.com/rust-lang/crates.io-index"
1425−checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
1426−
14271269[[package]]
14281270name = "home"
1429−version = "0.5.4"
1271+version = "0.5.5"
14301272source = "registry+https://github.com/rust-lang/crates.io-index"
1431−checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408"
1273+checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
14321274dependencies = [
1433− "winapi",
1275+ "windows-sys 0.48.0",
14341276]
14351277
14361278[[package]]
@@ -1444,7 +1286,7 @@ dependencies = [
14441286 "iana-time-zone-haiku",
14451287 "js-sys",
14461288 "wasm-bindgen",
1447− "windows",
1289+ "windows 0.48.0",
14481290]
14491291
14501292[[package]]
@@ -1459,9 +1301,9 @@ dependencies = [
14591301
14601302[[package]]
14611303name = "idna"
1462−version = "0.4.0"
1304+version = "0.5.0"
14631305source = "registry+https://github.com/rust-lang/crates.io-index"
1464−checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
1306+checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
14651307dependencies = [
14661308 "unicode-bidi",
14671309 "unicode-normalization",
@@ -1469,17 +1311,16 @@ dependencies = [
14691311
14701312[[package]]
14711313name = "ignore"
1472−version = "0.4.20"
1314+version = "0.4.21"
14731315source = "registry+https://github.com/rust-lang/crates.io-index"
1474−checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
1316+checksum = "747ad1b4ae841a78e8aba0d63adbfbeaea26b517b63705d47856b73015d27060"
14751317dependencies = [
1318+ "crossbeam-deque",
14761319 "globset",
1477− "lazy_static",
14781320 "log",
14791321 "memchr",
1480− "regex",
1322+ "regex-automata",
14811323 "same-file",
1482− "thread_local",
14831324 "walkdir",
14841325 "winapi-util",
14851326]
@@ -1490,7 +1331,7 @@ version = "0.1.5"
14901331source = "registry+https://github.com/rust-lang/crates.io-index"
14911332checksum = "e98c1d0ad70fc91b8b9654b1f33db55e59579d3b3de2bffdced0fdb810570cb8"
14921333dependencies = [
1493− "ahash 0.8.3",
1334+ "ahash",
14941335 "hashbrown 0.12.3",
14951336]
14961337
@@ -1501,34 +1342,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
15011342checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
15021343dependencies = [
15031344 "equivalent",
1504− "hashbrown 0.14.0",
1345+ "hashbrown 0.14.3",
15051346]
15061347
15071348[[package]]
15081349name = "indoc"
1509−version = "2.0.3"
1350+version = "2.0.4"
15101351source = "registry+https://github.com/rust-lang/crates.io-index"
1511−checksum = "2c785eefb63ebd0e33416dfcb8d6da0bf27ce752843a45632a67bf10d4d4b5c4"
1352+checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
15121353
15131354[[package]]
1514−name = "io-close"
1515−version = "0.3.7"
1355+name = "is-docker"
1356+version = "0.2.0"
15161357source = "registry+https://github.com/rust-lang/crates.io-index"
1517−checksum = "9cadcf447f06744f8ce713d2d6239bb5bde2c357a452397a9ed90c625da390bc"
1358+checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"
15181359dependencies = [
1519− "libc",
1520− "winapi",
1360+ "once_cell",
15211361]
15221362
15231363[[package]]
1524−name = "io-lifetimes"
1525−version = "1.0.10"
1364+name = "is-wsl"
1365+version = "0.4.0"
15261366source = "registry+https://github.com/rust-lang/crates.io-index"
1527−checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
1367+checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"
15281368dependencies = [
1529− "hermit-abi 0.3.2",
1530− "libc",
1531− "windows-sys 0.48.0",
1369+ "is-docker",
1370+ "once_cell",
15321371]
15331372
15341373[[package]]
@@ -1546,32 +1385,17 @@ dependencies = [
15461385 "wasm-bindgen",
15471386]
15481387
1549−[[package]]
1550−name = "kstring"
1551−version = "2.0.0"
1552−source = "registry+https://github.com/rust-lang/crates.io-index"
1553−checksum = "ec3066350882a1cd6d950d055997f379ac37fd39f81cd4d8ed186032eb3c5747"
1554−dependencies = [
1555− "static_assertions",
1556−]
1557−
1558−[[package]]
1559−name = "lazy_static"
1560−version = "1.4.0"
1561−source = "registry+https://github.com/rust-lang/crates.io-index"
1562−checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
1563−
15641388[[package]]
15651389name = "libc"
1566−version = "0.2.147"
1390+version = "0.2.151"
15671391source = "registry+https://github.com/rust-lang/crates.io-index"
1568−checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
1392+checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
15691393
15701394[[package]]
15711395name = "libloading"
1572−version = "0.8.0"
1396+version = "0.8.1"
15731397source = "registry+https://github.com/rust-lang/crates.io-index"
1574−checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb"
1398+checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161"
15751399dependencies = [
15761400 "cfg-if",
15771401 "windows-sys 0.48.0",
@@ -1588,15 +1412,9 @@ dependencies = [
15881412
15891413[[package]]
15901414name = "linux-raw-sys"
1591−version = "0.3.4"
1592−source = "registry+https://github.com/rust-lang/crates.io-index"
1593−checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf"
1594−
1595−[[package]]
1596−name = "linux-raw-sys"
1597−version = "0.4.3"
1415+version = "0.4.11"
15981416source = "registry+https://github.com/rust-lang/crates.io-index"
1599−checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0"
1417+checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
16001418
16011419[[package]]
16021420name = "lock_api"
@@ -1610,15 +1428,15 @@ dependencies = [
16101428
16111429[[package]]
16121430name = "log"
1613−version = "0.4.19"
1431+version = "0.4.20"
16141432source = "registry+https://github.com/rust-lang/crates.io-index"
1615−checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
1433+checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
16161434
16171435[[package]]
16181436name = "lsp-types"
1619−version = "0.94.1"
1437+version = "0.95.0"
16201438source = "registry+https://github.com/rust-lang/crates.io-index"
1621−checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1"
1439+checksum = "158c1911354ef73e8fe42da6b10c0484cb65c7f1007f28022e847706c1ab6984"
16221440dependencies = [
16231441 "bitflags 1.3.2",
16241442 "serde",
@@ -1629,41 +1447,26 @@ dependencies = [
16291447
16301448[[package]]
16311449name = "memchr"
1632−version = "2.5.0"
1450+version = "2.6.3"
16331451source = "registry+https://github.com/rust-lang/crates.io-index"
1634−checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
1452+checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
16351453
16361454[[package]]
16371455name = "memmap2"
1638−version = "0.5.10"
1639−source = "registry+https://github.com/rust-lang/crates.io-index"
1640−checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327"
1641−dependencies = [
1642− "libc",
1643−]
1644−
1645−[[package]]
1646−name = "memmap2"
1647−version = "0.7.1"
1456+version = "0.9.0"
16481457source = "registry+https://github.com/rust-lang/crates.io-index"
1649−checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6"
1458+checksum = "deaba38d7abf1d4cca21cc89e932e542ba2b9258664d2a9ef0e61512039c9375"
16501459dependencies = [
16511460 "libc",
16521461]
16531462
16541463[[package]]
1655−name = "minimal-lexical"
1656−version = "0.2.1"
1657−source = "registry+https://github.com/rust-lang/crates.io-index"
1658−checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
1659−
1660−[[package]]
1661−name = "miniz_oxide"
1662−version = "0.6.2"
1464+name = "memoffset"
1465+version = "0.9.0"
16631466source = "registry+https://github.com/rust-lang/crates.io-index"
1664−checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
1467+checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
16651468dependencies = [
1666− "adler",
1469+ "autocfg",
16671470]
16681471
16691472[[package]]
@@ -1677,24 +1480,36 @@ dependencies = [
16771480
16781481[[package]]
16791482name = "mio"
1680−version = "0.8.6"
1483+version = "0.8.9"
16811484source = "registry+https://github.com/rust-lang/crates.io-index"
1682−checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
1485+checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0"
16831486dependencies = [
16841487 "libc",
16851488 "log",
16861489 "wasi",
1687− "windows-sys 0.45.0",
1490+ "windows-sys 0.48.0",
16881491]
16891492
16901493[[package]]
1691−name = "nom"
1692−version = "7.1.3"
1494+name = "nucleo"
1495+version = "0.2.1"
16931496source = "registry+https://github.com/rust-lang/crates.io-index"
1694−checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
1497+checksum = "ae5331f4bcce475cf28cb29c95366c3091af4b0aa7703f1a6bc858f29718fdf3"
16951498dependencies = [
1499+ "nucleo-matcher",
1500+ "parking_lot",
1501+ "rayon",
1502+]
1503+
1504+[[package]]
1505+name = "nucleo-matcher"
1506+version = "0.2.0"
1507+source = "registry+https://github.com/rust-lang/crates.io-index"
1508+checksum = "1b702b402fe286162d1f00b552a046ce74365d2ac473a2607ff36ba650f9bd57"
1509+dependencies = [
1510+ "cov-mark",
16961511 "memchr",
1697− "minimal-lexical",
1512+ "unicode-segmentation",
16981513]
16991514
17001515[[package]]
@@ -1712,7 +1527,7 @@ version = "1.15.0"
17121527source = "registry+https://github.com/rust-lang/crates.io-index"
17131528checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
17141529dependencies = [
1715− "hermit-abi 0.2.6",
1530+ "hermit-abi",
17161531 "libc",
17171532]
17181533
@@ -1736,9 +1551,20 @@ dependencies = [
17361551
17371552[[package]]
17381553name = "once_cell"
1739−version = "1.18.0"
1554+version = "1.19.0"
17401555source = "registry+https://github.com/rust-lang/crates.io-index"
1741−checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
1556+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
1557+
1558+[[package]]
1559+name = "open"
1560+version = "5.0.1"
1561+source = "registry+https://github.com/rust-lang/crates.io-index"
1562+checksum = "90878fb664448b54c4e592455ad02831e23a3f7e157374a8b95654731aac7349"
1563+dependencies = [
1564+ "is-wsl",
1565+ "libc",
1566+ "pathdiff",
1567+]
17421568
17431569[[package]]
17441570name = "parking_lot"
@@ -1763,17 +1589,23 @@ dependencies = [
17631589 "windows-sys 0.45.0",
17641590]
17651591
1592+[[package]]
1593+name = "pathdiff"
1594+version = "0.2.1"
1595+source = "registry+https://github.com/rust-lang/crates.io-index"
1596+checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
1597+
17661598[[package]]
17671599name = "percent-encoding"
1768−version = "2.3.0"
1600+version = "2.3.1"
17691601source = "registry+https://github.com/rust-lang/crates.io-index"
1770−checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
1602+checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
17711603
17721604[[package]]
17731605name = "pin-project-lite"
1774−version = "0.2.9"
1606+version = "0.2.12"
17751607source = "registry+https://github.com/rust-lang/crates.io-index"
1776−checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
1608+checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05"
17771609
17781610[[package]]
17791611name = "pin-utils"
@@ -1783,18 +1615,18 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
17831615
17841616[[package]]
17851617name = "proc-macro2"
1786−version = "1.0.63"
1618+version = "1.0.69"
17871619source = "registry+https://github.com/rust-lang/crates.io-index"
1788−checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb"
1620+checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
17891621dependencies = [
17901622 "unicode-ident",
17911623]
17921624
17931625[[package]]
17941626name = "prodash"
1795−version = "25.0.0"
1627+version = "28.0.0"
17961628source = "registry+https://github.com/rust-lang/crates.io-index"
1797−checksum = "3236ce1618b6da4c7b618e0143c4d5b5dc190f75f81c49f248221382f7e9e9ae"
1629+checksum = "744a264d26b88a6a7e37cbad97953fa233b94d585236310bcbc88474b4092d79"
17981630
17991631[[package]]
18001632name = "pulldown-cmark"
@@ -1843,6 +1675,28 @@ dependencies = [
18431675 "getrandom",
18441676]
18451677
1678+[[package]]
1679+name = "rayon"
1680+version = "1.7.0"
1681+source = "registry+https://github.com/rust-lang/crates.io-index"
1682+checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
1683+dependencies = [
1684+ "either",
1685+ "rayon-core",
1686+]
1687+
1688+[[package]]
1689+name = "rayon-core"
1690+version = "1.11.0"
1691+source = "registry+https://github.com/rust-lang/crates.io-index"
1692+checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
1693+dependencies = [
1694+ "crossbeam-channel",
1695+ "crossbeam-deque",
1696+ "crossbeam-utils",
1697+ "num_cpus",
1698+]
1699+
18461700[[package]]
18471701name = "redox_syscall"
18481702version = "0.2.16"
@@ -1854,53 +1708,47 @@ dependencies = [
18541708
18551709[[package]]
18561710name = "redox_syscall"
1857−version = "0.3.5"
1711+version = "0.4.1"
18581712source = "registry+https://github.com/rust-lang/crates.io-index"
1859−checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
1713+checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
18601714dependencies = [
18611715 "bitflags 1.3.2",
18621716]
18631717
18641718[[package]]
18651719name = "regex"
1866−version = "1.9.1"
1720+version = "1.10.2"
18671721source = "registry+https://github.com/rust-lang/crates.io-index"
1868−checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
1722+checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
18691723dependencies = [
1870− "aho-corasick 1.0.2",
1724+ "aho-corasick",
18711725 "memchr",
18721726 "regex-automata",
1873− "regex-syntax 0.7.3",
1727+ "regex-syntax",
18741728]
18751729
18761730[[package]]
18771731name = "regex-automata"
1878−version = "0.3.2"
1732+version = "0.4.3"
18791733source = "registry+https://github.com/rust-lang/crates.io-index"
1880−checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf"
1734+checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
18811735dependencies = [
1882− "aho-corasick 1.0.2",
1736+ "aho-corasick",
18831737 "memchr",
1884− "regex-syntax 0.7.3",
1738+ "regex-syntax",
18851739]
18861740
18871741[[package]]
18881742name = "regex-syntax"
1889−version = "0.6.29"
1890−source = "registry+https://github.com/rust-lang/crates.io-index"
1891−checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
1892−
1893−[[package]]
1894−name = "regex-syntax"
1895−version = "0.7.3"
1743+version = "0.8.2"
18961744source = "registry+https://github.com/rust-lang/crates.io-index"
1897−checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846"
1745+checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
18981746
18991747[[package]]
19001748name = "ropey"
1901−version = "1.6.0"
1749+version = "1.6.1"
19021750source = "registry+https://github.com/rust-lang/crates.io-index"
1903−checksum = "53ce7a2c43a32e50d666e33c5a80251b31147bb4b49024bcab11fb6f20c671ed"
1751+checksum = "93411e420bcd1a75ddd1dc3caf18c23155eda2c090631a85af21ba19e97093b5"
19041752dependencies = [
19051753 "smallvec",
19061754 "str_indices",
@@ -1914,29 +1762,15 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
19141762
19151763[[package]]
19161764name = "rustix"
1917−version = "0.37.15"
1765+version = "0.38.28"
19181766source = "registry+https://github.com/rust-lang/crates.io-index"
1919−checksum = "a0661814f891c57c930a610266415528da53c4933e6dea5fb350cbfe048a9ece"
1767+checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
19201768dependencies = [
1921− "bitflags 1.3.2",
1769+ "bitflags 2.4.1",
19221770 "errno",
1923− "io-lifetimes",
19241771 "libc",
1925− "linux-raw-sys 0.3.4",
1926− "windows-sys 0.48.0",
1927−]
1928−
1929−[[package]]
1930−name = "rustix"
1931−version = "0.38.4"
1932−source = "registry+https://github.com/rust-lang/crates.io-index"
1933−checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5"
1934−dependencies = [
1935− "bitflags 2.3.3",
1936− "errno",
1937− "libc",
1938− "linux-raw-sys 0.4.3",
1939− "windows-sys 0.48.0",
1772+ "linux-raw-sys",
1773+ "windows-sys 0.52.0",
19401774]
19411775
19421776[[package]]
@@ -1968,29 +1802,29 @@ checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1"
19681802
19691803[[package]]
19701804name = "serde"
1971−version = "1.0.183"
1805+version = "1.0.193"
19721806source = "registry+https://github.com/rust-lang/crates.io-index"
1973−checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c"
1807+checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
19741808dependencies = [
19751809 "serde_derive",
19761810]
19771811
19781812[[package]]
19791813name = "serde_derive"
1980−version = "1.0.183"
1814+version = "1.0.193"
19811815source = "registry+https://github.com/rust-lang/crates.io-index"
1982−checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816"
1816+checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
19831817dependencies = [
19841818 "proc-macro2",
19851819 "quote",
1986− "syn 2.0.28",
1820+ "syn 2.0.38",
19871821]
19881822
19891823[[package]]
19901824name = "serde_json"
1991−version = "1.0.104"
1825+version = "1.0.108"
19921826source = "registry+https://github.com/rust-lang/crates.io-index"
1993−checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
1827+checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
19941828dependencies = [
19951829 "itoa",
19961830 "ryu",
@@ -2005,7 +1839,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
20051839dependencies = [
20061840 "proc-macro2",
20071841 "quote",
2008− "syn 2.0.28",
1842+ "syn 2.0.38",
20091843]
20101844
20111845[[package]]
@@ -2076,18 +1910,18 @@ dependencies = [
20761910
20771911[[package]]
20781912name = "slotmap"
2079−version = "1.0.6"
1913+version = "1.0.7"
20801914source = "registry+https://github.com/rust-lang/crates.io-index"
2081−checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342"
1915+checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a"
20821916dependencies = [
20831917 "version_check",
20841918]
20851919
20861920[[package]]
20871921name = "smallvec"
2088−version = "1.11.0"
1922+version = "1.11.2"
20891923source = "registry+https://github.com/rust-lang/crates.io-index"
2090−checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
1924+checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
20911925
20921926[[package]]
20931927name = "smartstring"
@@ -2108,12 +1942,12 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
21081942
21091943[[package]]
21101944name = "socket2"
2111−version = "0.4.9"
1945+version = "0.5.5"
21121946source = "registry+https://github.com/rust-lang/crates.io-index"
2113−checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
1947+checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
21141948dependencies = [
21151949 "libc",
2116− "winapi",
1950+ "windows-sys 0.48.0",
21171951]
21181952
21191953[[package]]
@@ -2122,12 +1956,6 @@ version = "1.1.0"
21221956source = "registry+https://github.com/rust-lang/crates.io-index"
21231957checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
21241958
2125−[[package]]
2126−name = "str-buf"
2127−version = "1.0.6"
2128−source = "registry+https://github.com/rust-lang/crates.io-index"
2129−checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
2130−
21311959[[package]]
21321960name = "str_indices"
21331961version = "0.4.1"
@@ -2147,9 +1975,9 @@ dependencies = [
21471975
21481976[[package]]
21491977name = "syn"
2150−version = "2.0.28"
1978+version = "2.0.38"
21511979source = "registry+https://github.com/rust-lang/crates.io-index"
2152−checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
1980+checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
21531981dependencies = [
21541982 "proc-macro2",
21551983 "quote",
@@ -2158,14 +1986,14 @@ dependencies = [
21581986
21591987[[package]]
21601988name = "tempfile"
2161−version = "3.7.1"
1989+version = "3.8.1"
21621990source = "registry+https://github.com/rust-lang/crates.io-index"
2163−checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651"
1991+checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
21641992dependencies = [
21651993 "cfg-if",
21661994 "fastrand",
2167− "redox_syscall 0.3.5",
2168− "rustix 0.38.4",
1995+ "redox_syscall 0.4.1",
1996+ "rustix",
21691997 "windows-sys 0.48.0",
21701998]
21711999
@@ -2200,32 +2028,22 @@ dependencies = [
22002028
22012029[[package]]
22022030name = "thiserror"
2203−version = "1.0.44"
2031+version = "1.0.52"
22042032source = "registry+https://github.com/rust-lang/crates.io-index"
2205−checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
2033+checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d"
22062034dependencies = [
22072035 "thiserror-impl",
22082036]
22092037
22102038[[package]]
22112039name = "thiserror-impl"
2212−version = "1.0.44"
2040+version = "1.0.52"
22132041source = "registry+https://github.com/rust-lang/crates.io-index"
2214−checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
2042+checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3"
22152043dependencies = [
22162044 "proc-macro2",
22172045 "quote",
2218− "syn 2.0.28",
2219−]
2220−
2221−[[package]]
2222−name = "thread_local"
2223−version = "1.1.7"
2224−source = "registry+https://github.com/rust-lang/crates.io-index"
2225−checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
2226−dependencies = [
2227− "cfg-if",
2228− "once_cell",
2046+ "syn 2.0.38",
22292047]
22302048
22312049[[package]]
@@ -2239,9 +2057,9 @@ dependencies = [
22392057
22402058[[package]]
22412059name = "time"
2242−version = "0.3.20"
2060+version = "0.3.23"
22432061source = "registry+https://github.com/rust-lang/crates.io-index"
2244−checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890"
2062+checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446"
22452063dependencies = [
22462064 "itoa",
22472065 "libc",
@@ -2253,15 +2071,15 @@ dependencies = [
22532071
22542072[[package]]
22552073name = "time-core"
2256−version = "0.1.0"
2074+version = "0.1.1"
22572075source = "registry+https://github.com/rust-lang/crates.io-index"
2258−checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
2076+checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
22592077
22602078[[package]]
22612079name = "time-macros"
2262−version = "0.2.8"
2080+version = "0.2.10"
22632081source = "registry+https://github.com/rust-lang/crates.io-index"
2264−checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36"
2082+checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4"
22652083dependencies = [
22662084 "time-core",
22672085]
@@ -2283,11 +2101,10 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
22832101
22842102[[package]]
22852103name = "tokio"
2286−version = "1.29.1"
2104+version = "1.35.1"
22872105source = "registry+https://github.com/rust-lang/crates.io-index"
2288−checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da"
2106+checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
22892107dependencies = [
2290− "autocfg",
22912108 "backtrace",
22922109 "bytes",
22932110 "libc",
@@ -2303,13 +2120,13 @@ dependencies = [
23032120
23042121[[package]]
23052122name = "tokio-macros"
2306−version = "2.1.0"
2123+version = "2.2.0"
23072124source = "registry+https://github.com/rust-lang/crates.io-index"
2308−checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
2125+checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
23092126dependencies = [
23102127 "proc-macro2",
23112128 "quote",
2312− "syn 2.0.28",
2129+ "syn 2.0.38",
23132130]
23142131
23152132[[package]]
@@ -2354,13 +2171,13 @@ dependencies = [
23542171 "serde",
23552172 "serde_spanned",
23562173 "toml_datetime",
2357− "winnow",
2174+ "winnow 0.4.6",
23582175]
23592176
23602177[[package]]
23612178name = "tree-sitter"
23622179version = "0.20.10"
2363−source = "git+https://github.com/tree-sitter/tree-sitter?rev=7d4b0110a9e92161d247a051018ee42b0513e98d#7d4b0110a9e92161d247a051018ee42b0513e98d"
2180+source = "git+https://github.com/tree-sitter/tree-sitter?rev=ab09ae20d640711174b8da8a654f6b3dec93da1a#ab09ae20d640711174b8da8a654f6b3dec93da1a"
23642181dependencies = [
23652182 "cc",
23662183 "regex",
@@ -2401,13 +2218,9 @@ checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
24012218
24022219[[package]]
24032220name = "unicode-linebreak"
2404−version = "0.1.4"
2221+version = "0.1.5"
24052222source = "registry+https://github.com/rust-lang/crates.io-index"
2406−checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137"
2407−dependencies = [
2408− "hashbrown 0.12.3",
2409− "regex",
2410−]
2223+checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"
24112224
24122225[[package]]
24132226name = "unicode-normalization"
@@ -2426,15 +2239,15 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
24262239
24272240[[package]]
24282241name = "unicode-width"
2429−version = "0.1.10"
2242+version = "0.1.11"
24302243source = "registry+https://github.com/rust-lang/crates.io-index"
2431−checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
2244+checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
24322245
24332246[[package]]
24342247name = "url"
2435−version = "2.4.0"
2248+version = "2.5.0"
24362249source = "registry+https://github.com/rust-lang/crates.io-index"
2437−checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
2250+checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
24382251dependencies = [
24392252 "form_urlencoded",
24402253 "idna",
@@ -2450,9 +2263,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
24502263
24512264[[package]]
24522265name = "walkdir"
2453−version = "2.3.3"
2266+version = "2.4.0"
24542267source = "registry+https://github.com/rust-lang/crates.io-index"
2455−checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
2268+checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
24562269dependencies = [
24572270 "same-file",
24582271 "winapi-util",
@@ -2520,13 +2333,15 @@ checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
25202333
25212334[[package]]
25222335name = "which"
2523−version = "4.4.0"
2336+version = "5.0.0"
25242337source = "registry+https://github.com/rust-lang/crates.io-index"
2525−checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
2338+checksum = "9bf3ea8596f3a0dd5980b46430f2058dfe2c36a27ccfbb1845d6fbfcd9ba6e14"
25262339dependencies = [
25272340 "either",
2528− "libc",
2341+ "home",
25292342 "once_cell",
2343+ "rustix",
2344+ "windows-sys 0.48.0",
25302345]
25312346
25322347[[package]]
@@ -2569,6 +2384,25 @@ dependencies = [
25692384 "windows-targets 0.48.0",
25702385]
25712386
2387+[[package]]
2388+name = "windows"
2389+version = "0.52.0"
2390+source = "registry+https://github.com/rust-lang/crates.io-index"
2391+checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
2392+dependencies = [
2393+ "windows-core",
2394+ "windows-targets 0.52.0",
2395+]
2396+
2397+[[package]]
2398+name = "windows-core"
2399+version = "0.52.0"
2400+source = "registry+https://github.com/rust-lang/crates.io-index"
2401+checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
2402+dependencies = [
2403+ "windows-targets 0.52.0",
2404+]
2405+
25722406[[package]]
25732407name = "windows-sys"
25742408version = "0.45.0"
@@ -2587,6 +2421,15 @@ dependencies = [
25872421 "windows-targets 0.48.0",
25882422]
25892423
2424+[[package]]
2425+name = "windows-sys"
2426+version = "0.52.0"
2427+source = "registry+https://github.com/rust-lang/crates.io-index"
2428+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
2429+dependencies = [
2430+ "windows-targets 0.52.0",
2431+]
2432+
25902433[[package]]
25912434name = "windows-targets"
25922435version = "0.42.2"
@@ -2617,6 +2460,21 @@ dependencies = [
26172460 "windows_x86_64_msvc 0.48.0",
26182461]
26192462
2463+[[package]]
2464+name = "windows-targets"
2465+version = "0.52.0"
2466+source = "registry+https://github.com/rust-lang/crates.io-index"
2467+checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
2468+dependencies = [
2469+ "windows_aarch64_gnullvm 0.52.0",
2470+ "windows_aarch64_msvc 0.52.0",
2471+ "windows_i686_gnu 0.52.0",
2472+ "windows_i686_msvc 0.52.0",
2473+ "windows_x86_64_gnu 0.52.0",
2474+ "windows_x86_64_gnullvm 0.52.0",
2475+ "windows_x86_64_msvc 0.52.0",
2476+]
2477+
26202478[[package]]
26212479name = "windows_aarch64_gnullvm"
26222480version = "0.42.2"
@@ -2629,6 +2487,12 @@ version = "0.48.0"
26292487source = "registry+https://github.com/rust-lang/crates.io-index"
26302488checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
26312489
2490+[[package]]
2491+name = "windows_aarch64_gnullvm"
2492+version = "0.52.0"
2493+source = "registry+https://github.com/rust-lang/crates.io-index"
2494+checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
2495+
26322496[[package]]
26332497name = "windows_aarch64_msvc"
26342498version = "0.42.2"
@@ -2641,6 +2505,12 @@ version = "0.48.0"
26412505source = "registry+https://github.com/rust-lang/crates.io-index"
26422506checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
26432507
2508+[[package]]
2509+name = "windows_aarch64_msvc"
2510+version = "0.52.0"
2511+source = "registry+https://github.com/rust-lang/crates.io-index"
2512+checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
2513+
26442514[[package]]
26452515name = "windows_i686_gnu"
26462516version = "0.42.2"
@@ -2653,6 +2523,12 @@ version = "0.48.0"
26532523source = "registry+https://github.com/rust-lang/crates.io-index"
26542524checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
26552525
2526+[[package]]
2527+name = "windows_i686_gnu"
2528+version = "0.52.0"
2529+source = "registry+https://github.com/rust-lang/crates.io-index"
2530+checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
2531+
26562532[[package]]
26572533name = "windows_i686_msvc"
26582534version = "0.42.2"
@@ -2665,6 +2541,12 @@ version = "0.48.0"
26652541source = "registry+https://github.com/rust-lang/crates.io-index"
26662542checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
26672543
2544+[[package]]
2545+name = "windows_i686_msvc"
2546+version = "0.52.0"
2547+source = "registry+https://github.com/rust-lang/crates.io-index"
2548+checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
2549+
26682550[[package]]
26692551name = "windows_x86_64_gnu"
26702552version = "0.42.2"
@@ -2677,6 +2559,12 @@ version = "0.48.0"
26772559source = "registry+https://github.com/rust-lang/crates.io-index"
26782560checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
26792561
2562+[[package]]
2563+name = "windows_x86_64_gnu"
2564+version = "0.52.0"
2565+source = "registry+https://github.com/rust-lang/crates.io-index"
2566+checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
2567+
26802568[[package]]
26812569name = "windows_x86_64_gnullvm"
26822570version = "0.42.2"
@@ -2689,6 +2577,12 @@ version = "0.48.0"
26892577source = "registry+https://github.com/rust-lang/crates.io-index"
26902578checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
26912579
2580+[[package]]
2581+name = "windows_x86_64_gnullvm"
2582+version = "0.52.0"
2583+source = "registry+https://github.com/rust-lang/crates.io-index"
2584+checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
2585+
26922586[[package]]
26932587name = "windows_x86_64_msvc"
26942588version = "0.42.2"
@@ -2701,6 +2595,12 @@ version = "0.48.0"
27012595source = "registry+https://github.com/rust-lang/crates.io-index"
27022596checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
27032597
2598+[[package]]
2599+name = "windows_x86_64_msvc"
2600+version = "0.52.0"
2601+source = "registry+https://github.com/rust-lang/crates.io-index"
2602+checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
2603+
27042604[[package]]
27052605name = "winnow"
27062606version = "0.4.6"
@@ -2710,9 +2610,18 @@ dependencies = [
27102610 "memchr",
27112611]
27122612
2613+[[package]]
2614+name = "winnow"
2615+version = "0.5.28"
2616+source = "registry+https://github.com/rust-lang/crates.io-index"
2617+checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2"
2618+dependencies = [
2619+ "memchr",
2620+]
2621+
27132622[[package]]
27142623name = "xtask"
2715−version = "0.6.0"
2624+version = "23.10.0"
27162625dependencies = [
27172626 "helix-core",
27182627 "helix-loader",
@@ -2720,3 +2629,23 @@ dependencies = [
27202629 "helix-view",
27212630 "toml",
27222631]
2632+
2633+[[package]]
2634+name = "zerocopy"
2635+version = "0.7.31"
2636+source = "registry+https://github.com/rust-lang/crates.io-index"
2637+checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d"
2638+dependencies = [
2639+ "zerocopy-derive",
2640+]
2641+
2642+[[package]]
2643+name = "zerocopy-derive"
2644+version = "0.7.31"
2645+source = "registry+https://github.com/rust-lang/crates.io-index"
2646+checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a"
2647+dependencies = [
2648+ "proc-macro2",
2649+ "quote",
2650+ "syn 2.0.38",
2651+]
Cargo.toml+14−1
@@ -1,10 +1,12 @@
11[workspace]
2+resolver = "2"
23members = [
34 "helix-core",
45 "helix-view",
56 "helix-term",
67 "helix-tui",
78 "helix-lsp",
9+ "helix-event",
810 "helix-dap",
911 "helix-loader",
1012 "helix-vcs",
@@ -34,4 +36,15 @@ package.helix-tui.opt-level = 2
3436package.helix-term.opt-level = 2
3537
3638[workspace.dependencies]
37−tree-sitter = { version = "0.20", git = "https://github.com/tree-sitter/tree-sitter", rev = "7d4b0110a9e92161d247a051018ee42b0513e98d" }
39+tree-sitter = { version = "0.20", git = "https://github.com/tree-sitter/tree-sitter", rev = "ab09ae20d640711174b8da8a654f6b3dec93da1a" }
40+nucleo = "0.2.0"
41+
42+[workspace.package]
43+version = "23.10.0"
44+edition = "2021"
45+authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
46+categories = ["editor"]
47+repository = "https://github.com/helix-editor/helix"
48+homepage = "https://helix-editor.com"
49+license = "MPL-2.0"
50+rust-version = "1.70"
README.md+1−1
@@ -18,7 +18,7 @@
1818
1919![Screenshot](./screenshot.png)
2020
21−A Kakoune / Neovim inspired editor, written in Rust.
21+A [Kakoune](https://github.com/mawww/kakoune) / [Neovim](https://github.com/neovim/neovim) inspired editor, written in Rust.
2222
2323The editing model is very heavily based on Kakoune; during development I found
2424myself agreeing with most of Kakoune's design decisions.
VERSIONdeleted−1
@@ -1 +0,0 @@
1−23.05
book/custom.css+1−1
@@ -164,7 +164,7 @@ code.hljs {
164164 --searchresults-header-fg: #5f5f71;
165165 --searchresults-border-color: #5c5c68;
166166 --searchresults-li-bg: #242430;
167− --search-mark-bg: #acff5;
167+ --search-mark-bg: #a2cff5;
168168}
169169
170170.colibri .content .header {
book/src/configuration.md+27−9
@@ -51,7 +51,7 @@ Its settings will be merged with the configuration directory `config.toml` and t
5151| `auto-completion` | Enable automatic pop up of auto-completion | `true` |
5252| `auto-format` | Enable automatic formatting on save | `true` |
5353| `auto-save` | Enable automatic saving on the focus moving away from Helix. Requires [focus event support](https://github.com/helix-editor/helix/wiki/Terminal-Support) from your terminal | `false` |
54−| `idle-timeout` | Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant | `400` |
54+| `idle-timeout` | Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant | `250` |
5555| `preview-completion-insert` | Whether to apply completion item instantly when selected | `true` |
5656| `completion-trigger-len` | The min-length of word under cursor to trigger autocompletion | `2` |
5757| `completion-replace` | Set to `true` to make completions always replace the entire word and not just the part before the cursor | `false` |
@@ -64,6 +64,9 @@ Its settings will be merged with the configuration directory `config.toml` and t
6464| `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap-at-text-width` is set | `80` |
6565| `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml` | `[]` |
6666| `default-line-ending` | The line ending to use for new documents. Can be `native`, `lf`, `crlf`, `ff`, `cr` or `nel`. `native` uses the platform's native line ending (`crlf` on Windows, otherwise `lf`). | `native` |
67+| `insert-final-newline` | Whether to automatically insert a trailing line-ending on write if missing | `true` |
68+| `popup-border` | Draw border around `popup`, `menu`, `all`, or `none` | `none` |
69+| `indent-heuristic` | How the indentation for a newly inserted line is computed: `simple` just copies the indentation level from the previous line, `tree-sitter` computes the indentation based on the syntax tree and `hybrid` combines both approaches. If the chosen heuristic is not available, a different one will be used as a fallback (the fallback order being `hybrid` -> `tree-sitter` -> `simple`). | `hybrid`
6770
6871### `[editor.statusline]` Section
6972
@@ -165,16 +168,31 @@ All git related options are only enabled in a git repository.
165168
166169| Key | Description | Default |
167170|--|--|---------|
168−|`hidden` | Enables ignoring hidden files | true
169−|`follow-symlinks` | Follow symlinks instead of ignoring them | true
170−|`deduplicate-links` | Ignore symlinks that point at files already shown in the picker | true
171−|`parents` | Enables reading ignore files from parent directories | true
172−|`ignore` | Enables reading `.ignore` files | true
173−|`git-ignore` | Enables reading `.gitignore` files | true
174−|`git-global` | Enables reading global `.gitignore`, whose path is specified in git's config: `core.excludefile` option | true
175−|`git-exclude` | Enables reading `.git/info/exclude` files | true
171+|`hidden` | Enables ignoring hidden files | `true`
172+|`follow-symlinks` | Follow symlinks instead of ignoring them | `true`
173+|`deduplicate-links` | Ignore symlinks that point at files already shown in the picker | `true`
174+|`parents` | Enables reading ignore files from parent directories | `true`
175+|`ignore` | Enables reading `.ignore` files | `true`
176+|`git-ignore` | Enables reading `.gitignore` files | `true`
177+|`git-global` | Enables reading global `.gitignore`, whose path is specified in git's config: `core.excludesfile` option | `true`
178+|`git-exclude` | Enables reading `.git/info/exclude` files | `true`
176179|`max-depth` | Set with an integer value for maximum depth to recurse | Defaults to `None`.
177180
181+Ignore files can be placed locally as `.ignore` or put in your home directory as `~/.ignore`. They support the usual ignore and negative ignore (unignore) rules used in `.gitignore` files.
182+
183+Additionally, you can use Helix-specific ignore files by creating a local `.helix/ignore` file in the current workspace or a global `ignore` file located in your Helix config directory:
184+- Linux and Mac: `~/.config/helix/ignore`
185+- Windows: `%AppData%\helix\ignore`
186+
187+Example:
188+
189+```ini
190+# unignore in file picker and global search
191+!.github/
192+!.gitignore
193+!.gitattributes
194+```
195+
178196### `[editor.auto-pairs]` Section
179197
180198Enables automatic insertion of pairs to parentheses, brackets, etc. Can be a
book/src/generated/lang-support.md+28−11
@@ -1,5 +1,6 @@
11| Language | Syntax Highlighting | Treesitter Textobjects | Auto Indent | Default LSP |
22| --- | --- | --- | --- | --- |
3+| agda | ✓ | | | |
34| astro | ✓ | | | |
45| awk | ✓ | ✓ | | `awk-language-server` |
56| bash | ✓ | ✓ | ✓ | `bash-language-server` |
@@ -10,13 +11,13 @@
1011| blueprint | ✓ | | | `blueprint-compiler` |
1112| c | ✓ | ✓ | ✓ | `clangd` |
1213| c-sharp | ✓ | ✓ | | `OmniSharp` |
13−| cabal | | | | |
14+| cabal | | | | `haskell-language-server-wrapper` |
1415| cairo | ✓ | ✓ | ✓ | `cairo-language-server` |
1516| capnp | ✓ | | ✓ | |
1617| clojure | ✓ | | | `clojure-lsp` |
1718| cmake | ✓ | ✓ | ✓ | `cmake-language-server` |
1819| comment | ✓ | | | |
19−| common-lisp | ✓ | | | `cl-lsp` |
20+| common-lisp | ✓ | | ✓ | `cl-lsp` |
2021| cpon | ✓ | | ✓ | |
2122| cpp | ✓ | ✓ | ✓ | `clangd` |
2223| crystal | ✓ | ✓ | | `crystalline` |
@@ -24,6 +25,7 @@
2425| cue | ✓ | | | `cuelsp` |
2526| d | ✓ | ✓ | ✓ | `serve-d` |
2627| dart | ✓ | | ✓ | `dart` |
28+| dbml | ✓ | | | |
2729| devicetree | ✓ | | | |
2830| dhall | ✓ | ✓ | | `dhall-lsp-server` |
2931| diff | ✓ | | | |
@@ -44,7 +46,9 @@
4446| forth | ✓ | | | `forth-lsp` |
4547| fortran | ✓ | | ✓ | `fortls` |
4648| fsharp | ✓ | | | `fsautocomplete` |
49+| gas | ✓ | ✓ | | |
4750| gdscript | ✓ | ✓ | ✓ | |
51+| gemini | ✓ | | | |
4852| git-attributes | ✓ | | | |
4953| git-commit | ✓ | ✓ | | |
5054| git-config | ✓ | | | |
@@ -52,12 +56,13 @@
5256| git-rebase | ✓ | | | |
5357| gleam | ✓ | ✓ | | `gleam` |
5458| glsl | ✓ | ✓ | ✓ | |
55−| go | ✓ | ✓ | ✓ | `gopls` |
59+| gn | ✓ | | | |
60+| go | ✓ | ✓ | ✓ | `gopls`, `golangci-lint-langserver` |
5661| godot-resource | ✓ | | | |
5762| gomod | ✓ | | | `gopls` |
5863| gotmpl | ✓ | | | `gopls` |
5964| gowork | ✓ | | | `gopls` |
60−| graphql | ✓ | | | |
65+| graphql | ✓ | | | `graphql-lsp` |
6166| hare | ✓ | | | |
6267| haskell | ✓ | ✓ | | `haskell-language-server-wrapper` |
6368| haskell-persistent | ✓ | | | |
@@ -69,15 +74,18 @@
6974| idris | | | | `idris2-lsp` |
7075| iex | ✓ | | | |
7176| ini | ✓ | | | |
77+| janet | ✓ | | | |
7278| java | ✓ | ✓ | ✓ | `jdtls` |
7379| javascript | ✓ | ✓ | ✓ | `typescript-language-server` |
80+| jinja | ✓ | | | |
7481| jsdoc | ✓ | | | |
7582| json | ✓ | | ✓ | `vscode-json-language-server` |
83+| json5 | ✓ | | | |
7684| jsonnet | ✓ | | | `jsonnet-language-server` |
7785| jsx | ✓ | ✓ | ✓ | `typescript-language-server` |
7886| julia | ✓ | ✓ | ✓ | `julia` |
7987| just | ✓ | ✓ | ✓ | |
80−| kdl | ✓ | | | |
88+| kdl | ✓ | ✓ | ✓ | |
8189| kotlin | ✓ | | | `kotlin-language-server` |
8290| latex | ✓ | ✓ | | `texlab` |
8391| lean | ✓ | | | `lean` |
@@ -85,6 +93,8 @@
8593| llvm | ✓ | ✓ | ✓ | |
8694| llvm-mir | ✓ | ✓ | ✓ | |
8795| llvm-mir-yaml | ✓ | | ✓ | |
96+| log | ✓ | | | |
97+| lpf | ✓ | | | |
8898| lua | ✓ | ✓ | ✓ | `lua-language-server` |
8999| make | ✓ | | | |
90100| markdoc | ✓ | | | `markdoc-ls` |
@@ -99,7 +109,8 @@
99109| nickel | ✓ | | ✓ | `nls` |
100110| nim | ✓ | ✓ | ✓ | `nimlangserver` |
101111| nix | ✓ | | | `nil` |
102−| nu | ✓ | | | |
112+| nu | ✓ | | | `nu` |
113+| nunjucks | ✓ | | | |
103114| ocaml | ✓ | | ✓ | `ocamllsp` |
104115| ocaml-interface | ✓ | | | `ocamllsp` |
105116| odin | ✓ | | ✓ | `ols` |
@@ -109,19 +120,20 @@
109120| pascal | ✓ | ✓ | | `pasls` |
110121| passwd | ✓ | | | |
111122| pem | ✓ | | | |
112−| perl | ✓ | | | `perlnavigator` |
123+| perl | ✓ | ✓ | ✓ | `perlnavigator` |
113124| php | ✓ | ✓ | ✓ | `intelephense` |
114125| po | ✓ | ✓ | | |
126+| pod | ✓ | | | |
115127| ponylang | ✓ | ✓ | ✓ | |
116128| prisma | ✓ | | | `prisma-language-server` |
117129| prolog | | | | `swipl` |
118130| protobuf | ✓ | | ✓ | `bufls`, `pb` |
119131| prql | ✓ | | | |
120−| purescript | ✓ | | | `purescript-language-server` |
132+| purescript | ✓ | ✓ | | `purescript-language-server` |
121133| python | ✓ | ✓ | ✓ | `pylsp` |
122134| qml | ✓ | | ✓ | `qmlls` |
123135| r | ✓ | | | `R` |
124−| racket | ✓ | | | `racket` |
136+| racket | ✓ | | ✓ | `racket` |
125137| regex | ✓ | | | |
126138| rego | ✓ | | | `regols` |
127139| rescript | ✓ | ✓ | | `rescript-language-server` |
@@ -133,27 +145,32 @@
133145| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
134146| sage | ✓ | ✓ | | |
135147| scala | ✓ | | ✓ | `metals` |
136−| scheme | ✓ | | | |
148+| scheme | ✓ | | ✓ | |
137149| scss | ✓ | | | `vscode-css-language-server` |
138150| slint | ✓ | | ✓ | `slint-lsp` |
151+| smali | ✓ | | ✓ | |
139152| smithy | ✓ | | | `cs` |
140153| sml | ✓ | | | |
141154| solidity | ✓ | | | `solc` |
142155| sql | ✓ | | | |
143156| sshclientconfig | ✓ | | | |
144157| starlark | ✓ | ✓ | | |
158+| strace | ✓ | | | |
145159| svelte | ✓ | | ✓ | `svelteserver` |
146160| sway | ✓ | ✓ | ✓ | `forc` |
147161| swift | ✓ | | | `sourcekit-lsp` |
148162| t32 | ✓ | | | |
149163| tablegen | ✓ | ✓ | ✓ | |
150164| task | ✓ | | | |
165+| templ | ✓ | | | `templ` |
151166| tfvars | ✓ | | ✓ | `terraform-ls` |
167+| todotxt | ✓ | | | |
152168| toml | ✓ | | | `taplo` |
153169| tsq | ✓ | | | |
154170| tsx | ✓ | ✓ | ✓ | `typescript-language-server` |
155171| twig | ✓ | | | |
156172| typescript | ✓ | ✓ | ✓ | `typescript-language-server` |
173+| typst | ✓ | | | `typst-lsp` |
157174| ungrammar | ✓ | | | |
158175| unison | ✓ | | | |
159176| uxntal | ✓ | | | |
@@ -171,6 +188,6 @@
171188| wren | ✓ | ✓ | ✓ | |
172189| xit | ✓ | | | |
173190| xml | ✓ | | ✓ | |
174−| yaml | ✓ | | ✓ | `yaml-language-server` |
191+| yaml | ✓ | | ✓ | `yaml-language-server`, `ansible-language-server` |
175192| yuck | ✓ | | | |
176193| zig | ✓ | ✓ | ✓ | `zls` |
book/src/generated/typable-cmd.md+4−1
@@ -17,7 +17,7 @@
1717| `:write-buffer-close!`, `:wbc!` | Force write changes to disk creating necessary subdirectories and closes the buffer. Accepts an optional path (:write-buffer-close! some/path.txt) |
1818| `:new`, `:n` | Create a new scratch buffer. |
1919| `:format`, `:fmt` | Format the file using the LSP formatter. |
20−| `:indent-style` | Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.) |
20+| `:indent-style` | Set the indentation style for editing. ('t' for tabs or 1-16 for number of spaces.) |
2121| `:line-ending` | Set the document's default line ending. Options: crlf, lf. |
2222| `:earlier`, `:ear` | Jump back to an earlier point in edit history. Accepts a number of steps or a time span. |
2323| `:later`, `:lat` | Jump to a later point in edit history. Accepts a number of steps or a time span. |
@@ -55,6 +55,7 @@
5555| `:lsp-restart` | Restarts the language servers used by the current doc |
5656| `:lsp-stop` | Stops the language servers that are used by the current doc |
5757| `:tree-sitter-scopes` | Display tree sitter scopes, primarily for theming and development. |
58+| `:tree-sitter-highlight-name` | Display name of tree-sitter highlight scope under the cursor. |
5859| `:debug-start`, `:dbg` | Start a debug session from a given template with given parameters. |
5960| `:debug-remote`, `:dbg-tcp` | Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters. |
6061| `:debug-eval` | Evaluate expression in current debug context. |
@@ -83,3 +84,5 @@
8384| `:run-shell-command`, `:sh` | Run a shell command |
8485| `:reset-diff-change`, `:diffget`, `:diffg` | Reset the diff change at the cursor position. |
8586| `:clear-register` | Clear given register. If no argument is provided, clear all registers. |
87+| `:redraw` | Clear and re-render the whole UI |
88+| `:move` | Move the current buffer and its corresponding file to a different path |
book/src/guides/adding_languages.md+2
@@ -36,6 +36,7 @@ below.
36363. Refer to the
3737 [tree-sitter website](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#queries)
3838 for more information on writing queries.
39+4. A list of highlight captures can be found [on the themes page](https://docs.helix-editor.com/themes.html#scopes).
3940
4041> 💡 In Helix, the first matching query takes precedence when evaluating
4142> queries, which is different from other editors such as Neovim where the last
@@ -51,3 +52,4 @@ below.
5152 grammars.
5253- If a parser is causing a segfault, or you want to remove it, make sure to
5354 remove the compiled parser located at `runtime/grammars/<name>.so`.
55+- If you are attempting to add queries and Helix is unable to locate them, ensure that the environment variable `HELIX_RUNTIME` is set to the location of the `runtime` folder you're developing in.
book/src/guides/indent.md+319−43
@@ -1,76 +1,308 @@
11# Adding indent queries
22
3−Helix uses tree-sitter to correctly indent new lines. This requires
4−a tree-sitter grammar and an `indent.scm` query file placed in
5−`runtime/queries/{language}/indents.scm`. The indentation for a line
6−is calculated by traversing the syntax tree from the lowest node at the
7−beginning of the new line. Each of these nodes contributes to the total
8−indent when it is captured by the query (in what way depends on the name
9−of the capture).
3+Helix uses tree-sitter to correctly indent new lines. This requires a tree-
4+sitter grammar and an `indent.scm` query file placed in `runtime/queries/
5+{language}/indents.scm`. The indentation for a line is calculated by traversing
6+the syntax tree from the lowest node at the beginning of the new line (see
7+[Indent queries](#indent-queries)). Each of these nodes contributes to the total
8+indent when it is captured by the query (in what way depends on the name of
9+the capture.
1010
1111Note that it matters where these added indents begin. For example,
1212multiple indent level increases that start on the same line only increase
13−the total indent level by 1.
13+the total indent level by 1. See [Capture types](#capture-types).
1414
15−## Scopes
15+By default, Helix uses the `hybrid` indentation heuristic. This means that
16+indent queries are not used to compute the expected absolute indentation of a
17+line but rather the expected difference in indentation between the new and an
18+already existing line. This difference is then added to the actual indentation
19+of the already existing line. Since this makes errors in the indent queries
20+harder to find, it is recommended to disable it when testing via
21+`:set indent-heuristic tree-sitter`. The rest of this guide assumes that
22+the `tree-sitter` heuristic is used.
1623
17−Added indents don't always apply to the whole node. For example, in most
18−cases when a node should be indented, we actually only want everything
19−except for its first line to be indented. For this, there are several
20−scopes (more scopes may be added in the future if required):
24+## Indent queries
2125
22−- `all`:
23−This scope applies to the whole captured node. This is only different from
24−`tail` when the captured node is the first node on its line.
26+When Helix is inserting a new line through `o`, `O`, or `<ret>`, to determine
27+the indent level for the new line, the query in `indents.scm` is run on the
28+document. The starting position of the query is the end of the line above where
29+a new line will be inserted.
2530
26−- `tail`:
27−This scope applies to everything except for the first line of the
28−captured node.
31+For `o`, the inserted line is the line below the cursor, so that starting
32+position of the query is the end of the current line.
2933
30−Every capture type has a default scope which should do the right thing
31−in most situations. When a different scope is required, this can be
32−changed by using a `#set!` declaration anywhere in the pattern:
33−```scm
34−(assignment_expression
35− right: (_) @indent
36− (#set! "scope" "all"))
34+```rust
35+fn need_hero(some_hero: Hero, life: Life) -> {
36+ matches!(some_hero, Hero { // ←─────────────────╮
37+ strong: true,//←╮ ↑ ↑ │
38+ fast: true, // │ │ ╰── query start │
39+ sure: true, // │ ╰───── cursor ├─ traversal
40+ soon: true, // ╰──────── new line inserted │ start node
41+ }) && // │
42+// ↑ │
43+// ╰───────────────────────────────────────────────╯
44+ some_hero > life
45+}
3746```
3847
39−## Capture types
48+For `O`, the newly inserted line is the *current* line, so the starting position
49+of the query is the end of the line above the cursor.
4050
41−- `@indent` (default scope `tail`):
42−Increase the indent level by 1. Multiple occurrences in the same line
43−don't stack. If there is at least one `@indent` and one `@outdent`
44−capture on the same line, the indent level isn't changed at all.
51+```rust
52+fn need_hero(some_hero: Hero, life: Life) -> { // ←─╮
53+ matches!(some_hero, Hero { // ←╮ ↑ │
54+ strong: true,// ↑ ╭───╯ │ │
55+ fast: true, // │ │ query start ─╯ │
56+ sure: true, // ╰───┼ cursor ├─ traversal
57+ soon: true, // ╰ new line inserted │ start node
58+ }) && // │
59+ some_hero > life // │
60+} // ←──────────────────────────────────────────────╯
61+```
4562
46−- `@outdent` (default scope `all`):
47−Decrease the indent level by 1. The same rules as for `@indent` apply.
63+From this starting node, the syntax tree is traversed up until the root node.
64+Each indent capture is collected along the way, and then combined according to
65+their [capture types](#capture-types) and [scopes](#scopes) to a final indent
66+level for the line.
4867
49−- `@extend`:
50−Extend the range of this node to the end of the line and to lines that
51−are indented more than the line that this node starts on. This is useful
52−for languages like Python, where for the purpose of indentation some nodes
53−(like functions or classes) should also contain indented lines that follow them.
68+### Capture types
5469
70+- `@indent` (default scope `tail`):
71+ Increase the indent level by 1. Multiple occurrences in the same line *do not*
72+ stack. If there is at least one `@indent` and one `@outdent` capture on the
73+ same line, the indent level isn't changed at all.
74+- `@outdent` (default scope `all`):
75+ Decrease the indent level by 1. The same rules as for `@indent` apply.
76+- `@indent.always` (default scope `tail`):
77+ Increase the indent level by 1. Multiple occurrences on the same line *do*
78+ stack. The final indent level is `@indent.always` – `@outdent.always`. If
79+ an `@indent` and an `@indent.always` are on the same line, the `@indent` is
80+ ignored.
81+- `@outdent.always` (default scope `all`):
82+ Decrease the indent level by 1. The same rules as for `@indent.always` apply.
83+- `@align` (default scope `all`):
84+ Align everything inside this node to some anchor. The anchor is given
85+ by the start of the node captured by `@anchor` in the same pattern.
86+ Every pattern with an `@align` should contain exactly one `@anchor`.
87+ Indent (and outdent) for nodes below (in terms of their starting line)
88+ the `@align` node is added to the indentation required for alignment.
89+- `@extend`:
90+ Extend the range of this node to the end of the line and to lines that are
91+ indented more than the line that this node starts on. This is useful for
92+ languages like Python, where for the purpose of indentation some nodes (like
93+ functions or classes) should also contain indented lines that follow them.
5594- `@extend.prevent-once`:
56−Prevents the first extension of an ancestor of this node. For example, in Python
57−a return expression always ends the block that it is in. Note that this only stops the
58−extension of the next `@extend` capture. If multiple ancestors are captured,
59−only the extension of the innermost one is prevented. All other ancestors are unaffected
60−(regardless of whether the innermost ancestor would actually have been extended).
95+ Prevents the first extension of an ancestor of this node. For example, in Python
96+ a return expression always ends the block that it is in. Note that this only
97+ stops the extension of the next `@extend` capture. If multiple ancestors are
98+ captured, only the extension of the innermost one is prevented. All other
99+ ancestors are unaffected (regardless of whether the innermost ancestor would
100+ actually have been extended).
101+
102+#### `@indent` / `@outdent`
103+
104+Consider this example:
105+
106+```rust
107+fn shout(things: Vec<Thing>) {
108+ // ↑
109+ // ├───────────────────────╮ indent level
110+ // @indent ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄
111+ // │
112+ let it_all = |out| { things.filter(|thing| { // │ 1
113+ // ↑ ↑ │
114+ // ├───────────────────────┼─────┼┄┄┄┄┄┄┄┄┄┄┄┄┄┄
115+ // @indent @indent │
116+ // │ 2
117+ thing.can_do_with(out) // │
118+ })}; // ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄
119+ //↑↑↑ │ 1
120+} //╰┼┴──────────────────────────────────────────────┴┄┄┄┄┄┄┄┄┄┄┄┄┄┄
121+// 3x @outdent
122+```
123+
124+```scm
125+((block) @indent)
126+["}" ")"] @outdent
127+```
128+
129+Note how on the second line, we have two blocks begin on the same line. In this
130+case, since both captures occur on the same line, they are combined and only
131+result in a net increase of 1. Also note that the closing `}`s are part of the
132+`@indent` captures, but the 3 `@outdent`s also combine into 1 and result in that
133+line losing one indent level.
134+
135+#### `@extend` / `@extend.prevent-once`
136+
137+For an example of where `@extend` can be useful, consider Python, which is
138+whitespace-sensitive.
139+
140+```scm
141+]
142+ (parenthesized_expression)
143+ (function_definition)
144+ (class_definition)
145+] @indent
146+
147+```
148+
149+```python
150+class Hero:
151+ def __init__(self, strong, fast, sure, soon):# ←─╮
152+ self.is_strong = strong # │
153+ self.is_fast = fast # ╭─── query start │
154+ self.is_sure = sure # │ ╭─ cursor │
155+ self.is_soon = soon # │ │ │
156+ # ↑ ↑ │ │ │
157+ # │ ╰──────╯ │ │
158+ # ╰─────────────────────╯ │
159+ # ├─ traversal
160+ def need_hero(self, life): # │ start node
161+ return ( # │
162+ self.is_strong # │
163+ and self.is_fast # │
164+ and self.is_sure # │
165+ and self.is_soon # │
166+ and self > life # │
167+ ) # ←─────────────────────────────────────────╯
168+```
169+
170+Without braces to catch the scope of the function, the smallest descendant of
171+the cursor on a line feed ends up being the entire inside of the class. Because
172+of this, it will miss the entire function node and its indent capture, leading
173+to an indent level one too small.
174+
175+To address this case, `@extend` tells helix to "extend" the captured node's span
176+to the line feed and every consecutive line that has a greater indent level than
177+the line of the node.
178+
179+```scm
180+(parenthesized_expression) @indent
181+
182+]
183+ (function_definition)
184+ (class_definition)
185+] @indent @extend
186+
187+```
188+
189+```python
190+class Hero:
191+ def __init__(self, strong, fast, sure, soon):# ←─╮
192+ self.is_strong = strong # │
193+ self.is_fast = fast # ╭─── query start ├─ traversal
194+ self.is_sure = sure # │ ╭─ cursor │ start node
195+ self.is_soon = soon # │ │ ←───────────────╯
196+ # ↑ ↑ │ │
197+ # │ ╰──────╯ │
198+ # ╰─────────────────────╯
199+ def need_hero(self, life):
200+ return (
201+ self.is_strong
202+ and self.is_fast
203+ and self.is_sure
204+ and self.is_soon
205+ and self > life
206+ )
207+```
61208
209+Furthermore, there are some cases where extending to everything with a greater
210+indent level may not be desirable. Consider the `need_hero` function above. If
211+our cursor is on the last line of the returned expression.
212+
213+```python
214+class Hero:
215+ def __init__(self, strong, fast, sure, soon):
216+ self.is_strong = strong
217+ self.is_fast = fast
218+ self.is_sure = sure
219+ self.is_soon = soon
220+
221+ def need_hero(self, life):
222+ return (
223+ self.is_strong
224+ and self.is_fast
225+ and self.is_sure
226+ and self.is_soon
227+ and self > life
228+ ) # ←─── cursor
229+ #←────────── where cursor should go on new line
230+```
231+
232+In Python, the are a few tokens that will always end a scope, such as a return
233+statement. Since the scope ends, so should the indent level. But because the
234+function span is extended to every line with a greater indent level, a new line
235+would just continue on the same level. And an `@outdent` would not help us here
236+either, since it would cause everything in the parentheses to become outdented
237+as well.
238+
239+To help, we need to signal an end to the extension. We can do this with
240+`@extend.prevent-once`.
241+
242+```scm
243+(parenthesized_expression) @indent
244+
245+]
246+ (function_definition)
247+ (class_definition)
248+] @indent @extend
249+
250+(return_statement) @extend.prevent-once
251+```
252+
253+#### `@indent.always` / `@outdent.always`
254+
255+As mentioned before, normally if there is more than one `@indent` or `@outdent`
256+capture on the same line, they are combined.
257+
258+Sometimes, there are cases when you may want to ensure that every indent capture
259+is additive, regardless of how many occur on the same line. Consider this
260+example in YAML.
261+
262+```yaml
263+ - foo: bar
264+# ↑ ↑
265+# │ ╰─────────────── start of map
266+# ╰───────────────── start of list element
267+ baz: quux # ←─── cursor
268+ # ←───────────── where the cursor should go on a new line
269+ garply: waldo
270+ - quux:
271+ bar: baz
272+ xyzzy: thud
273+ fred: plugh
274+```
275+
276+In YAML, you often have lists of maps. In these cases, the syntax is such that
277+the list element and the map both start on the same line. But we really do want
278+to start an indentation for each of these so that subsequent keys in the map
279+hang over the list and align properly. This is where `@indent.always` helps.
280+
281+```scm
282+((block_sequence_item) @item @indent.always @extend
283+ (#not-one-line? @item))
284+
285+((block_mapping_pair
286+ key: (_) @key
287+ value: (_) @val
288+ (#not-same-line? @key @val)
289+ ) @indent.always @extend
290+)
291+```
62292
63293## Predicates
64294
65295In some cases, an S-expression cannot express exactly what pattern should be matched.
66296For that, tree-sitter allows for predicates to appear anywhere within a pattern,
67297similar to how `#set!` declarations work:
298+
68299```scm
69300(some_kind
70301 (child_kind) @indent
71302 (#predicate? arg1 arg2 ...)
72303)
73304```
305+
74306The number of arguments depends on the predicate that's used.
75307Each argument is either a capture (`@name`) or a string (`"some string"`).
76308The following predicates are supported by tree-sitter:
@@ -91,3 +323,47 @@ argument (a string).
91323
92324- `#same-line?`/`#not-same-line?`:
93325The captures given by the 2 arguments must/must not start on the same line.
326+
327+- `#one-line?`/`#not-one-line?`:
328+The captures given by the fist argument must/must span a total of one line.
329+
330+### Scopes
331+
332+Added indents don't always apply to the whole node. For example, in most
333+cases when a node should be indented, we actually only want everything
334+except for its first line to be indented. For this, there are several
335+scopes (more scopes may be added in the future if required):
336+
337+- `tail`:
338+This scope applies to everything except for the first line of the
339+captured node.
340+- `all`:
341+This scope applies to the whole captured node. This is only different from
342+`tail` when the captured node is the first node on its line.
343+
344+For example, imagine we have the following function
345+
346+```rust
347+fn aha() { // ←─────────────────────────────────────╮
348+ let take = "on me"; // ←──────────────╮ scope: │
349+ let take = "me on"; // ├─ "tail" ├─ (block) @indent
350+ let ill = be_gone_days(1 || 2); // │ │
351+} // ←───────────────────────────────────┴──────────┴─ "}" @outdent
352+ // scope: "all"
353+```
354+
355+We can write the following query with the `#set!` declaration:
356+
357+ ```scm
358+ ((block) @indent
359+ (#set! "scope" "tail"))
360+ ("}" @outdent
361+ (#set! "scope" "all"))
362+ ```
363+
364+As we can see, the "tail" scope covers the node, except for the first line.
365+Everything up to and including the closing brace gets an indent level of 1.
366+Then, on the closing brace, we encounter an outdent with a scope of "all", which
367+means the first line is included, and the indent level is cancelled out on this
368+line. (Note these scopes are the defaults for `@indent` and `@outdent`—they are
369+written explicitly for demonstration.)
book/src/guides/injection.md+1−1
@@ -1,7 +1,7 @@
11# Adding Injection Queries
22
33Writing language injection queries allows one to highlight a specific node as a different language.
4−In addition to the [standard](upstream-docs) language injection options used by tree-sitter, there
4+In addition to the [standard][upstream-docs] language injection options used by tree-sitter, there
55are a few Helix specific extensions that allow for more control.
66
77And example of a simple query that would highlight all strings as bash in Nix:
book/src/install.md+30−6
@@ -13,6 +13,7 @@
1313 - [AppImage](#appimage)
1414- [macOS](#macos)
1515 - [Homebrew Core](#homebrew-core)
16+ - [MacPorts](#macports)
1617- [Windows](#windows)
1718 - [Winget](#winget)
1819 - [Scoop](#scoop)
@@ -64,10 +65,7 @@ sudo apt install helix
6465
6566### Fedora/RHEL
6667
67−Enable the `COPR` repository for Helix:
68−
6968```sh
70−sudo dnf copr enable varlad/helix
7169sudo dnf install helix
7270```
7371
@@ -133,6 +131,12 @@ chmod +x helix-*.AppImage # change permission for executable mode
133131brew install helix
134132```
135133
134+### MacPorts
135+
136+```sh
137+port install helix
138+```
139+
136140## Windows
137141
138142Install on Windows using [Winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/), [Scoop](https://scoop.sh/), [Chocolatey](https://chocolatey.org/)
@@ -224,7 +228,7 @@ Or, create a symbolic link:
224228ln -Ts $PWD/runtime ~/.config/helix/runtime
225229```
226230
227−If the above command fails to create a symbolic link because the file exists either move `~/.config/helix/runtime` to a new location or delete it, then run the symlink command above again.
231+If the above command fails to create a symbolic link because the file exists either move `~/.config/helix/runtime` to a new location or delete it, then run the symlink command above again.
228232
229233#### Windows
230234
@@ -257,12 +261,32 @@ following order:
2572611. `runtime/` sibling directory to `$CARGO_MANIFEST_DIR` directory (this is intended for
258262 developing and testing helix only).
2592632. `runtime/` subdirectory of OS-dependent helix user config directory.
260−3. `$HELIX_RUNTIME`.
261−4. `runtime/` subdirectory of path to Helix executable.
264+3. `$HELIX_RUNTIME`
265+4. Distribution-specific fallback directory (set at compile time—not run time—
266+ with the `HELIX_DEFAULT_RUNTIME` environment variable)
267+5. `runtime/` subdirectory of path to Helix executable.
262268
263269This order also sets the priority for selecting which file will be used if multiple runtime
264270directories have files with the same name.
265271
272+#### Note to packagers
273+
274+If you are making a package of Helix for end users, to provide a good out of
275+the box experience, you should set the `HELIX_DEFAULT_RUNTIME` environment
276+variable at build time (before invoking `cargo build`) to a directory which
277+will store the final runtime files after installation. For example, say you want
278+to package the runtime into `/usr/lib/helix/runtime`. The rough steps a build
279+script could follow are:
280+
281+1. `export HELIX_DEFAULT_RUNTIME=/usr/lib/helix/runtime`
282+1. `cargo build --profile opt --locked --path helix-term`
283+1. `cp -r runtime $BUILD_DIR/usr/lib/helix/`
284+1. `cp target/opt/hx $BUILD_DIR/usr/bin/hx`
285+
286+This way the resulting `hx` binary will always look for its runtime directory in
287+`/usr/lib/helix/runtime` if the user has no custom runtime in `~/.config/helix`
288+or `HELIX_RUNTIME`.
289+
266290### Validating the installation
267291
268292To make sure everything is set up as expected you should run the Helix health
book/src/keymap.md+15−14
@@ -25,7 +25,7 @@
2525
2626## Normal mode
2727
28−Normal mode is the default mode when you launch helix. Return to it from other modes by typing `Escape`.
28+Normal mode is the default mode when you launch helix. You can return to it from other modes by pressing the `Escape` key.
2929
3030### Movement
3131
@@ -411,19 +411,20 @@ you to selectively add search terms to your selections.
411411
412412Keys to use within picker. Remapping currently not supported.
413413
414−| Key | Description |
415−| ----- | ------------- |
416−| `Shift-Tab`, `Up`, `Ctrl-p` | Previous entry |
417−| `Tab`, `Down`, `Ctrl-n` | Next entry |
418−| `PageUp`, `Ctrl-u` | Page up |
419−| `PageDown`, `Ctrl-d` | Page down |
420−| `Home` | Go to first entry |
421−| `End` | Go to last entry |
422−| `Enter` | Open selected |
423−| `Ctrl-s` | Open horizontally |
424−| `Ctrl-v` | Open vertically |
425−| `Ctrl-t` | Toggle preview |
426−| `Escape`, `Ctrl-c` | Close picker |
414+| Key | Description |
415+| ----- | ------------- |
416+| `Shift-Tab`, `Up`, `Ctrl-p` | Previous entry |
417+| `Tab`, `Down`, `Ctrl-n` | Next entry |
418+| `PageUp`, `Ctrl-u` | Page up |
419+| `PageDown`, `Ctrl-d` | Page down |
420+| `Home` | Go to first entry |
421+| `End` | Go to last entry |
422+| `Enter` | Open selected |
423+| `Alt-Enter` | Open selected in the background without closing the picker |
424+| `Ctrl-s` | Open horizontally |
425+| `Ctrl-v` | Open vertically |
426+| `Ctrl-t` | Toggle preview |
427+| `Escape`, `Ctrl-c` | Close picker |
427428
428429## Prompt
429430
book/src/languages.md+3−1
@@ -66,8 +66,10 @@ These configuration keys are available:
6666| `language-servers` | The Language Servers used for this language. See below for more information in the section [Configuring Language Servers for a language](#configuring-language-servers-for-a-language) |
6767| `grammar` | The tree-sitter grammar to use (defaults to the value of `name`) |
6868| `formatter` | The formatter for the language, it will take precedence over the lsp when defined. The formatter must be able to take the original file as input from stdin and write the formatted file to stdout |
69+| `soft-wrap` | [editor.softwrap](./configuration.md#editorsoft-wrap-section)
6970| `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap-at-text-width` is set, defaults to `editor.text-width` |
7071| `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml`. Overwrites the setting of the same name in `config.toml` if set. |
72+| `persistent-diagnostic-sources` | An array of LSP diagnostic sources assumed unchanged when the language server resends the same set of diagnostics. Helix can track the position for these diagnostics internally instead. Useful for diagnostics that are recomputed on save.
7173
7274### File-type detection and the `file-types` key
7375
@@ -127,7 +129,7 @@ These are the available options for a language server.
127129| `environment` | Any environment variables that will be used when starting the language server `{ "KEY1" = "Value1", "KEY2" = "Value2" }` |
128130
129131A `format` sub-table within `config` can be used to pass extra formatting options to
130−[Document Formatting Requests](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-17.md#document-formatting-request--leftwards_arrow_with_hook).
132+[Document Formatting Requests](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_formatting).
131133For example, with typescript:
132134
133135```toml
book/src/themes.md+9−1
@@ -70,6 +70,7 @@ over it and is merged into the default palette.
7070
7171| Color Name |
7272| --- |
73+| `default` |
7374| `black` |
7475| `red` |
7576| `green` |
@@ -154,6 +155,7 @@ We use a similar set of scopes as
154155
155156- `type` - Types
156157 - `builtin` - Primitive types provided by the language (`int`, `usize`)
158+ - `parameter` - Generic type parameters (`T`)
157159 - `enum`
158160 - `variant`
159161- `constructor`
@@ -244,9 +246,12 @@ We use a similar set of scopes as
244246
245247- `diff` - version control changes
246248 - `plus` - additions
249+ - `gutter` - gutter indicator
247250 - `minus` - deletions
251+ - `gutter` - gutter indicator
248252 - `delta` - modifications
249253 - `moved` - renamed or moved files/changes
254+ - `gutter` - gutter indicator
250255
251256#### Interface
252257
@@ -291,11 +296,14 @@ These scopes are used for theming the editor interface:
291296| `ui.statusline.insert` | Statusline mode during insert mode ([only if `editor.color-modes` is enabled][editor-section]) |
292297| `ui.statusline.select` | Statusline mode during select mode ([only if `editor.color-modes` is enabled][editor-section]) |
293298| `ui.statusline.separator` | Separator character in statusline |
299+| `ui.bufferline` | Style for the buffer line |
300+| `ui.bufferline.active` | Style for the active buffer in buffer line |
301+| `ui.bufferline.background` | Style for bufferline background |
294302| `ui.popup` | Documentation popups (e.g. Space + k) |
295303| `ui.popup.info` | Prompt for multiple key options |
296304| `ui.window` | Borderlines separating splits |
297305| `ui.help` | Description box for commands |
298−| `ui.text` | Command prompts, popup text, etc. |
306+| `ui.text` | Default text style, command prompts, popup text, etc. |
299307| `ui.text.focus` | The currently selected line in the picker |
300308| `ui.text.inactive` | Same as `ui.text` but when the text is inactive (e.g. suggestions) |
301309| `ui.text.info` | The key: command text in `ui.popup.info` boxes |
book/src/usage.md+2−2
@@ -59,8 +59,8 @@ Some registers have special behavior when read from and written to.
5959| `#` | Selection indices (first selection is `1`, second is `2`, etc.) | This register is not writable |
6060| `.` | Contents of the current selections | This register is not writable |
6161| `%` | Name of the current file | This register is not writable |
62−| `*` | Reads from the system clipboard | Joins and yanks to the system clipboard |
63−| `+` | Reads from the primary clipboard | Joins and yanks to the primary clipboard |
62+| `+` | Reads from the system clipboard | Joins and yanks to the system clipboard |
63+| `*` | Reads from the primary clipboard | Joins and yanks to the primary clipboard |
6464
6565When yanking multiple selections to the clipboard registers, the selections
6666are joined with newlines. Pasting from these registers will paste multiple
book/theme/index.hbs+18−15
@@ -1,11 +1,11 @@
11<!DOCTYPE HTML>
2−<html lang="{{ language }}" class="sidebar-visible no-js {{ default_theme }}">
2+<html lang="{{ language }}" class="{{ default_theme }}" dir="{{ text_direction }}">
33 <head>
44 <!-- Book generated using mdBook -->
55 <meta charset="UTF-8">
66 <title>{{ title }}</title>
77 {{#if is_print }}
8− <meta name="robots" content="noindex" />
8+ <meta name="robots" content="noindex">
99 {{/if}}
1010 {{#if base_url}}
1111 <base href="{{ base_url }}">
@@ -17,7 +17,7 @@
1717
1818 <meta name="description" content="{{ description }}">
1919 <meta name="viewport" content="width=device-width, initial-scale=1">
20− <meta name="theme-color" content="#ffffff" />
20+ <meta name="theme-color" content="#ffffff">
2121
2222 {{#if favicon_svg}}
2323 <link rel="icon" href="{{ path_to_root }}favicon.svg">
@@ -34,8 +34,6 @@
3434
3535 <!-- Fonts -->
3636 <link rel="stylesheet" href="{{ path_to_root }}FontAwesome/css/font-awesome.css">
37− <link rel="preconnect" href="https://fonts.gstatic.com">
38− <link href="https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;700&display=swap" rel="stylesheet">
3937 {{#if copy_fonts}}
4038 <link rel="stylesheet" href="{{ path_to_root }}fonts/fonts.css">
4139 {{/if}}
@@ -55,7 +53,7 @@
5553 <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
5654 {{/if}}
5755 </head>
58− <body>
56+ <body class="sidebar-visible no-js">
5957 <div id="body-container">
6058 <!-- Provide site root to javascript -->
6159 <script>
@@ -85,24 +83,29 @@
8583 try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
8684 if (theme === null || theme === undefined) { theme = default_theme; }
8785 var html = document.querySelector('html');
88− html.classList.remove('no-js')
8986 html.classList.remove('{{ default_theme }}')
9087 html.classList.add(theme);
91− html.classList.add('js');
88+ var body = document.querySelector('body');
89+ body.classList.remove('no-js')
90+ body.classList.add('js');
9291 </script>
9392
93+ <input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
94+
9495 <!-- Hide / unhide sidebar before it is displayed -->
9596 <script>
96− var html = document.querySelector('html');
97+ var body = document.querySelector('body');
9798 var sidebar = null;
99+ var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
98100 if (document.body.clientWidth >= 1080) {
99101 try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
100102 sidebar = sidebar || 'visible';
101103 } else {
102104 sidebar = 'hidden';
103105 }
104− html.classList.remove('sidebar-visible');
105− html.classList.add("sidebar-" + sidebar);
106+ sidebar_toggle.checked = sidebar === 'visible';
107+ body.classList.remove('sidebar-visible');
108+ body.classList.add("sidebar-" + sidebar);
106109 </script>
107110
108111 <nav id="sidebar" class="sidebar" aria-label="Table of contents">
@@ -141,9 +144,9 @@
141144 <div id="menu-bar-hover-placeholder"></div>
142145 <div id="menu-bar" class="menu-bar sticky">
143146 <div class="left-buttons">
144− <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
147+ <label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
145148 <i class="fa fa-bars"></i>
146− </button>
149+ </label>
147150 <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
148151 <i class="fa fa-paint-brush"></i>
149152 </button>
@@ -220,7 +223,7 @@
220223 {{/previous}}
221224
222225 {{#next}}
223− <a rel="next" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
226+ <a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
224227 <i class="fa fa-angle-right"></i>
225228 </a>
226229 {{/next}}
@@ -238,7 +241,7 @@
238241 {{/previous}}
239242
240243 {{#next}}
241− <a rel="next" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
244+ <a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
242245 <i class="fa fa-angle-right"></i>
243246 </a>
244247 {{/next}}
contrib/Helix.appdata.xml+15
@@ -5,6 +5,7 @@
55 <project_license>MPL-2.0</project_license>
66 <name>Helix</name>
77 <summary>A post-modern text editor</summary>
8+ <summary xml:lang="ar">مُحَرِّرُ نُصُوصٍ سَابِقٌ لِعَهدِه</summary>
89
910 <description>
1011 <p>
@@ -17,6 +18,17 @@
1718 <li>Smart, incremental syntax highlighting and code editing via tree-sitter</li>
1819 </ul>
1920 </description>
21+ <description xml:lang="ar">
22+ <p>
23+ مُحَرِّرُ نُصُوصٍ يَعمَلُ فِي الطَّرَفِيَّة، مُستَلهَمٌ مِن Kakoune وَ Neovim وَمَكتُوبٌ بِلُغَةِ رَست البَرمَجِيَّة.
24+ </p>
25+ <ul>
26+ <li>تَحرِيرٌ وَضعِيٌّ شَبيهٌ بِـVim</li>
27+ <li>تَحدِيدَاتٌ لِلنَّصِ مُتَعَدِّدَة</li>
28+ <li>دَعْمٌ مُدمَجٌ لِخَوادِمِ اللُّغَات</li>
29+ <li>تَحرِيرُ التَّعلِيمَاتِ البَّرمَجِيَّةِ مَعَ تَمييزٍ لِلتَّركِيبِ النَّحُويِّ بِواسِطَةِ tree-sitter</li>
30+ </ul>
31+ </description>
2032
2133 <launchable type="desktop-id">Helix.desktop</launchable>
2234
@@ -36,6 +48,9 @@
3648 <content_rating type="oars-1.1" />
3749
3850 <releases>
51+ <release version="23.10" date="2023-10-24">
52+ <url>https://helix-editor.com/news/release-23-10-highlights/</url>
53+ </release>
3954 <release version="23.05" date="2023-05-18">
4055 <url>https://github.com/helix-editor/helix/releases/tag/23.05</url>
4156 </release>
contrib/Helix.desktop+3−1
@@ -1,6 +1,7 @@
11[Desktop Entry]
22Name=Helix
33GenericName=Text Editor
4+GenericName[ar]=مُحَرِّرُ نُصُوص
45GenericName[de]=Texteditor
56GenericName[fr]=Éditeur de texte
67GenericName[ru]=Текстовый редактор
@@ -9,7 +10,7 @@ GenericName[tr]=Metin Düzenleyici
910Comment=Edit text files
1011Comment[af]=Redigeer tekslêers
1112Comment[am]=የጽሑፍ ፋይሎች ያስተካክሉ
12−Comment[ar]=حرّر ملفات نصية
13+Comment[ar]=مُحَرِّرُ مِلَفَّاتٍ نَصِّيَّة
1314Comment[az]=Mətn fayllarını redaktə edin
1415Comment[be]=Рэдагаваньне тэкставых файлаў
1516Comment[bg]=Редактиране на текстови файлове
@@ -79,6 +80,7 @@ Exec=hx %F
7980Terminal=true
8081Type=Application
8182Keywords=Text;editor;
83+Keywords[ar]=نص;نصوص;محرر;
8284Keywords[fr]=Texte;éditeur;
8385Keywords[ru]=текст;текстовый редактор;
8486Keywords[sr]=Текст;едитор;
docs/CONTRIBUTING.md+10−3
@@ -29,9 +29,15 @@ files, run
2929cargo xtask docgen
3030```
3131
32−inside the project. We use [xtask][xtask] as an ad-hoc task runner and
33−thus do not require any dependencies other than `cargo` (You don't have
34−to `cargo install` anything either).
32+inside the project. We use [xtask][xtask] as an ad-hoc task runner.
33+
34+To preview the book itself, install [mdbook][mdbook]. Then, run
35+
36+```shell
37+mdbook serve book
38+```
39+
40+and visit [http://localhost:3000](http://localhost:3000).
3541
3642# Testing
3743
@@ -58,4 +64,5 @@ The current MSRV and future changes to the MSRV are listed in the [Firefox docum
5864[architecture.md]: ./architecture.md
5965[docs]: https://docs.helix-editor.com/
6066[xtask]: https://github.com/matklad/cargo-xtask
67+[mdbook]: https://rust-lang.github.io/mdBook/guide/installation.html
6168[helpers.rs]: ../helix-term/tests/test/helpers.rs
docs/releases.md+12−5
@@ -1,16 +1,23 @@
11## Checklist
22
33Helix releases are versioned in the Calendar Versioning scheme:
4−`YY.0M(.MICRO)`, for example, `22.05` for May of 2022. In these instructions
5−we'll use `<tag>` as a placeholder for the tag being published.
4+`YY.0M(.MICRO)`, for example, `22.05` for May of 2022, or in a patch release,
5+`22.05.1`. In these instructions we'll use `<tag>` as a placeholder for the tag
6+being published.
67
78* Merge the changelog PR
89* Add new `<release>` entry in `contrib/Helix.appdata.xml` with release information according to the [AppStream spec](https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Releases.html)
910* Tag and push
1011 * `git tag -s -m "<tag>" -a <tag> && git push`
1112 * Make sure to switch to master and pull first
12−* Edit the `VERSION` file and change the date to the next planned release
13− * Releases are planned to happen every two months, so `22.05` would change to `22.07`
13+* Edit the `Cargo.toml` file and change the date in the `version` field to the next planned release
14+ * Due to Cargo having a strict requirement on SemVer with 3 or more version
15+ numbers, a `0` is required in the micro version; however, unless we are
16+ publishing a patch release after a major release, the `.0` is dropped in
17+ the user facing version.
18+ * Releases are planned to happen every two months, so `22.05.0` would change to `22.07.0`
19+ * If we are pushing a patch/bugfix release in the same month as the previous
20+ release, bump the micro version, e.g. `22.07.0` to `22.07.1`
1421* Wait for the Release CI to finish
1522 * It will automatically turn the git tag into a GitHub release when it uploads artifacts
1623* Edit the new release
@@ -57,4 +64,4 @@ versions for convenience:
5764> release. For the full log, check out the git log.
5865
5966Typically, small changes like dependencies or documentation updates, refactors,
60−or meta changes like GitHub Actions work are left out.
67+or meta changes like GitHub Actions work are left out.
flake.lock+12−35
@@ -2,23 +2,16 @@
22 "nodes": {
33 "crane": {
44 "inputs": {
5− "flake-compat": "flake-compat",
6− "flake-utils": [
7− "flake-utils"
8− ],
95 "nixpkgs": [
106 "nixpkgs"
11− ],
12− "rust-overlay": [
13− "rust-overlay"
147 ]
158 },
169 "locked": {
17− "lastModified": 1688772518,
18− "narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=",
10+ "lastModified": 1701025348,
11+ "narHash": "sha256-42GHmYH+GF7VjwGSt+fVT1CQuNpGanJbNgVHTAZppUM=",
1912 "owner": "ipetkov",
2013 "repo": "crane",
21− "rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e",
14+ "rev": "42afaeb1a0325194a7cdb526332d2cb92fddd07b",
2215 "type": "github"
2316 },
2417 "original": {
@@ -27,32 +20,16 @@
2720 "type": "github"
2821 }
2922 },
30− "flake-compat": {
31− "flake": false,
32− "locked": {
33− "lastModified": 1673956053,
34− "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
35− "owner": "edolstra",
36− "repo": "flake-compat",
37− "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
38− "type": "github"
39− },
40− "original": {
41− "owner": "edolstra",
42− "repo": "flake-compat",
43− "type": "github"
44− }
45− },
4623 "flake-utils": {
4724 "inputs": {
4825 "systems": "systems"
4926 },
5027 "locked": {
51− "lastModified": 1689068808,
52− "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
28+ "lastModified": 1694529238,
29+ "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
5330 "owner": "numtide",
5431 "repo": "flake-utils",
55− "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
32+ "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
5633 "type": "github"
5734 },
5835 "original": {
@@ -63,11 +40,11 @@
6340 },
6441 "nixpkgs": {
6542 "locked": {
66− "lastModified": 1690272529,
67− "narHash": "sha256-MakzcKXEdv/I4qJUtq/k/eG+rVmyOZLnYNC2w1mB59Y=",
43+ "lastModified": 1700794826,
44+ "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=",
6845 "owner": "nixos",
6946 "repo": "nixpkgs",
70− "rev": "ef99fa5c5ed624460217c31ac4271cfb5cb2502c",
47+ "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8",
7148 "type": "github"
7249 },
7350 "original": {
@@ -95,11 +72,11 @@
9572 ]
9673 },
9774 "locked": {
98− "lastModified": 1690424156,
99− "narHash": "sha256-Bpml+L280tHTQpwpC5/BJbU4HSvEzMvW8IZ4gAXimhE=",
75+ "lastModified": 1701137803,
76+ "narHash": "sha256-0LcPAdql5IhQSUXJx3Zna0dYTgdIoYO7zUrsKgiBd04=",
10077 "owner": "oxalica",
10178 "repo": "rust-overlay",
102− "rev": "f335a0213504c7e6481c359dc1009be9cf34432c",
79+ "rev": "9dd940c967502f844eacea52a61e9596268d4f70",
10380 "type": "github"
10481 },
10582 "original": {
flake.nix+27−24
@@ -13,8 +13,6 @@
1313 };
1414 crane = {
1515 url = "github:ipetkov/crane";
16− inputs.rust-overlay.follows = "rust-overlay";
17− inputs.flake-utils.follows = "flake-utils";
1816 inputs.nixpkgs.follows = "nixpkgs";
1917 };
2018 };
@@ -43,7 +41,6 @@
4341 ".ignore"
4442 ".github"
4543 ".gitignore"
46− "logo.svg"
4744 "logo_dark.svg"
4845 "logo_light.svg"
4946 "rust-toolchain.toml"
@@ -51,7 +48,6 @@
5148 "runtime"
5249 "screenshot.png"
5350 "book"
54− "contrib"
5551 "docs"
5652 "README.md"
5753 "CHANGELOG.md"
@@ -123,25 +119,32 @@
123119 then ''$RUSTFLAGS -C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment''
124120 else "$RUSTFLAGS";
125121 rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
126− craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
127− commonArgs =
128− {
129− inherit stdenv;
130− src = filteredSource;
131− # disable fetching and building of tree-sitter grammars in the helix-term build.rs
132− HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
133− buildInputs = [stdenv.cc.cc.lib];
134− # disable tests
135− doCheck = false;
136− meta.mainProgram = "hx";
137− }
138− // craneLib.crateNameFromCargoToml {cargoToml = ./helix-term/Cargo.toml;};
139− cargoArtifacts = craneLib.buildDepsOnly commonArgs;
122+ craneLibMSRV = (crane.mkLib pkgs).overrideToolchain rustToolchain;
123+ craneLibStable = (crane.mkLib pkgs).overrideToolchain pkgs.pkgsBuildHost.rust-bin.stable.latest.default;
124+ commonArgs = {
125+ inherit stdenv;
126+ inherit (craneLibMSRV.crateNameFromCargoToml {cargoToml = ./helix-term/Cargo.toml;}) pname;
127+ inherit (craneLibMSRV.crateNameFromCargoToml {cargoToml = ./Cargo.toml;}) version;
128+ src = filteredSource;
129+ # disable fetching and building of tree-sitter grammars in the helix-term build.rs
130+ HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
131+ buildInputs = [stdenv.cc.cc.lib];
132+ # disable tests
133+ doCheck = false;
134+ meta.mainProgram = "hx";
135+ };
136+ cargoArtifacts = craneLibMSRV.buildDepsOnly commonArgs;
140137 in {
141138 packages = {
142− helix-unwrapped = craneLib.buildPackage (commonArgs
139+ helix-unwrapped = craneLibStable.buildPackage (commonArgs
143140 // {
144− inherit cargoArtifacts;
141+ cargoArtifacts = craneLibStable.buildDepsOnly commonArgs;
142+ postInstall = ''
143+ mkdir -p $out/share/applications $out/share/icons/hicolor/scalable/apps $out/share/icons/hicolor/256x256/apps
144+ cp contrib/Helix.desktop $out/share/applications
145+ cp logo.svg $out/share/icons/hicolor/scalable/apps/helix.svg
146+ cp contrib/helix.png $out/share/icons/hicolor/256x256/apps
147+ '';
145148 });
146149 helix = makeOverridableHelix self.packages.${system}.helix-unwrapped {};
147150 default = self.packages.${system}.helix;
@@ -151,20 +154,20 @@
151154 # Build the crate itself
152155 inherit (self.packages.${system}) helix;
153156
154− clippy = craneLib.cargoClippy (commonArgs
157+ clippy = craneLibMSRV.cargoClippy (commonArgs
155158 // {
156159 inherit cargoArtifacts;
157160 cargoClippyExtraArgs = "--all-targets -- --deny warnings";
158161 });
159162
160− fmt = craneLib.cargoFmt commonArgs;
163+ fmt = craneLibMSRV.cargoFmt commonArgs;
161164
162− doc = craneLib.cargoDoc (commonArgs
165+ doc = craneLibMSRV.cargoDoc (commonArgs
163166 // {
164167 inherit cargoArtifacts;
165168 });
166169
167− test = craneLib.cargoTest (commonArgs
170+ test = craneLibMSRV.cargoTest (commonArgs
168171 // {
169172 inherit cargoArtifacts;
170173 });
grammars.nix+24−21
@@ -5,6 +5,7 @@
55 runCommand,
66 yj,
77 includeGrammarIf ? _: true,
8+ grammarOverlays ? [],
89 ...
910}: let
1011 # HACK: nix < 2.6 has a bug in the toml parser, so we convert to JSON
@@ -48,22 +49,22 @@
4849 then sourceGitHub
4950 else sourceGit;
5051 in
51− stdenv.mkDerivation rec {
52+ stdenv.mkDerivation {
5253 # see https://github.com/NixOS/nixpkgs/blob/fbdd1a7c0bc29af5325e0d7dd70e804a972eb465/pkgs/development/tools/parsing/tree-sitter/grammar.nix
5354
5455 pname = "helix-tree-sitter-${grammar.name}";
5556 version = grammar.source.rev;
5657
57− src =
58− if builtins.hasAttr "subpath" grammar.source
59− then "${source}/${grammar.source.subpath}"
60− else source;
58+ src = source;
59+ sourceRoot = if builtins.hasAttr "subpath" grammar.source then
60+ "source/${grammar.source.subpath}"
61+ else
62+ "source";
6163
62− dontUnpack = true;
6364 dontConfigure = true;
6465
6566 FLAGS = [
66− "-I${src}/src"
67+ "-Isrc"
6768 "-g"
6869 "-O3"
6970 "-fPIC"
@@ -76,13 +77,13 @@
7677 buildPhase = ''
7778 runHook preBuild
7879
79− if [[ -e "$src/src/scanner.cc" ]]; then
80− $CXX -c "$src/src/scanner.cc" -o scanner.o $FLAGS
81− elif [[ -e "$src/src/scanner.c" ]]; then
82− $CC -c "$src/src/scanner.c" -o scanner.o $FLAGS
80+ if [[ -e src/scanner.cc ]]; then
81+ $CXX -c src/scanner.cc -o scanner.o $FLAGS
82+ elif [[ -e src/scanner.c ]]; then
83+ $CC -c src/scanner.c -o scanner.o $FLAGS
8384 fi
8485
85− $CC -c "$src/src/parser.c" -o parser.o $FLAGS
86+ $CC -c src/parser.c -o parser.o $FLAGS
8687 $CXX -shared -o $NAME.so *.o
8788
8889 ls -al
@@ -105,15 +106,17 @@
105106 '';
106107 };
107108 grammarsToBuild = builtins.filter includeGrammarIf gitGrammars;
108− builtGrammars =
109− builtins.map (grammar: {
110− inherit (grammar) name;
111− artifact = buildGrammar grammar;
112− })
113− grammarsToBuild;
114− grammarLinks =
115− builtins.map (grammar: "ln -s ${grammar.artifact}/${grammar.name}.so $out/${grammar.name}.so")
116− builtGrammars;
109+ builtGrammars = builtins.map (grammar: {
110+ inherit (grammar) name;
111+ value = buildGrammar grammar;
112+ }) grammarsToBuild;
113+ extensibleGrammars =
114+ lib.makeExtensible (self: builtins.listToAttrs builtGrammars);
115+ overlayedGrammars = lib.pipe extensibleGrammars
116+ (builtins.map (overlay: grammar: grammar.extend overlay) grammarOverlays);
117+ grammarLinks = lib.mapAttrsToList
118+ (name: artifact: "ln -s ${artifact}/${name}.so $out/${name}.so")
119+ (lib.filterAttrs (n: v: lib.isDerivation v) overlayedGrammars);
117120in
118121 runCommand "consolidated-helix-grammars" {} ''
119122 mkdir -p $out
helix-core/Cargo.toml+18−14
@@ -1,23 +1,24 @@
11[package]
22name = "helix-core"
3−version = "0.6.0"
4−authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2021"
6−license = "MPL-2.0"
73description = "Helix editor core editing primitives"
8−categories = ["editor"]
9−repository = "https://github.com/helix-editor/helix"
10−homepage = "https://helix-editor.com"
114include = ["src/**/*", "README.md"]
5+version.workspace = true
6+authors.workspace = true
7+edition.workspace = true
8+license.workspace = true
9+rust-version.workspace = true
10+categories.workspace = true
11+repository.workspace = true
12+homepage.workspace = true
1213
1314[features]
1415unicode-lines = ["ropey/unicode_lines"]
1516integration = []
1617
1718[dependencies]
18−helix-loader = { version = "0.6", path = "../helix-loader" }
19+helix-loader = { path = "../helix-loader" }
1920
20−ropey = { version = "1.6.0", default-features = false, features = ["simd"] }
21+ropey = { version = "1.6.1", default-features = false, features = ["simd"] }
2122smallvec = "1.11"
2223smartstring = "1.0.1"
2324unicode-segmentation = "1.10"
@@ -26,12 +27,12 @@ unicode-general-category = "0.6"
2627# slab = "0.4.2"
2728slotmap = "1.0"
2829tree-sitter.workspace = true
29−once_cell = "1.18"
30+once_cell = "1.19"
3031arc-swap = "1"
3132regex = "1"
32−bitflags = "2.3"
33−ahash = "0.8.3"
34−hashbrown = { version = "0.14.0", features = ["raw"] }
33+bitflags = "2.4"
34+ahash = "0.8.6"
35+hashbrown = { version = "0.14.3", features = ["raw"] }
3536dunce = "1.0"
3637
3738log = "0.4"
@@ -48,6 +49,9 @@ chrono = { version = "0.4", default-features = false, features = ["alloc", "std"
4849etcetera = "0.8"
4950textwrap = "0.16.0"
5051
52+nucleo.workspace = true
53+parking_lot = "0.12"
54+
5155[dev-dependencies]
5256quickcheck = { version = "1", default-features = false }
53−indoc = "2.0.3"
57+indoc = "2.0.4"
helix-core/src/diagnostic.rs+4
@@ -39,6 +39,10 @@ pub enum DiagnosticTag {
3939#[derive(Debug, Clone)]
4040pub struct Diagnostic {
4141 pub range: Range,
42+ // whether this diagnostic ends at the end of(or inside) a word
43+ pub ends_at_word: bool,
44+ pub starts_at_word: bool,
45+ pub zero_width: bool,
4246 pub line: usize,
4347 pub message: String,
4448 pub severity: Option<Severity>,
helix-core/src/fuzzy.rsnew file+43
@@ -0,0 +1,43 @@
1+use std::ops::DerefMut;
2+
3+use nucleo::pattern::{Atom, AtomKind, CaseMatching};
4+use nucleo::Config;
5+use parking_lot::Mutex;
6+
7+pub struct LazyMutex<T> {
8+ inner: Mutex<Option<T>>,
9+ init: fn() -> T,
10+}
11+
12+impl<T> LazyMutex<T> {
13+ pub const fn new(init: fn() -> T) -> Self {
14+ Self {
15+ inner: Mutex::new(None),
16+ init,
17+ }
18+ }
19+
20+ pub fn lock(&self) -> impl DerefMut<Target = T> + '_ {
21+ parking_lot::MutexGuard::map(self.inner.lock(), |val| val.get_or_insert_with(self.init))
22+ }
23+}
24+
25+pub static MATCHER: LazyMutex<nucleo::Matcher> = LazyMutex::new(nucleo::Matcher::default);
26+
27+/// convenience function to easily fuzzy match
28+/// on a (relatively small list of inputs). This is not recommended for building a full tui
29+/// application that can match large numbers of matches as all matching is done on the current
30+/// thread, effectively blocking the UI
31+pub fn fuzzy_match<T: AsRef<str>>(
32+ pattern: &str,
33+ items: impl IntoIterator<Item = T>,
34+ path: bool,
35+) -> Vec<(T, u16)> {
36+ let mut matcher = MATCHER.lock();
37+ matcher.config = Config::DEFAULT;
38+ if path {
39+ matcher.config.set_match_paths();
40+ }
41+ let pattern = Atom::new(pattern, CaseMatching::Smart, AtomKind::Fuzzy, false);
42+ pattern.match_list(items, &mut matcher)
43+}
helix-core/src/graphemes.rs+1−1
@@ -481,7 +481,7 @@ impl<'a> From<String> for GraphemeStr<'a> {
481481 let ptr = Box::into_raw(g.into_bytes().into_boxed_slice()) as *mut u8;
482482 GraphemeStr {
483483 ptr: unsafe { NonNull::new_unchecked(ptr) },
484− len: i32::try_from(len).unwrap() as u32,
484+ len: (i32::try_from(len).unwrap() as u32) | Self::MASK_OWNED,
485485 phantom: PhantomData,
486486 }
487487 }
helix-core/src/indent.rs+586−127
@@ -1,13 +1,14 @@
1−use std::collections::HashMap;
1+use std::{borrow::Cow, collections::HashMap};
22
33use tree_sitter::{Query, QueryCursor, QueryPredicateArg};
44
55use crate::{
66 chars::{char_is_line_ending, char_is_whitespace},
7− graphemes::tab_width_at,
8− syntax::{LanguageConfiguration, RopeProvider, Syntax},
7+ find_first_non_whitespace_char,
8+ graphemes::{grapheme_width, tab_width_at},
9+ syntax::{IndentationHeuristic, LanguageConfiguration, RopeProvider, Syntax},
910 tree_sitter::Node,
10− Rope, RopeSlice,
11+ Position, Rope, RopeGraphemes, RopeSlice,
1112};
1213
1314/// Enum representing indentation style.
@@ -21,7 +22,7 @@ pub enum IndentStyle {
2122
2223// 16 spaces
2324const INDENTS: &str = " ";
24−const MAX_INDENT: u8 = 16;
25+pub const MAX_INDENT: u8 = 16;
2526
2627impl IndentStyle {
2728 /// Creates an `IndentStyle` from an indentation string.
@@ -196,6 +197,56 @@ pub fn indent_level_for_line(line: RopeSlice, tab_width: usize, indent_width: us
196197 len / indent_width
197198}
198199
200+/// Create a string of tabs & spaces that has the same visual width as the given RopeSlice (independent of the tab width).
201+fn whitespace_with_same_width(text: RopeSlice) -> String {
202+ let mut s = String::new();
203+ for grapheme in RopeGraphemes::new(text) {
204+ if grapheme == "\t" {
205+ s.push('\t');
206+ } else {
207+ s.extend(std::iter::repeat(' ').take(grapheme_width(&Cow::from(grapheme))));
208+ }
209+ }
210+ s
211+}
212+
213+fn add_indent_level(
214+ mut base_indent: String,
215+ added_indent_level: isize,
216+ indent_style: &IndentStyle,
217+ tab_width: usize,
218+) -> String {
219+ if added_indent_level >= 0 {
220+ // Adding a non-negative indent is easy, we can simply append the indent string
221+ base_indent.push_str(&indent_style.as_str().repeat(added_indent_level as usize));
222+ base_indent
223+ } else {
224+ // In this case, we want to return a prefix of `base_indent`.
225+ // Since the width of a tab depends on its offset, we cannot simply iterate over
226+ // the chars of `base_indent` in reverse until we have the desired indent reduction,
227+ // instead we iterate over them twice in forward direction.
228+ let base_indent_rope = RopeSlice::from(base_indent.as_str());
229+ #[allow(deprecated)]
230+ let base_indent_width =
231+ crate::visual_coords_at_pos(base_indent_rope, base_indent_rope.len_chars(), tab_width)
232+ .col;
233+ let target_indent_width = base_indent_width
234+ .saturating_sub((-added_indent_level) as usize * indent_style.indent_width(tab_width));
235+ #[allow(deprecated)]
236+ let char_end_idx = crate::pos_at_visual_coords(
237+ base_indent_rope,
238+ Position {
239+ row: 0,
240+ col: target_indent_width,
241+ },
242+ tab_width,
243+ );
244+ let byte_end_idx = base_indent_rope.char_to_byte(char_end_idx);
245+ base_indent.truncate(byte_end_idx);
246+ base_indent
247+ }
248+}
249+
199250/// Computes for node and all ancestors whether they are the first node on their line.
200251/// The first entry in the return value represents the root node, the last one the node itself
201252fn get_first_in_line(mut node: Node, new_line_byte_pos: Option<usize>) -> Vec<bool> {
@@ -237,68 +288,140 @@ fn get_first_in_line(mut node: Node, new_line_byte_pos: Option<usize>) -> Vec<bo
237288/// This is usually constructed in one of 2 ways:
238289/// - Successively add indent captures to get the (added) indent from a single line
239290/// - Successively add the indent results for each line
240−#[derive(Default)]
241−pub struct Indentation {
242− /// The total indent (the number of indent levels) is defined as max(0, indent-outdent).
243− /// The string that this results in depends on the indent style (spaces or tabs, etc.)
291+/// The string that this indentation defines starts with the string contained in the align field (unless it is None), followed by:
292+/// - max(0, indent - outdent) tabs, if tabs are used for indentation
293+/// - max(0, indent - outdent)*indent_width spaces, if spaces are used for indentation
294+#[derive(Default, Debug, PartialEq, Eq, Clone)]
295+pub struct Indentation<'a> {
244296 indent: usize,
297+ indent_always: usize,
245298 outdent: usize,
299+ outdent_always: usize,
300+ /// The alignment, as a string containing only tabs & spaces. Storing this as a string instead of e.g.
301+ /// the (visual) width ensures that the alignment is preserved even if the tab width changes.
302+ align: Option<RopeSlice<'a>>,
246303}
247−impl Indentation {
304+
305+impl<'a> Indentation<'a> {
248306 /// Add some other [Indentation] to this.
249− /// The added indent should be the total added indent from one line
250− fn add_line(&mut self, added: &Indentation) {
251− if added.indent > 0 && added.outdent == 0 {
252− self.indent += 1;
253− } else if added.outdent > 0 && added.indent == 0 {
254− self.outdent += 1;
307+ /// The added indent should be the total added indent from one line.
308+ /// Indent should always be added starting from the bottom (or equivalently, the innermost tree-sitter node).
309+ fn add_line(&mut self, added: Indentation<'a>) {
310+ // Align overrides the indent from outer scopes.
311+ if self.align.is_some() {
312+ return;
313+ }
314+ if added.align.is_some() {
315+ self.align = added.align;
316+ return;
255317 }
318+ self.indent += added.indent;
319+ self.indent_always += added.indent_always;
320+ self.outdent += added.outdent;
321+ self.outdent_always += added.outdent_always;
256322 }
323+
257324 /// Add an indent capture to this indent.
258− /// All the captures that are added in this way should be on the same line.
259− fn add_capture(&mut self, added: IndentCaptureType) {
325+ /// Only captures that apply to the same line should be added together in this way (otherwise use `add_line`)
326+ /// and the captures should be added starting from the innermost tree-sitter node (currently this only matters
327+ /// if multiple `@align` patterns occur on the same line).
328+ fn add_capture(&mut self, added: IndentCaptureType<'a>) {
260329 match added {
261330 IndentCaptureType::Indent => {
262− self.indent = 1;
331+ if self.indent_always == 0 {
332+ self.indent = 1;
333+ }
334+ }
335+ IndentCaptureType::IndentAlways => {
336+ // any time we encounter an `indent.always` on the same line, we
337+ // want to cancel out all regular indents
338+ self.indent_always += 1;
339+ self.indent = 0;
263340 }
264341 IndentCaptureType::Outdent => {
265− self.outdent = 1;
342+ if self.outdent_always == 0 {
343+ self.outdent = 1;
344+ }
345+ }
346+ IndentCaptureType::OutdentAlways => {
347+ self.outdent_always += 1;
348+ self.outdent = 0;
349+ }
350+ IndentCaptureType::Align(align) => {
351+ if self.align.is_none() {
352+ self.align = Some(align);
353+ }
266354 }
267355 }
268356 }
269− fn as_string(&self, indent_style: &IndentStyle) -> String {
270− let indent_level = if self.indent >= self.outdent {
271− self.indent - self.outdent
357+ fn net_indent(&self) -> isize {
358+ (self.indent + self.indent_always) as isize
359+ - ((self.outdent + self.outdent_always) as isize)
360+ }
361+ /// Convert `self` into a string, taking into account the computed and actual indentation of some other line.
362+ fn relative_indent(
363+ &self,
364+ other_computed_indent: &Self,
365+ other_leading_whitespace: RopeSlice,
366+ indent_style: &IndentStyle,
367+ tab_width: usize,
368+ ) -> Option<String> {
369+ if self.align == other_computed_indent.align {
370+ // If self and baseline are either not aligned to anything or both aligned the same way,
371+ // we can simply take `other_leading_whitespace` and add some indent / outdent to it (in the second
372+ // case, the alignment should already be accounted for in `other_leading_whitespace`).
373+ let indent_diff = self.net_indent() - other_computed_indent.net_indent();
374+ Some(add_indent_level(
375+ String::from(other_leading_whitespace),
376+ indent_diff,
377+ indent_style,
378+ tab_width,
379+ ))
272380 } else {
273− log::warn!("Encountered more outdent than indent nodes while calculating indentation: {} outdent, {} indent", self.outdent, self.indent);
274− 0
275− };
276− indent_style.as_str().repeat(indent_level)
381+ // If the alignment of both lines is different, we cannot compare their indentation in any meaningful way
382+ None
383+ }
384+ }
385+ pub fn to_string(&self, indent_style: &IndentStyle, tab_width: usize) -> String {
386+ add_indent_level(
387+ self.align
388+ .map_or_else(String::new, whitespace_with_same_width),
389+ self.net_indent(),
390+ indent_style,
391+ tab_width,
392+ )
277393 }
278394}
279395
280396/// An indent definition which corresponds to a capture from the indent query
281−struct IndentCapture {
282− capture_type: IndentCaptureType,
397+#[derive(Debug)]
398+struct IndentCapture<'a> {
399+ capture_type: IndentCaptureType<'a>,
283400 scope: IndentScope,
284401}
285−#[derive(Clone, Copy)]
286−enum IndentCaptureType {
402+#[derive(Debug, Clone, PartialEq)]
403+enum IndentCaptureType<'a> {
287404 Indent,
405+ IndentAlways,
288406 Outdent,
407+ OutdentAlways,
408+ /// Alignment given as a string of whitespace
409+ Align(RopeSlice<'a>),
289410}
290−impl IndentCaptureType {
411+
412+impl<'a> IndentCaptureType<'a> {
291413 fn default_scope(&self) -> IndentScope {
292414 match self {
293− IndentCaptureType::Indent => IndentScope::Tail,
294− IndentCaptureType::Outdent => IndentScope::All,
415+ IndentCaptureType::Indent | IndentCaptureType::IndentAlways => IndentScope::Tail,
416+ IndentCaptureType::Outdent | IndentCaptureType::OutdentAlways => IndentScope::All,
417+ IndentCaptureType::Align(_) => IndentScope::All,
295418 }
296419 }
297420}
298421/// This defines which part of a node an [IndentCapture] applies to.
299422/// Each [IndentCaptureType] has a default scope, but the scope can be changed
300423/// with `#set!` property declarations.
301−#[derive(Clone, Copy)]
424+#[derive(Debug, Clone, Copy)]
302425enum IndentScope {
303426 /// The indent applies to the whole node
304427 All,
@@ -308,6 +431,7 @@ enum IndentScope {
308431
309432/// A capture from the indent query which does not define an indent but extends
310433/// the range of a node. This is used before the indent is calculated.
434+#[derive(Debug)]
311435enum ExtendCapture {
312436 Extend,
313437 PreventOnce,
@@ -316,24 +440,41 @@ enum ExtendCapture {
316440/// The result of running a tree-sitter indent query. This stores for
317441/// each node (identified by its ID) the relevant captures (already filtered
318442/// by predicates).
319−struct IndentQueryResult {
320− indent_captures: HashMap<usize, Vec<IndentCapture>>,
443+#[derive(Debug)]
444+struct IndentQueryResult<'a> {
445+ indent_captures: HashMap<usize, Vec<IndentCapture<'a>>>,
321446 extend_captures: HashMap<usize, Vec<ExtendCapture>>,
322447}
323448
324−fn query_indents(
449+fn get_node_start_line(node: Node, new_line_byte_pos: Option<usize>) -> usize {
450+ let mut node_line = node.start_position().row;
451+ // Adjust for the new line that will be inserted
452+ if new_line_byte_pos.map_or(false, |pos| node.start_byte() >= pos) {
453+ node_line += 1;
454+ }
455+ node_line
456+}
457+fn get_node_end_line(node: Node, new_line_byte_pos: Option<usize>) -> usize {
458+ let mut node_line = node.end_position().row;
459+ // Adjust for the new line that will be inserted (with a strict inequality since end_byte is exclusive)
460+ if new_line_byte_pos.map_or(false, |pos| node.end_byte() > pos) {
461+ node_line += 1;
462+ }
463+ node_line
464+}
465+
466+fn query_indents<'a>(
325467 query: &Query,
326468 syntax: &Syntax,
327469 cursor: &mut QueryCursor,
328− text: RopeSlice,
470+ text: RopeSlice<'a>,
329471 range: std::ops::Range<usize>,
330− // Position of the (optional) newly inserted line break.
331− // Given as (line, byte_pos)
332− new_line_break: Option<(usize, usize)>,
333−) -> IndentQueryResult {
472+ new_line_byte_pos: Option<usize>,
473+) -> IndentQueryResult<'a> {
334474 let mut indent_captures: HashMap<usize, Vec<IndentCapture>> = HashMap::new();
335475 let mut extend_captures: HashMap<usize, Vec<ExtendCapture>> = HashMap::new();
336476 cursor.set_byte_range(range);
477+
337478 // Iterate over all captures from the query
338479 for m in cursor.matches(query, syntax.tree().root_node(), RopeProvider(text)) {
339480 // Skip matches where not all custom predicates are fulfilled
@@ -360,21 +501,13 @@ fn query_indents(
360501 Some(QueryPredicateArg::Capture(capt1)),
361502 Some(QueryPredicateArg::Capture(capt2))
362503 ) => {
363− let get_line_num = |node: Node| {
364− let mut node_line = node.start_position().row;
365− // Adjust for the new line that will be inserted
366− if let Some((line, byte)) = new_line_break {
367− if node_line==line && node.start_byte()>=byte {
368− node_line += 1;
369− }
370− }
371− node_line
372− };
373504 let n1 = m.nodes_for_capture_index(*capt1).next();
374505 let n2 = m.nodes_for_capture_index(*capt2).next();
375506 match (n1, n2) {
376507 (Some(n1), Some(n2)) => {
377− let same_line = get_line_num(n1)==get_line_num(n2);
508+ let n1_line = get_node_start_line(n1, new_line_byte_pos);
509+ let n2_line = get_node_start_line(n2, new_line_byte_pos);
510+ let same_line = n1_line == n2_line;
378511 same_line==(pred.operator.as_ref()=="same-line?")
379512 }
380513 _ => true,
@@ -385,6 +518,23 @@ fn query_indents(
385518 }
386519 }
387520 }
521+ "one-line?" | "not-one-line?" => match pred.args.get(0) {
522+ Some(QueryPredicateArg::Capture(capture_idx)) => {
523+ let node = m.nodes_for_capture_index(*capture_idx).next();
524+
525+ match node {
526+ Some(node) => {
527+ let (start_line, end_line) = (get_node_start_line(node,new_line_byte_pos), get_node_end_line(node, new_line_byte_pos));
528+ let one_line = end_line == start_line;
529+ one_line != (pred.operator.as_ref() == "not-one-line?")
530+ },
531+ _ => true,
532+ }
533+ }
534+ _ => {
535+ panic!("Invalid indent query: Arguments to \"not-kind-eq?\" must be a capture and a string");
536+ }
537+ },
388538 _ => {
389539 panic!(
390540 "Invalid indent query: Unknown predicate (\"{}\")",
@@ -395,11 +545,28 @@ fn query_indents(
395545 }) {
396546 continue;
397547 }
548+ // A list of pairs (node_id, indent_capture) that are added by this match.
549+ // They cannot be added to indent_captures immediately since they may depend on other captures (such as an @anchor).
550+ let mut added_indent_captures: Vec<(usize, IndentCapture)> = Vec::new();
551+ // The row/column position of the optional anchor in this query
552+ let mut anchor: Option<tree_sitter::Node> = None;
398553 for capture in m.captures {
399554 let capture_name = query.capture_names()[capture.index as usize].as_str();
400555 let capture_type = match capture_name {
401556 "indent" => IndentCaptureType::Indent,
557+ "indent.always" => IndentCaptureType::IndentAlways,
402558 "outdent" => IndentCaptureType::Outdent,
559+ "outdent.always" => IndentCaptureType::OutdentAlways,
560+ // The alignment will be updated to the correct value at the end, when the anchor is known.
561+ "align" => IndentCaptureType::Align(RopeSlice::from("")),
562+ "anchor" => {
563+ if anchor.is_some() {
564+ log::error!("Invalid indent query: Encountered more than one @anchor in the same match.")
565+ } else {
566+ anchor = Some(capture.node);
567+ }
568+ continue;
569+ }
403570 "extend" => {
404571 extend_captures
405572 .entry(capture.node.id())
@@ -449,17 +616,40 @@ fn query_indents(
449616 }
450617 }
451618 }
619+ added_indent_captures.push((capture.node.id(), indent_capture))
620+ }
621+ for (node_id, mut capture) in added_indent_captures {
622+ // Set the anchor for all align queries.
623+ if let IndentCaptureType::Align(_) = capture.capture_type {
624+ let anchor = match anchor {
625+ None => {
626+ log::error!(
627+ "Invalid indent query: @align requires an accompanying @anchor."
628+ );
629+ continue;
630+ }
631+ Some(anchor) => anchor,
632+ };
633+ capture.capture_type = IndentCaptureType::Align(
634+ text.line(anchor.start_position().row)
635+ .byte_slice(0..anchor.start_position().column),
636+ );
637+ }
452638 indent_captures
453− .entry(capture.node.id())
454− // Most entries only need to contain a single IndentCapture
639+ .entry(node_id)
455640 .or_insert_with(|| Vec::with_capacity(1))
456− .push(indent_capture);
641+ .push(capture);
457642 }
458643 }
459− IndentQueryResult {
644+
645+ let result = IndentQueryResult {
460646 indent_captures,
461647 extend_captures,
462− }
648+ };
649+
650+ log::trace!("indent result = {:?}", result);
651+
652+ result
463653}
464654
465655/// Handle extend queries. deepest_preceding is the deepest descendant of node that directly precedes the cursor position.
@@ -529,61 +719,27 @@ fn extend_nodes<'a>(
529719 }
530720}
531721
532−/// Use the syntax tree to determine the indentation for a given position.
533−/// This can be used in 2 ways:
534−///
535−/// - To get the correct indentation for an existing line (new_line=false), not necessarily equal to the current indentation.
536−/// - In this case, pos should be inside the first tree-sitter node on that line.
537−/// In most cases, this can just be the first non-whitespace on that line.
538−/// - To get the indentation for a new line (new_line=true). This behaves like the first usecase if the part of the current line
539−/// after pos were moved to a new line.
540−///
541−/// The indentation is determined by traversing all the tree-sitter nodes containing the position.
542−/// Each of these nodes produces some [Indentation] for:
543−///
544−/// - The line of the (beginning of the) node. This is defined by the scope `all` if this is the first node on its line.
545−/// - The line after the node. This is defined by:
546−/// - The scope `tail`.
547−/// - The scope `all` if this node is not the first node on its line.
548−/// Intuitively, `all` applies to everything contained in this node while `tail` applies to everything except for the first line of the node.
549−/// The indents from different nodes for the same line are then combined.
550−/// The result [Indentation] is simply the sum of the [Indentation] for all lines.
551−///
552−/// Specifying which line exactly an [Indentation] applies to is important because indents on the same line combine differently than indents on different lines:
553−/// ```ignore
554−/// some_function(|| {
555−/// // Both the function parameters as well as the contained block should be indented.
556−/// // Because they are on the same line, this only yields one indent level
557−/// });
558−/// ```
559−///
560−/// ```ignore
561−/// some_function(
562−/// param1,
563−/// || {
564−/// // Here we get 2 indent levels because the 'parameters' and the 'block' node begin on different lines
565−/// },
566−/// );
567−/// ```
722+/// Prepare an indent query by computing:
723+/// - The node from which to start the query (this is non-trivial due to `@extend` captures)
724+/// - The indent captures for all relevant nodes.
568725#[allow(clippy::too_many_arguments)]
569−pub fn treesitter_indent_for_pos(
726+fn init_indent_query<'a, 'b>(
570727 query: &Query,
571− syntax: &Syntax,
572− indent_style: &IndentStyle,
728+ syntax: &'a Syntax,
729+ text: RopeSlice<'b>,
573730 tab_width: usize,
574731 indent_width: usize,
575− text: RopeSlice,
576732 line: usize,
577− pos: usize,
578− new_line: bool,
579−) -> Option<String> {
580− let byte_pos = text.char_to_byte(pos);
733+ byte_pos: usize,
734+ new_line_byte_pos: Option<usize>,
735+) -> Option<(Node<'a>, HashMap<usize, Vec<IndentCapture<'b>>>)> {
581736 // The innermost tree-sitter node which is considered for the indent
582737 // computation. It may change if some predeceding node is extended
583738 let mut node = syntax
584739 .tree()
585740 .root_node()
586741 .descendant_for_byte_range(byte_pos, byte_pos)?;
742+
587743 let (query_result, deepest_preceding) = {
588744 // The query range should intersect with all nodes directly preceding
589745 // the position of the indent query in case one of them is extended.
@@ -614,13 +770,12 @@ pub fn treesitter_indent_for_pos(
614770 &mut cursor,
615771 text,
616772 query_range,
617− new_line.then_some((line, byte_pos)),
773+ new_line_byte_pos,
618774 );
619775 ts_parser.cursors.push(cursor);
620776 (query_result, deepest_preceding)
621777 })
622778 };
623− let indent_captures = query_result.indent_captures;
624779 let extend_captures = query_result.extend_captures;
625780
626781 // Check for extend captures, potentially changing the node that the indent calculation starts with
@@ -635,6 +790,68 @@ pub fn treesitter_indent_for_pos(
635790 indent_width,
636791 );
637792 }
793+ Some((node, query_result.indent_captures))
794+}
795+
796+/// Use the syntax tree to determine the indentation for a given position.
797+/// This can be used in 2 ways:
798+///
799+/// - To get the correct indentation for an existing line (new_line=false), not necessarily equal to the current indentation.
800+/// - In this case, pos should be inside the first tree-sitter node on that line.
801+/// In most cases, this can just be the first non-whitespace on that line.
802+/// - To get the indentation for a new line (new_line=true). This behaves like the first usecase if the part of the current line
803+/// after pos were moved to a new line.
804+///
805+/// The indentation is determined by traversing all the tree-sitter nodes containing the position.
806+/// Each of these nodes produces some [Indentation] for:
807+///
808+/// - The line of the (beginning of the) node. This is defined by the scope `all` if this is the first node on its line.
809+/// - The line after the node. This is defined by:
810+/// - The scope `tail`.
811+/// - The scope `all` if this node is not the first node on its line.
812+/// Intuitively, `all` applies to everything contained in this node while `tail` applies to everything except for the first line of the node.
813+/// The indents from different nodes for the same line are then combined.
814+/// The result [Indentation] is simply the sum of the [Indentation] for all lines.
815+///
816+/// Specifying which line exactly an [Indentation] applies to is important because indents on the same line combine differently than indents on different lines:
817+/// ```ignore
818+/// some_function(|| {
819+/// // Both the function parameters as well as the contained block should be indented.
820+/// // Because they are on the same line, this only yields one indent level
821+/// });
822+/// ```
823+///
824+/// ```ignore
825+/// some_function(
826+/// param1,
827+/// || {
828+/// // Here we get 2 indent levels because the 'parameters' and the 'block' node begin on different lines
829+/// },
830+/// );
831+/// ```
832+#[allow(clippy::too_many_arguments)]
833+pub fn treesitter_indent_for_pos<'a>(
834+ query: &Query,
835+ syntax: &Syntax,
836+ tab_width: usize,
837+ indent_width: usize,
838+ text: RopeSlice<'a>,
839+ line: usize,
840+ pos: usize,
841+ new_line: bool,
842+) -> Option<Indentation<'a>> {
843+ let byte_pos = text.char_to_byte(pos);
844+ let new_line_byte_pos = new_line.then_some(byte_pos);
845+ let (mut node, mut indent_captures) = init_indent_query(
846+ query,
847+ syntax,
848+ text,
849+ tab_width,
850+ indent_width,
851+ line,
852+ byte_pos,
853+ new_line_byte_pos,
854+ )?;
638855 let mut first_in_line = get_first_in_line(node, new_line.then_some(byte_pos));
639856
640857 let mut result = Indentation::default();
@@ -642,12 +859,16 @@ pub fn treesitter_indent_for_pos(
642859 // even if there are multiple "indent" nodes on the same line
643860 let mut indent_for_line = Indentation::default();
644861 let mut indent_for_line_below = Indentation::default();
862+
645863 loop {
646864 // This can safely be unwrapped because `first_in_line` contains
647865 // one entry for each ancestor of the node (which is what we iterate over)
648866 let is_first = *first_in_line.last().unwrap();
649− // Apply all indent definitions for this node
650− if let Some(definitions) = indent_captures.get(&node.id()) {
867+
868+ // Apply all indent definitions for this node.
869+ // Since we only iterate over each node once, we can remove the
870+ // corresponding captures from the HashMap to avoid cloning them.
871+ if let Some(definitions) = indent_captures.remove(&node.id()) {
651872 for definition in definitions {
652873 match definition.scope {
653874 IndentScope::All => {
@@ -665,28 +886,22 @@ pub fn treesitter_indent_for_pos(
665886 }
666887
667888 if let Some(parent) = node.parent() {
668− let mut node_line = node.start_position().row;
669− let mut parent_line = parent.start_position().row;
670− if node_line == line && new_line {
671− // Also consider the line that will be inserted
672− if node.start_byte() >= byte_pos {
673− node_line += 1;
674− }
675− if parent.start_byte() >= byte_pos {
676− parent_line += 1;
677− }
678− };
889+ let node_line = get_node_start_line(node, new_line_byte_pos);
890+ let parent_line = get_node_start_line(parent, new_line_byte_pos);
891+
679892 if node_line != parent_line {
893+ // Don't add indent for the line below the line of the query
680894 if node_line < line + (new_line as usize) {
681− // Don't add indent for the line below the line of the query
682− result.add_line(&indent_for_line_below);
895+ result.add_line(indent_for_line_below);
683896 }
897+
684898 if node_line == parent_line + 1 {
685899 indent_for_line_below = indent_for_line;
686900 } else {
687− result.add_line(&indent_for_line);
901+ result.add_line(indent_for_line);
688902 indent_for_line_below = Indentation::default();
689903 }
904+
690905 indent_for_line = Indentation::default();
691906 }
692907
@@ -698,13 +913,13 @@ pub fn treesitter_indent_for_pos(
698913 if (node.start_position().row < line)
699914 || (new_line && node.start_position().row == line && node.start_byte() < byte_pos)
700915 {
701− result.add_line(&indent_for_line_below);
916+ result.add_line(indent_for_line_below);
702917 }
703− result.add_line(&indent_for_line);
918+ result.add_line(indent_for_line);
704919 break;
705920 }
706921 }
707− Some(result.as_string(indent_style))
922+ Some(result)
708923}
709924
710925/// Returns the indentation for a new line.
@@ -713,6 +928,7 @@ pub fn treesitter_indent_for_pos(
713928pub fn indent_for_newline(
714929 language_config: Option<&LanguageConfiguration>,
715930 syntax: Option<&Syntax>,
931+ indent_heuristic: &IndentationHeuristic,
716932 indent_style: &IndentStyle,
717933 tab_width: usize,
718934 text: RopeSlice,
@@ -721,14 +937,18 @@ pub fn indent_for_newline(
721937 current_line: usize,
722938) -> String {
723939 let indent_width = indent_style.indent_width(tab_width);
724− if let (Some(query), Some(syntax)) = (
940+ if let (
941+ IndentationHeuristic::TreeSitter | IndentationHeuristic::Hybrid,
942+ Some(query),
943+ Some(syntax),
944+ ) = (
945+ indent_heuristic,
725946 language_config.and_then(|config| config.indent_query()),
726947 syntax,
727948 ) {
728949 if let Some(indent) = treesitter_indent_for_pos(
729950 query,
730951 syntax,
731− indent_style,
732952 tab_width,
733953 indent_width,
734954 text,
@@ -736,9 +956,57 @@ pub fn indent_for_newline(
736956 line_before_end_pos,
737957 true,
738958 ) {
739− return indent;
959+ if *indent_heuristic == IndentationHeuristic::Hybrid {
960+ // We want to compute the indentation not only based on the
961+ // syntax tree but also on the actual indentation of a previous
962+ // line. This makes indentation computation more resilient to
963+ // incomplete queries, incomplete source code & differing indentation
964+ // styles for the same language.
965+ // However, using the indent of a previous line as a baseline may not
966+ // make sense, e.g. if it has a different alignment than the new line.
967+ // In order to prevent edge cases with long running times, we only try
968+ // a constant number of (non-empty) lines.
969+ const MAX_ATTEMPTS: usize = 4;
970+ let mut num_attempts = 0;
971+ for line_idx in (0..=line_before).rev() {
972+ let line = text.line(line_idx);
973+ let first_non_whitespace_char = match find_first_non_whitespace_char(line) {
974+ Some(i) => i,
975+ None => {
976+ continue;
977+ }
978+ };
979+ if let Some(indent) = (|| {
980+ let computed_indent = treesitter_indent_for_pos(
981+ query,
982+ syntax,
983+ tab_width,
984+ indent_width,
985+ text,
986+ line_idx,
987+ text.line_to_char(line_idx) + first_non_whitespace_char,
988+ false,
989+ )?;
990+ let leading_whitespace = line.slice(0..first_non_whitespace_char);
991+ indent.relative_indent(
992+ &computed_indent,
993+ leading_whitespace,
994+ indent_style,
995+ tab_width,
996+ )
997+ })() {
998+ return indent;
999+ }
1000+ num_attempts += 1;
1001+ if num_attempts == MAX_ATTEMPTS {
1002+ break;
1003+ }
1004+ }
1005+ }
1006+ return indent.to_string(indent_style, tab_width);
7401007 };
7411008 }
1009+ // Fallback in case we either don't have indent queries or they failed for some reason
7421010 let indent_level = indent_level_for_line(text.line(current_line), tab_width, indent_width);
7431011 indent_style.as_str().repeat(indent_level)
7441012}
@@ -810,4 +1078,195 @@ mod test {
8101078 2
8111079 );
8121080 }
1081+
1082+ #[test]
1083+ fn add_capture() {
1084+ let indent = || Indentation {
1085+ indent: 1,
1086+ ..Default::default()
1087+ };
1088+ let indent_always = || Indentation {
1089+ indent_always: 1,
1090+ ..Default::default()
1091+ };
1092+ let outdent = || Indentation {
1093+ outdent: 1,
1094+ ..Default::default()
1095+ };
1096+ let outdent_always = || Indentation {
1097+ outdent_always: 1,
1098+ ..Default::default()
1099+ };
1100+
1101+ fn add_capture<'a>(
1102+ mut indent: Indentation<'a>,
1103+ capture: IndentCaptureType<'a>,
1104+ ) -> Indentation<'a> {
1105+ indent.add_capture(capture);
1106+ indent
1107+ }
1108+
1109+ // adding an indent to no indent makes an indent
1110+ assert_eq!(
1111+ indent(),
1112+ add_capture(Indentation::default(), IndentCaptureType::Indent)
1113+ );
1114+ assert_eq!(
1115+ indent_always(),
1116+ add_capture(Indentation::default(), IndentCaptureType::IndentAlways)
1117+ );
1118+ assert_eq!(
1119+ outdent(),
1120+ add_capture(Indentation::default(), IndentCaptureType::Outdent)
1121+ );
1122+ assert_eq!(
1123+ outdent_always(),
1124+ add_capture(Indentation::default(), IndentCaptureType::OutdentAlways)
1125+ );
1126+
1127+ // adding an indent to an already indented has no effect
1128+ assert_eq!(indent(), add_capture(indent(), IndentCaptureType::Indent));
1129+ assert_eq!(
1130+ outdent(),
1131+ add_capture(outdent(), IndentCaptureType::Outdent)
1132+ );
1133+
1134+ // adding an always to a regular makes it always
1135+ assert_eq!(
1136+ indent_always(),
1137+ add_capture(indent(), IndentCaptureType::IndentAlways)
1138+ );
1139+ assert_eq!(
1140+ outdent_always(),
1141+ add_capture(outdent(), IndentCaptureType::OutdentAlways)
1142+ );
1143+
1144+ // adding an always to an always is additive
1145+ assert_eq!(
1146+ Indentation {
1147+ indent_always: 2,
1148+ ..Default::default()
1149+ },
1150+ add_capture(indent_always(), IndentCaptureType::IndentAlways)
1151+ );
1152+ assert_eq!(
1153+ Indentation {
1154+ outdent_always: 2,
1155+ ..Default::default()
1156+ },
1157+ add_capture(outdent_always(), IndentCaptureType::OutdentAlways)
1158+ );
1159+
1160+ // adding regular to always should be associative
1161+ assert_eq!(
1162+ Indentation {
1163+ indent_always: 1,
1164+ ..Default::default()
1165+ },
1166+ add_capture(
1167+ add_capture(indent(), IndentCaptureType::Indent),
1168+ IndentCaptureType::IndentAlways
1169+ )
1170+ );
1171+ assert_eq!(
1172+ Indentation {
1173+ indent_always: 1,
1174+ ..Default::default()
1175+ },
1176+ add_capture(
1177+ add_capture(indent(), IndentCaptureType::IndentAlways),
1178+ IndentCaptureType::Indent
1179+ )
1180+ );
1181+ assert_eq!(
1182+ Indentation {
1183+ outdent_always: 1,
1184+ ..Default::default()
1185+ },
1186+ add_capture(
1187+ add_capture(outdent(), IndentCaptureType::Outdent),
1188+ IndentCaptureType::OutdentAlways
1189+ )
1190+ );
1191+ assert_eq!(
1192+ Indentation {
1193+ outdent_always: 1,
1194+ ..Default::default()
1195+ },
1196+ add_capture(
1197+ add_capture(outdent(), IndentCaptureType::OutdentAlways),
1198+ IndentCaptureType::Outdent
1199+ )
1200+ );
1201+ }
1202+
1203+ #[test]
1204+ fn test_relative_indent() {
1205+ let indent_style = IndentStyle::Spaces(4);
1206+ let tab_width: usize = 4;
1207+ let no_align = [
1208+ Indentation::default(),
1209+ Indentation {
1210+ indent: 1,
1211+ ..Default::default()
1212+ },
1213+ Indentation {
1214+ indent: 5,
1215+ outdent: 1,
1216+ ..Default::default()
1217+ },
1218+ ];
1219+ let align = no_align.clone().map(|indent| Indentation {
1220+ align: Some(RopeSlice::from("12345")),
1221+ ..indent
1222+ });
1223+ let different_align = Indentation {
1224+ align: Some(RopeSlice::from("123456")),
1225+ ..Default::default()
1226+ };
1227+
1228+ // Check that relative and absolute indentation computation are the same when the line we compare to is
1229+ // indented as we expect.
1230+ let check_consistency = |indent: &Indentation, other: &Indentation| {
1231+ assert_eq!(
1232+ indent.relative_indent(
1233+ other,
1234+ RopeSlice::from(other.to_string(&indent_style, tab_width).as_str()),
1235+ &indent_style,
1236+ tab_width
1237+ ),
1238+ Some(indent.to_string(&indent_style, tab_width))
1239+ );
1240+ };
1241+ for a in &no_align {
1242+ for b in &no_align {
1243+ check_consistency(a, b);
1244+ }
1245+ }
1246+ for a in &align {
1247+ for b in &align {
1248+ check_consistency(a, b);
1249+ }
1250+ }
1251+
1252+ // Relative indent computation makes no sense if the alignment differs
1253+ assert_eq!(
1254+ align[0].relative_indent(
1255+ &no_align[0],
1256+ RopeSlice::from(" "),
1257+ &indent_style,
1258+ tab_width
1259+ ),
1260+ None
1261+ );
1262+ assert_eq!(
1263+ align[0].relative_indent(
1264+ &different_align,
1265+ RopeSlice::from(" "),
1266+ &indent_style,
1267+ tab_width
1268+ ),
1269+ None
1270+ );
1271+ }
8131272}
helix-core/src/lib.rs+1
@@ -7,6 +7,7 @@ pub mod config;
77pub mod diagnostic;
88pub mod diff;
99pub mod doc_formatter;
10+pub mod fuzzy;
1011pub mod graphemes;
1112pub mod history;
1213pub mod increment;
helix-core/src/path.rs+2−2
@@ -85,7 +85,7 @@ pub fn get_normalized_path(path: &Path) -> PathBuf {
8585///
8686/// This function is used instead of `std::fs::canonicalize` because we don't want to verify
8787/// here if the path exists, just normalize it's components.
88−pub fn get_canonicalized_path(path: &Path) -> std::io::Result<PathBuf> {
88+pub fn get_canonicalized_path(path: &Path) -> PathBuf {
8989 let path = expand_tilde(path);
9090 let path = if path.is_relative() {
9191 helix_loader::current_working_dir().join(path)
@@ -93,7 +93,7 @@ pub fn get_canonicalized_path(path: &Path) -> std::io::Result<PathBuf> {
9393 path
9494 };
9595
96− Ok(get_normalized_path(path.as_path()))
96+ get_normalized_path(path.as_path())
9797}
9898
9999pub fn get_relative_path(path: &Path) -> PathBuf {
helix-core/src/syntax.rs+24−8
@@ -101,7 +101,8 @@ pub struct LanguageConfiguration {
101101 pub file_types: Vec<FileType>, // filename extension or ends_with? <Gemfile, rb, etc>
102102 #[serde(default)]
103103 pub shebangs: Vec<String>, // interpreter(s) associated with language
104− pub roots: Vec<String>, // these indicate project roots <.git, Cargo.toml>
104+ #[serde(default)]
105+ pub roots: Vec<String>, // these indicate project roots <.git, Cargo.toml>
105106 pub comment_token: Option<String>,
106107 pub text_width: Option<usize>,
107108 pub soft_wrap: Option<SoftWrap>,
@@ -154,6 +155,8 @@ pub struct LanguageConfiguration {
154155 /// Hardcoded LSP root directories relative to the workspace root, like `examples` or `tools/fuzz`.
155156 /// Falling back to the current working directory if none are configured.
156157 pub workspace_lsp_roots: Option<Vec<PathBuf>>,
158+ #[serde(default)]
159+ pub persistent_diagnostic_sources: Vec<String>,
157160}
158161
159162#[derive(Debug, PartialEq, Eq, Hash)]
@@ -211,10 +214,7 @@ impl<'de> Deserialize<'de> for FileType {
211214 {
212215 match map.next_entry::<String, String>()? {
213216 Some((key, suffix)) if key == "suffix" => Ok(FileType::Suffix({
214− // FIXME: use `suffix.replace('/', std::path::MAIN_SEPARATOR_STR)`
215− // if MSRV is updated to 1.68
216− let mut separator = [0; 1];
217− suffix.replace('/', std::path::MAIN_SEPARATOR.encode_utf8(&mut separator))
217+ suffix.replace('/', std::path::MAIN_SEPARATOR_STR)
218218 })),
219219 Some((key, _value)) => Err(serde::de::Error::custom(format!(
220220 "unknown key in `file-types` list: {}",
@@ -444,6 +444,22 @@ pub struct IndentationConfiguration {
444444 pub unit: String,
445445}
446446
447+/// How the indentation for a newly inserted line should be determined.
448+/// If the selected heuristic is not available (e.g. because the current
449+/// language has no tree-sitter indent queries), a simpler one will be used.
450+#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
451+#[serde(rename_all = "kebab-case")]
452+pub enum IndentationHeuristic {
453+ /// Just copy the indentation of the line that the cursor is currently on.
454+ Simple,
455+ /// Use tree-sitter indent queries to compute the expected absolute indentation level of the new line.
456+ TreeSitter,
457+ /// Use tree-sitter indent queries to compute the expected difference in indentation between the new line
458+ /// and the line before. Add this to the actual indentation level of the line before.
459+ #[default]
460+ Hybrid,
461+}
462+
447463/// Configuration for auto pairs
448464#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
449465#[serde(rename_all = "kebab-case", deny_unknown_fields, untagged)]
@@ -962,7 +978,7 @@ impl Syntax {
962978 let res = syntax.update(source, source, &ChangeSet::new(source));
963979
964980 if res.is_err() {
965− log::error!("TS parser failed, disabeling TS for the current buffer: {res:?}");
981+ log::error!("TS parser failed, disabling TS for the current buffer: {res:?}");
966982 return None;
967983 }
968984 Some(syntax)
@@ -1614,7 +1630,7 @@ impl<'a> Iterator for ChunksBytes<'a> {
16141630}
16151631
16161632pub struct RopeProvider<'a>(pub RopeSlice<'a>);
1617−impl<'a> TextProvider<'a> for RopeProvider<'a> {
1633+impl<'a> TextProvider<&'a [u8]> for RopeProvider<'a> {
16181634 type I = ChunksBytes<'a>;
16191635
16201636 fn text(&mut self, node: Node) -> Self::I {
@@ -1628,7 +1644,7 @@ impl<'a> TextProvider<'a> for RopeProvider<'a> {
16281644struct HighlightIterLayer<'a> {
16291645 _tree: Option<Tree>,
16301646 cursor: QueryCursor,
1631− captures: RefCell<iter::Peekable<QueryCaptures<'a, 'a, RopeProvider<'a>>>>,
1647+ captures: RefCell<iter::Peekable<QueryCaptures<'a, 'a, RopeProvider<'a>, &'a [u8]>>>,
16321648 config: &'a HighlightConfiguration,
16331649 highlight_end_stack: Vec<usize>,
16341650 scope_stack: Vec<LocalScope<'a>>,
helix-core/src/transaction.rs+73−14
@@ -1,7 +1,7 @@
11use ropey::RopeSlice;
22use smallvec::SmallVec;
33
4−use crate::{Range, Rope, Selection, Tendril};
4+use crate::{chars::char_is_word, Range, Rope, Selection, Tendril};
55use std::{borrow::Cow, iter::once};
66
77/// (from, to, replacement)
@@ -23,6 +23,30 @@ pub enum Operation {
2323pub enum Assoc {
2424 Before,
2525 After,
26+ /// Acts like `After` if a word character is inserted
27+ /// after the position, otherwise acts like `Before`
28+ AfterWord,
29+ /// Acts like `Before` if a word character is inserted
30+ /// before the position, otherwise acts like `After`
31+ BeforeWord,
32+}
33+
34+impl Assoc {
35+ /// Whether to stick to gaps
36+ fn stay_at_gaps(self) -> bool {
37+ !matches!(self, Self::BeforeWord | Self::AfterWord)
38+ }
39+
40+ fn insert_offset(self, s: &str) -> usize {
41+ let chars = s.chars().count();
42+ match self {
43+ Assoc::After => chars,
44+ Assoc::AfterWord => s.chars().take_while(|&c| char_is_word(c)).count(),
45+ // return position before inserted text
46+ Assoc::Before => 0,
47+ Assoc::BeforeWord => chars - s.chars().rev().take_while(|&c| char_is_word(c)).count(),
48+ }
49+ }
2650}
2751
2852#[derive(Debug, Default, Clone, PartialEq, Eq)]
@@ -415,8 +439,6 @@ impl ChangeSet {
415439 map!(|pos, _| (old_end > pos).then_some(new_pos), i);
416440 }
417441 Insert(s) => {
418− let ins = s.chars().count();
419−
420442 // a subsequent delete means a replace, consume it
421443 if let Some((_, Delete(len))) = iter.peek() {
422444 iter.next();
@@ -424,13 +446,13 @@ impl ChangeSet {
424446 old_end = old_pos + len;
425447 // in range of replaced text
426448 map!(
427− |pos, assoc| (old_end > pos).then(|| {
449+ |pos, assoc: Assoc| (old_end > pos).then(|| {
428450 // at point or tracking before
429− if pos == old_pos || assoc == Assoc::Before {
451+ if pos == old_pos && assoc.stay_at_gaps() {
430452 new_pos
431453 } else {
432454 // place to end of insert
433− new_pos + ins
455+ new_pos + assoc.insert_offset(s)
434456 }
435457 }),
436458 i
@@ -438,20 +460,15 @@ impl ChangeSet {
438460 } else {
439461 // at insert point
440462 map!(
441− |pos, assoc| (old_pos == pos).then(|| {
463+ |pos, assoc: Assoc| (old_pos == pos).then(|| {
442464 // return position before inserted text
443− if assoc == Assoc::Before {
444− new_pos
445− } else {
446− // after text
447− new_pos + ins
448− }
465+ new_pos + assoc.insert_offset(s)
449466 }),
450467 i
451468 );
452469 }
453470
454− new_pos += ins;
471+ new_pos += s.chars().count();
455472 }
456473 }
457474 old_pos = old_end;
@@ -884,6 +901,48 @@ mod test {
884901 let mut positions = [4, 2];
885902 cs.update_positions(positions.iter_mut().map(|pos| (pos, Assoc::After)));
886903 assert_eq!(positions, [4, 2]);
904+ // stays at word boundary
905+ let cs = ChangeSet {
906+ changes: vec![
907+ Retain(2), // <space><space>
908+ Insert(" ab".into()),
909+ Retain(2), // cd
910+ Insert("de ".into()),
911+ ],
912+ len: 4,
913+ len_after: 10,
914+ };
915+ assert_eq!(cs.map_pos(2, Assoc::BeforeWord), 3);
916+ assert_eq!(cs.map_pos(4, Assoc::AfterWord), 9);
917+ let cs = ChangeSet {
918+ changes: vec![
919+ Retain(1), // <space>
920+ Insert(" b".into()),
921+ Delete(1), // c
922+ Retain(1), // d
923+ Insert("e ".into()),
924+ Delete(1), // <space>
925+ ],
926+ len: 5,
927+ len_after: 7,
928+ };
929+ assert_eq!(cs.map_pos(1, Assoc::BeforeWord), 2);
930+ assert_eq!(cs.map_pos(3, Assoc::AfterWord), 5);
931+ let cs = ChangeSet {
932+ changes: vec![
933+ Retain(1), // <space>
934+ Insert("a".into()),
935+ Delete(2), // <space>b
936+ Retain(1), // d
937+ Insert("e".into()),
938+ Delete(1), // f
939+ Retain(1), // <space>
940+ ],
941+ len: 5,
942+ len_after: 7,
943+ };
944+ assert_eq!(cs.map_pos(2, Assoc::BeforeWord), 1);
945+ assert_eq!(cs.map_pos(4, Assoc::AfterWord), 4);
887946 }
888947
889948 #[test]
helix-core/src/wrap.rs+3−1
@@ -1,7 +1,9 @@
11use smartstring::{LazyCompact, SmartString};
2+use textwrap::{Options, WordSplitter::NoHyphenation};
23
34/// Given a slice of text, return the text re-wrapped to fit it
45/// within the given width.
56pub fn reflow_hard_wrap(text: &str, text_width: usize) -> SmartString<LazyCompact> {
6− textwrap::refill(text, text_width).into()
7+ let options = Options::new(text_width).word_splitter(NoHyphenation);
8+ textwrap::refill(text, options).into()
79}
helix-core/tests/data/indent/cpp.cppnew file+48
@@ -0,0 +1,48 @@
1+std::vector<std::string>
2+fn_with_many_parameters(int parm1, long parm2, float parm3, double parm4,
3+ char* parm5, bool parm6);
4+
5+std::vector<std::string>
6+fn_with_many_parameters(int parm1, long parm2, float parm3, double parm4,
7+ char* parm5, bool parm6) {
8+ auto lambda = []() {
9+ return 0;
10+ };
11+ auto lambda_with_a_really_long_name_that_uses_a_whole_line
12+ = [](int some_more_aligned_parameters,
13+ std::string parm2) {
14+ do_smth();
15+ };
16+ if (brace_on_same_line) {
17+ do_smth();
18+ } else if (brace_on_next_line)
19+ {
20+ do_smth();
21+ } else if (another_condition) {
22+ do_smth();
23+ }
24+ else {
25+ do_smth();
26+ }
27+ if (inline_if_statement)
28+ do_smth();
29+ if (another_inline_if_statement)
30+ return [](int parm1, char* parm2) {
31+ this_is_a_really_pointless_lambda();
32+ };
33+
34+ switch (var) {
35+ case true:
36+ return -1;
37+ case false:
38+ return 42;
39+ }
40+}
41+
42+class MyClass : public MyBaseClass {
43+public:
44+ MyClass();
45+ void public_fn();
46+private:
47+ super_secret_private_fn();
48+}
helix-core/tests/data/indent/indent.rsdeleted−1
@@ -1 +0,0 @@
1−../../../src/indent.rs
helix-core/tests/data/indent/languages.toml+13
@@ -11,3 +11,16 @@ indent = { tab-width = 4, unit = " " }
1111[[grammar]]
1212name = "rust"
1313source = { git = "https://github.com/tree-sitter/tree-sitter-rust", rev = "0431a2c60828731f27491ee9fdefe25e250ce9c9" }
14+
15+[[language]]
16+name = "cpp"
17+scope = "source.cpp"
18+injection-regex = "cpp"
19+file-types = ["cc", "hh", "c++", "cpp", "hpp", "h", "ipp", "tpp", "cxx", "hxx", "ixx", "txx", "ino", "C", "H"]
20+roots = []
21+comment-token = "//"
22+indent = { tab-width = 2, unit = " " }
23+
24+[[grammar]]
25+name = "cpp"
26+source = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "2d2c4aee8672af4c7c8edff68e7dd4c07e88d2b1" }
helix-core/tests/indent.rs+151−23
@@ -1,20 +1,122 @@
11use helix_core::{
22 indent::{indent_level_for_line, treesitter_indent_for_pos, IndentStyle},
3− syntax::Loader,
3+ syntax::{Configuration, Loader},
44 Syntax,
55};
6−use std::path::PathBuf;
6+use ropey::Rope;
7+use std::{ops::Range, path::PathBuf, process::Command};
78
89#[test]
910fn test_treesitter_indent_rust() {
10− test_treesitter_indent("rust.rs", "source.rust");
11+ standard_treesitter_test("rust.rs", "source.rust");
1112}
13+
14+#[test]
15+fn test_treesitter_indent_cpp() {
16+ standard_treesitter_test("cpp.cpp", "source.cpp");
17+}
18+
1219#[test]
13−fn test_treesitter_indent_rust_2() {
14− test_treesitter_indent("indent.rs", "source.rust");
15− // TODO Use commands.rs as indentation test.
16− // Currently this fails because we can't align the parameters of a closure yet
17− // test_treesitter_indent("commands.rs", "source.rust");
20+fn test_treesitter_indent_rust_helix() {
21+ // We pin a specific git revision to prevent unrelated changes from causing the indent tests to fail.
22+ // Ideally, someone updates this once in a while and fixes any errors that occur.
23+ let rev = "af382768cdaf89ff547dbd8f644a1bddd90e7c8f";
24+ let files = Command::new("git")
25+ .args([
26+ "ls-tree",
27+ "-r",
28+ "--name-only",
29+ "--full-tree",
30+ rev,
31+ "helix-term/src",
32+ ])
33+ .output()
34+ .unwrap();
35+ let files = String::from_utf8(files.stdout).unwrap();
36+
37+ let ignored_files = vec![
38+ // Contains many macros that tree-sitter does not parse in a meaningful way and is otherwise not very interesting
39+ "helix-term/src/health.rs",
40+ ];
41+
42+ for file in files.split_whitespace() {
43+ if ignored_files.contains(&file) {
44+ continue;
45+ }
46+ let ignored_lines: Vec<Range<usize>> = match file {
47+ "helix-term/src/application.rs" => vec![
48+ // We can't handle complicated indent rules inside macros (`json!` in this case) since
49+ // the tree-sitter grammar only parses them as `token_tree` and `identifier` nodes.
50+ 1045..1051,
51+ ],
52+ "helix-term/src/commands.rs" => vec![
53+ // This is broken because of the current handling of `call_expression`
54+ // (i.e. having an indent query for it but outdenting again in specific cases).
55+ // The indent query is needed to correctly handle multi-line arguments in function calls
56+ // inside indented `field_expression` nodes (which occurs fairly often).
57+ //
58+ // Once we have the `@indent.always` capture type, it might be possible to just have an indent
59+ // capture for the `arguments` field of a call expression. That could enable us to correctly
60+ // handle this.
61+ 2226..2230,
62+ ],
63+ "helix-term/src/commands/dap.rs" => vec![
64+ // Complex `format!` macro
65+ 46..52,
66+ ],
67+ "helix-term/src/commands/lsp.rs" => vec![
68+ // Macro
69+ 624..627,
70+ // Return type declaration of a closure. `cargo fmt` adds an additional space here,
71+ // which we cannot (yet) model with our indent queries.
72+ 878..879,
73+ // Same as in `helix-term/src/commands.rs`
74+ 1335..1343,
75+ ],
76+ "helix-term/src/config.rs" => vec![
77+ // Multiline string
78+ 146..152,
79+ ],
80+ "helix-term/src/keymap.rs" => vec![
81+ // Complex macro (see above)
82+ 456..470,
83+ // Multiline string without indent
84+ 563..567,
85+ ],
86+ "helix-term/src/main.rs" => vec![
87+ // Multiline string
88+ 44..70,
89+ ],
90+ "helix-term/src/ui/completion.rs" => vec![
91+ // Macro
92+ 218..232,
93+ ],
94+ "helix-term/src/ui/editor.rs" => vec![
95+ // The chained function calls here are not indented, probably because of the comment
96+ // in between. Since `cargo fmt` doesn't even attempt to format it, there's probably
97+ // no point in trying to indent this correctly.
98+ 342..350,
99+ ],
100+ "helix-term/src/ui/lsp.rs" => vec![
101+ // Macro
102+ 56..61,
103+ ],
104+ "helix-term/src/ui/statusline.rs" => vec![
105+ // Same as in `helix-term/src/commands.rs`
106+ 436..442,
107+ 450..456,
108+ ],
109+ _ => Vec::new(),
110+ };
111+
112+ let git_object = rev.to_string() + ":" + file;
113+ let content = Command::new("git")
114+ .args(["cat-file", "blob", &git_object])
115+ .output()
116+ .unwrap();
117+ let doc = Rope::from_reader(&mut content.stdout.as_slice()).unwrap();
118+ test_treesitter_indent(file, doc, "source.rust", ignored_lines);
119+ }
18120}
19121
20122#[test]
@@ -50,20 +152,41 @@ fn test_indent_level_for_line_with_spaces_and_tabs() {
50152 assert_eq!(indent_level, 2)
51153}
52154
53−fn test_treesitter_indent(file_name: &str, lang_scope: &str) {
155+fn indent_tests_dir() -> PathBuf {
54156 let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
55157 test_dir.push("tests/data/indent");
158+ test_dir
159+}
56160
57− let mut test_file = test_dir.clone();
58− test_file.push(file_name);
59− let test_file = std::fs::File::open(test_file).unwrap();
161+fn indent_test_path(name: &str) -> PathBuf {
162+ let mut path = indent_tests_dir();
163+ path.push(name);
164+ path
165+}
166+
167+fn indent_tests_config() -> Configuration {
168+ let mut config_path = indent_tests_dir();
169+ config_path.push("languages.toml");
170+ let config = std::fs::read_to_string(config_path).unwrap();
171+ toml::from_str(&config).unwrap()
172+}
173+
174+fn standard_treesitter_test(file_name: &str, lang_scope: &str) {
175+ let test_path = indent_test_path(file_name);
176+ let test_file = std::fs::File::open(test_path).unwrap();
60177 let doc = ropey::Rope::from_reader(test_file).unwrap();
178+ test_treesitter_indent(file_name, doc, lang_scope, Vec::new())
179+}
61180
62− let mut config_file = test_dir;
63− config_file.push("languages.toml");
64− let config = std::fs::read_to_string(config_file).unwrap();
65− let config = toml::from_str(&config).unwrap();
66− let loader = Loader::new(config);
181+/// Test that all the lines in the given file are indented as expected.
182+/// ignored_lines is a list of (1-indexed) line ranges that are excluded from this test.
183+fn test_treesitter_indent(
184+ test_name: &str,
185+ doc: Rope,
186+ lang_scope: &str,
187+ ignored_lines: Vec<std::ops::Range<usize>>,
188+) {
189+ let loader = Loader::new(indent_tests_config());
67190
68191 // set runtime path so we can find the queries
69192 let mut runtime = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
@@ -71,6 +194,7 @@ fn test_treesitter_indent(file_name: &str, lang_scope: &str) {
71194 std::env::set_var("HELIX_RUNTIME", runtime.to_str().unwrap());
72195
73196 let language_config = loader.language_config_for_scope(lang_scope).unwrap();
197+ let indent_style = IndentStyle::from_str(&language_config.indent.as_ref().unwrap().unit);
74198 let highlight_config = language_config.highlight_config(&[]).unwrap();
75199 let text = doc.slice(..);
76200 let syntax = Syntax::new(text, highlight_config, std::sync::Arc::new(loader)).unwrap();
@@ -78,23 +202,27 @@ fn test_treesitter_indent(file_name: &str, lang_scope: &str) {
78202
79203 for i in 0..doc.len_lines() {
80204 let line = text.line(i);
205+ if ignored_lines.iter().any(|range| range.contains(&(i + 1))) {
206+ continue;
207+ }
81208 if let Some(pos) = helix_core::find_first_non_whitespace_char(line) {
82− let tab_and_indent_width: usize = 4;
209+ let tab_width: usize = 4;
83210 let suggested_indent = treesitter_indent_for_pos(
84211 indent_query,
85212 &syntax,
86− &IndentStyle::Spaces(tab_and_indent_width as u8),
87− tab_and_indent_width,
88− tab_and_indent_width,
213+ tab_width,
214+ indent_style.indent_width(tab_width),
89215 text,
90216 i,
91217 text.line_to_char(i) + pos,
92218 false,
93219 )
94− .unwrap();
220+ .unwrap()
221+ .to_string(&indent_style, tab_width);
95222 assert!(
96223 line.get_slice(..pos).map_or(false, |s| s == suggested_indent),
97− "Wrong indentation on line {}:\n\"{}\" (original line)\n\"{}\" (suggested indentation)\n",
224+ "Wrong indentation for file {:?} on line {}:\n\"{}\" (original line)\n\"{}\" (suggested indentation)\n",
225+ test_name,
98226 i+1,
99227 line.slice(..line.len_chars()-1),
100228 suggested_indent,
helix-dap/Cargo.toml+11−9
@@ -1,25 +1,27 @@
11[package]
22name = "helix-dap"
3−version = "0.6.0"
4−authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2018"
6−license = "MPL-2.0"
73description = "DAP client implementation for Helix project"
8−categories = ["editor"]
9−repository = "https://github.com/helix-editor/helix"
10−homepage = "https://helix-editor.com"
4+version.workspace = true
5+authors.workspace = true
6+edition.workspace = true
7+license.workspace = true
8+rust-version.workspace = true
9+categories.workspace = true
10+repository.workspace = true
11+homepage.workspace = true
1112
1213# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1314
1415[dependencies]
15−helix-core = { version = "0.6", path = "../helix-core" }
16+helix-core = { path = "../helix-core" }
17+
1618anyhow = "1.0"
1719log = "0.4"
1820serde = { version = "1.0", features = ["derive"] }
1921serde_json = "1.0"
2022thiserror = "1.0"
2123tokio = { version = "1", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "net", "sync"] }
22−which = "4.4"
24+which = "5.0.0"
2325
2426[dev-dependencies]
2527fern = "0.6"
helix-event/Cargo.tomlnew file+16
@@ -0,0 +1,16 @@
1+[package]
2+name = "helix-event"
3+version.workspace = true
4+authors.workspace = true
5+edition.workspace = true
6+license.workspace = true
7+rust-version.workspace = true
8+categories.workspace = true
9+repository.workspace = true
10+homepage.workspace = true
11+
12+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13+
14+[dependencies]
15+tokio = { version = "1", features = ["rt", "rt-multi-thread", "time", "sync", "parking_lot"] }
16+parking_lot = { version = "0.12", features = ["send_guard"] }
helix-event/src/lib.rsnew file+8
@@ -0,0 +1,8 @@
1+//! `helix-event` contains systems that allow (often async) communication between
2+//! different editor components without strongly coupling them. Currently this
3+//! crate only contains some smaller facilities but the intend is to add more
4+//! functionality in the future ( like a generic hook system)
5+
6+pub use redraw::{lock_frame, redraw_requested, request_redraw, start_frame, RenderLockGuard};
7+
8+mod redraw;
helix-event/src/redraw.rsnew file+49
@@ -0,0 +1,49 @@
1+//! Signals that control when/if the editor redraws
2+
3+use std::future::Future;
4+
5+use parking_lot::{RwLock, RwLockReadGuard};
6+use tokio::sync::Notify;
7+
8+/// A `Notify` instance that can be used to (asynchronously) request
9+/// the editor the render a new frame.
10+static REDRAW_NOTIFY: Notify = Notify::const_new();
11+
12+/// A `RwLock` that prevents the next frame from being
13+/// drawn until an exclusive (write) lock can be acquired.
14+/// This allows asynchsonous tasks to acquire `non-exclusive`
15+/// locks (read) to prevent the next frame from being drawn
16+/// until a certain computation has finished.
17+static RENDER_LOCK: RwLock<()> = RwLock::new(());
18+
19+pub type RenderLockGuard = RwLockReadGuard<'static, ()>;
20+
21+/// Requests that the editor is redrawn. The redraws are debounced (currently to
22+/// 30FPS) so this can be called many times without causing a ton of frames to
23+/// be rendered.
24+pub fn request_redraw() {
25+ REDRAW_NOTIFY.notify_one();
26+}
27+
28+/// Returns a future that will yield once a redraw has been asynchronously
29+/// requested using [`request_redraw`].
30+pub fn redraw_requested() -> impl Future<Output = ()> {
31+ REDRAW_NOTIFY.notified()
32+}
33+
34+/// Wait until all locks acquired with [`lock_frame`] have been released.
35+/// This function is called before rendering and is intended to allow the frame
36+/// to wait for async computations that should be included in the current frame.
37+pub fn start_frame() {
38+ drop(RENDER_LOCK.write());
39+ // exhaust any leftover redraw notifications
40+ let notify = REDRAW_NOTIFY.notified();
41+ tokio::pin!(notify);
42+ notify.enable();
43+}
44+
45+/// Acquires the render lock which will prevent the next frame from being drawn
46+/// until the returned guard is dropped.
47+pub fn lock_frame() -> RenderLockGuard {
48+ RENDER_LOCK.read()
49+}
helix-loader/Cargo.toml+12−11
@@ -1,13 +1,14 @@
11[package]
22name = "helix-loader"
3−version = "0.6.0"
4−description = "A post-modern text editor."
5−authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
6−edition = "2021"
7−license = "MPL-2.0"
8−categories = ["editor"]
9−repository = "https://github.com/helix-editor/helix"
10−homepage = "https://helix-editor.com"
3+description = "Build bootstrapping for Helix crates"
4+version.workspace = true
5+authors.workspace = true
6+edition.workspace = true
7+license.workspace = true
8+rust-version.workspace = true
9+categories.workspace = true
10+repository.workspace = true
11+homepage.workspace = true
1112
1213[[bin]]
1314name = "hx-loader"
@@ -19,16 +20,16 @@ serde = { version = "1.0", features = ["derive"] }
1920toml = "0.7"
2021etcetera = "0.8"
2122tree-sitter.workspace = true
22−once_cell = "1.18"
23+once_cell = "1.19"
2324log = "0.4"
24−which = "4.4"
25+which = "5.0.0"
2526
2627# TODO: these two should be on !wasm32 only
2728
2829# cloning/compiling tree-sitter grammars
2930cc = { version = "1" }
3031threadpool = { version = "1.0" }
31−tempfile = "3.7.1"
32+tempfile = "3.8.1"
3233dunce = "1.0.4"
3334
3435[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
helix-loader/build.rs+14−4
@@ -2,7 +2,17 @@ use std::borrow::Cow;
22use std::path::Path;
33use std::process::Command;
44
5−const VERSION: &str = include_str!("../VERSION");
5+const MAJOR: &str = env!("CARGO_PKG_VERSION_MAJOR");
6+const MINOR: &str = env!("CARGO_PKG_VERSION_MINOR");
7+const PATCH: &str = env!("CARGO_PKG_VERSION_PATCH");
8+
9+fn get_calver() -> String {
10+ if PATCH == "0" {
11+ format!("{MAJOR}.{MINOR}")
12+ } else {
13+ format!("{MAJOR}.{MINOR}.{PATCH}")
14+ }
15+}
616
717fn main() {
818 let git_hash = Command::new("git")
@@ -12,9 +22,10 @@ fn main() {
1222 .filter(|output| output.status.success())
1323 .and_then(|x| String::from_utf8(x.stdout).ok());
1424
25+ let calver = get_calver();
1526 let version: Cow<_> = match &git_hash {
16− Some(git_hash) => format!("{} ({})", VERSION, &git_hash[..8]).into(),
17− None => VERSION.into(),
27+ Some(git_hash) => format!("{} ({})", calver, &git_hash[..8]).into(),
28+ None => calver.into(),
1829 };
1930
2031 println!(
@@ -22,7 +33,6 @@ fn main() {
2233 std::env::var("TARGET").unwrap()
2334 );
2435
25− println!("cargo:rerun-if-changed=../VERSION");
2636 println!("cargo:rustc-env=VERSION_AND_GIT_HASH={}", version);
2737
2838 if git_hash.is_none() {
helix-loader/src/lib.rs+13−4
@@ -33,9 +33,9 @@ pub fn current_working_dir() -> PathBuf {
3333 path
3434}
3535
36−pub fn set_current_working_dir(path: PathBuf) -> std::io::Result<()> {
36+pub fn set_current_working_dir(path: impl AsRef<Path>) -> std::io::Result<()> {
3737 let path = dunce::canonicalize(path)?;
38− std::env::set_current_dir(path.clone())?;
38+ std::env::set_current_dir(&path)?;
3939 let mut cwd = CWD.write().unwrap();
4040 *cwd = Some(path);
4141 Ok(())
@@ -60,7 +60,8 @@ pub fn initialize_log_file(specified_file: Option<PathBuf>) {
6060/// 1. sibling directory to `CARGO_MANIFEST_DIR` (if environment variable is set)
6161/// 2. subdirectory of user config directory (always included)
6262/// 3. `HELIX_RUNTIME` (if environment variable is set)
63−/// 4. subdirectory of path to helix executable (always included)
63+/// 4. `HELIX_DEFAULT_RUNTIME` (if environment variable is set *at build time*)
64+/// 5. subdirectory of path to helix executable (always included)
6465///
6566/// Postcondition: returns at least two paths (they might not exist).
6667fn prioritize_runtime_dirs() -> Vec<PathBuf> {
@@ -81,6 +82,14 @@ fn prioritize_runtime_dirs() -> Vec<PathBuf> {
8182 rt_dirs.push(dir.into());
8283 }
8384
85+ // If this variable is set during build time, it will always be included
86+ // in the lookup list. This allows downstream packagers to set a fallback
87+ // directory to a location that is conventional on their distro so that they
88+ // need not resort to a wrapper script or a global environment variable.
89+ if let Some(dir) = std::option_env!("HELIX_DEFAULT_RUNTIME") {
90+ rt_dirs.push(dir.into());
91+ }
92+
8493 // fallback to location of the executable being run
8594 // canonicalize the path in case the executable is symlinked
8695 let exe_rt_dir = std::env::current_exe()
@@ -280,7 +289,7 @@ mod merge_toml_tests {
280289 let cwd = current_working_dir();
281290 assert_ne!(cwd, new_path);
282291
283− set_current_working_dir(new_path.clone()).expect("Couldn't set new path");
292+ set_current_working_dir(&new_path).expect("Couldn't set new path");
284293
285294 let cwd = current_working_dir();
286295 assert_eq!(cwd, new_path);
helix-lsp/Cargo.toml+15−14
@@ -1,31 +1,32 @@
11[package]
22name = "helix-lsp"
3−version = "0.6.0"
4−authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2021"
6−license = "MPL-2.0"
73description = "LSP client implementation for Helix project"
8−categories = ["editor"]
9−repository = "https://github.com/helix-editor/helix"
10−homepage = "https://helix-editor.com"
4+version.workspace = true
5+authors.workspace = true
6+edition.workspace = true
7+license.workspace = true
8+rust-version.workspace = true
9+categories.workspace = true
10+repository.workspace = true
11+homepage.workspace = true
1112
1213# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1314
1415[dependencies]
15−helix-core = { version = "0.6", path = "../helix-core" }
16−helix-loader = { version = "0.6", path = "../helix-loader" }
17−helix-parsec = { version = "0.6", path = "../helix-parsec" }
16+helix-core = { path = "../helix-core" }
17+helix-loader = { path = "../helix-loader" }
18+helix-parsec = { path = "../helix-parsec" }
1819
1920anyhow = "1.0"
2021futures-executor = "0.3"
2122futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
22−globset = "0.4.13"
23+globset = "0.4.14"
2324log = "0.4"
24−lsp-types = { version = "0.94" }
25+lsp-types = { version = "0.95" }
2526serde = { version = "1.0", features = ["derive"] }
2627serde_json = "1.0"
2728thiserror = "1.0"
28−tokio = { version = "1.29", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }
29+tokio = { version = "1.35", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }
2930tokio-stream = "0.1.14"
30−which = "4.4"
31+which = "5.0.0"
3132parking_lot = "0.12.1"
helix-lsp/src/client.rs+87−13
@@ -401,12 +401,22 @@ impl Client {
401401 &self,
402402 params: R::Params,
403403 ) -> impl Future<Output = Result<Value>>
404+ where
405+ R::Params: serde::Serialize,
406+ {
407+ self.call_with_timeout::<R>(params, self.req_timeout)
408+ }
409+
410+ fn call_with_timeout<R: lsp::request::Request>(
411+ &self,
412+ params: R::Params,
413+ timeout_secs: u64,
414+ ) -> impl Future<Output = Result<Value>>
404415 where
405416 R::Params: serde::Serialize,
406417 {
407418 let server_tx = self.server_tx.clone();
408419 let id = self.next_request_id();
409− let timeout_secs = self.req_timeout;
410420
411421 async move {
412422 use std::time::Duration;
@@ -548,6 +558,11 @@ impl Client {
548558 dynamic_registration: Some(true),
549559 relative_pattern_support: Some(false),
550560 }),
561+ file_operations: Some(lsp::WorkspaceFileOperationsClientCapabilities {
562+ will_rename: Some(true),
563+ did_rename: Some(true),
564+ ..Default::default()
565+ }),
551566 ..Default::default()
552567 }),
553568 text_document: Some(lsp::TextDocumentClientCapabilities {
@@ -652,6 +667,7 @@ impl Client {
652667 version: Some(String::from(VERSION_AND_GIT_HASH)),
653668 }),
654669 locale: None, // TODO
670+ work_done_progress_params: lsp::WorkDoneProgressParams::default(),
655671 };
656672
657673 self.request::<lsp::request::Initialize>(params).await
@@ -700,6 +716,65 @@ impl Client {
700716 })
701717 }
702718
719+ pub fn prepare_file_rename(
720+ &self,
721+ old_uri: &lsp::Url,
722+ new_uri: &lsp::Url,
723+ ) -> Option<impl Future<Output = Result<lsp::WorkspaceEdit>>> {
724+ let capabilities = self.capabilities.get().unwrap();
725+
726+ // Return early if the server does not support willRename feature
727+ match &capabilities.workspace {
728+ Some(workspace) => match &workspace.file_operations {
729+ Some(op) => {
730+ op.will_rename.as_ref()?;
731+ }
732+ _ => return None,
733+ },
734+ _ => return None,
735+ }
736+
737+ let files = vec![lsp::FileRename {
738+ old_uri: old_uri.to_string(),
739+ new_uri: new_uri.to_string(),
740+ }];
741+ let request = self.call_with_timeout::<lsp::request::WillRenameFiles>(
742+ lsp::RenameFilesParams { files },
743+ 5,
744+ );
745+
746+ Some(async move {
747+ let json = request.await?;
748+ let response: Option<lsp::WorkspaceEdit> = serde_json::from_value(json)?;
749+ Ok(response.unwrap_or_default())
750+ })
751+ }
752+
753+ pub fn did_file_rename(
754+ &self,
755+ old_uri: &lsp::Url,
756+ new_uri: &lsp::Url,
757+ ) -> Option<impl Future<Output = std::result::Result<(), Error>>> {
758+ let capabilities = self.capabilities.get().unwrap();
759+
760+ // Return early if the server does not support DidRename feature
761+ match &capabilities.workspace {
762+ Some(workspace) => match &workspace.file_operations {
763+ Some(op) => {
764+ op.did_rename.as_ref()?;
765+ }
766+ _ => return None,
767+ },
768+ _ => return None,
769+ }
770+
771+ let files = vec![lsp::FileRename {
772+ old_uri: old_uri.to_string(),
773+ new_uri: new_uri.to_string(),
774+ }];
775+ Some(self.notify::<lsp::notification::DidRenameFiles>(lsp::RenameFilesParams { files }))
776+ }
777+
703778 // -------------------------------------------------------------------------------------------
704779 // Text document
705780 // -------------------------------------------------------------------------------------------
@@ -895,20 +970,19 @@ impl Client {
895970 ) -> Option<impl Future<Output = Result<()>>> {
896971 let capabilities = self.capabilities.get().unwrap();
897972
898− let include_text = match &capabilities.text_document_sync {
899− Some(lsp::TextDocumentSyncCapability::Options(lsp::TextDocumentSyncOptions {
900− save: Some(options),
973+ let include_text = match &capabilities.text_document_sync.as_ref()? {
974+ lsp::TextDocumentSyncCapability::Options(lsp::TextDocumentSyncOptions {
975+ save: options,
901976 ..
902− })) => match options {
977+ }) => match options.as_ref()? {
903978 lsp::TextDocumentSyncSaveOptions::Supported(true) => false,
904979 lsp::TextDocumentSyncSaveOptions::SaveOptions(lsp_types::SaveOptions {
905980 include_text,
906981 }) => include_text.unwrap_or(false),
907− // Supported(false)
908− _ => return None,
982+ lsp::TextDocumentSyncSaveOptions::Supported(false) => return None,
909983 },
910− // unsupported
911− _ => return None,
984+ // see: https://github.com/microsoft/language-server-protocol/issues/288
985+ lsp::TextDocumentSyncCapability::Kind(..) => false,
912986 };
913987
914988 Some(self.notify::<lsp::notification::DidSaveTextDocument>(
@@ -971,12 +1045,12 @@ impl Client {
9711045 ) -> Option<impl Future<Output = Result<Value>>> {
9721046 let capabilities = self.capabilities.get().unwrap();
9731047
974− // Return early if the server does not support resolving code action.
975− match capabilities.completion_provider {
976− Some(lsp::CompletionOptions {
1048+ // Return early if the server does not support resolving code actions.
1049+ match capabilities.code_action_provider {
1050+ Some(lsp::CodeActionProviderCapability::Options(lsp::CodeActionOptions {
9771051 resolve_provider: Some(true),
9781052 ..
979− }) => (),
1053+ })) => (),
9801054 _ => return None,
9811055 }
9821056
helix-lsp/src/lib.rs+32−28
@@ -445,36 +445,36 @@ pub mod util {
445445 // the tabstop closest to the range simply replaces `head` while anchor remains in place
446446 // the remaining tabstops receive their own single-width cursor
447447 if range.head < range.anchor {
448− let first_tabstop = tabstop_anchor + tabstops[0].1;
448+ let last_idx = tabstops.len() - 1;
449+ let last_tabstop = tabstop_anchor + tabstops[last_idx].0;
449450
450451 // if selection is forward but was moved to the right it is
451452 // contained entirely in the replacement text, just do a point
452453 // selection (fallback below)
453− if range.anchor >= first_tabstop {
454− let range = Range::new(range.anchor, first_tabstop);
454+ if range.anchor > last_tabstop {
455+ let range = Range::new(range.anchor, last_tabstop);
455456 mapped_selection.push(range);
456− let rem_tabstops = tabstops[1..]
457+ let rem_tabstops = tabstops[..last_idx]
457458 .iter()
458− .map(|tabstop| Range::point(tabstop_anchor + tabstop.1));
459+ .map(|tabstop| Range::point(tabstop_anchor + tabstop.0));
459460 mapped_selection.extend(rem_tabstops);
460461 continue;
461462 }
462463 } else {
463− let last_idx = tabstops.len() - 1;
464− let last_tabstop = tabstop_anchor + tabstops[last_idx].1;
464+ let first_tabstop = tabstop_anchor + tabstops[0].0;
465465
466466 // if selection is forward but was moved to the right it is
467467 // contained entirely in the replacement text, just do a point
468468 // selection (fallback below)
469− if range.anchor <= last_tabstop {
469+ if range.anchor < first_tabstop {
470470 // we can't properly compute the the next grapheme
471471 // here because the transaction hasn't been applied yet
472472 // that is not a problem because the range gets grapheme aligned anyway
473473 // tough so just adding one will always cause head to be grapheme
474474 // aligned correctly when applied to the document
475− let range = Range::new(range.anchor, last_tabstop + 1);
475+ let range = Range::new(range.anchor, first_tabstop + 1);
476476 mapped_selection.push(range);
477− let rem_tabstops = tabstops[..last_idx]
477+ let rem_tabstops = tabstops[1..]
478478 .iter()
479479 .map(|tabstop| Range::point(tabstop_anchor + tabstop.0));
480480 mapped_selection.extend(rem_tabstops);
@@ -749,36 +749,40 @@ impl Registry {
749749 }
750750 }
751751
752− pub fn get(
753− &mut self,
754− language_config: &LanguageConfiguration,
755− doc_path: Option<&std::path::PathBuf>,
756− root_dirs: &[PathBuf],
752+ pub fn get<'a>(
753+ &'a mut self,
754+ language_config: &'a LanguageConfiguration,
755+ doc_path: Option<&'a std::path::PathBuf>,
756+ root_dirs: &'a [PathBuf],
757757 enable_snippets: bool,
758− ) -> Result<HashMap<LanguageServerName, Arc<Client>>> {
759− language_config
760− .language_servers
761− .iter()
762− .map(|LanguageServerFeatures { name, .. }| {
758+ ) -> impl Iterator<Item = (LanguageServerName, Result<Arc<Client>>)> + 'a {
759+ language_config.language_servers.iter().map(
760+ move |LanguageServerFeatures { name, .. }| {
763761 if let Some(clients) = self.inner.get(name) {
764762 if let Some((_, client)) = clients.iter().enumerate().find(|(i, client)| {
765763 client.try_add_doc(&language_config.roots, root_dirs, doc_path, *i == 0)
766764 }) {
767− return Ok((name.to_owned(), client.clone()));
765+ return (name.to_owned(), Ok(client.clone()));
768766 }
769767 }
770− let client = self.start_client(
768+ match self.start_client(
771769 name.clone(),
772770 language_config,
773771 doc_path,
774772 root_dirs,
775773 enable_snippets,
776− )?;
777− let clients = self.inner.entry(name.clone()).or_default();
778− clients.push(client.clone());
779− Ok((name.clone(), client))
780− })
781− .collect()
774+ ) {
775+ Ok(client) => {
776+ self.inner
777+ .entry(name.to_owned())
778+ .or_default()
779+ .push(client.clone());
780+ (name.clone(), Ok(client))
781+ }
782+ Err(err) => (name.to_owned(), Err(err)),
783+ }
784+ },
785+ )
782786 }
783787
784788 pub fn iter_clients(&self) -> impl Iterator<Item = &Arc<Client>> {
helix-parsec/Cargo.toml+8−7
@@ -1,13 +1,14 @@
11[package]
22name = "helix-parsec"
3−version = "0.6.0"
4−authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2021"
6−license = "MPL-2.0"
73description = "Parser combinators for Helix"
8−categories = ["editor"]
9−repository = "https://github.com/helix-editor/helix"
10−homepage = "https://helix-editor.com"
114include = ["src/**/*", "README.md"]
5+version.workspace = true
6+authors.workspace = true
7+edition.workspace = true
8+license.workspace = true
9+rust-version.workspace = true
10+categories.workspace = true
11+repository.workspace = true
12+homepage.workspace = true
1213
1314[dependencies]
helix-term/Cargo.toml+30−25
@@ -1,16 +1,16 @@
11[package]
22name = "helix-term"
3−version = "0.6.0"
43description = "A post-modern text editor."
5−authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
6−edition = "2021"
7−license = "MPL-2.0"
8−categories = ["editor", "command-line-utilities"]
9−repository = "https://github.com/helix-editor/helix"
10−homepage = "https://helix-editor.com"
114include = ["src/**/*", "README.md"]
125default-run = "hx"
13−rust-version = "1.65"
6+version.workspace = true
7+authors.workspace = true
8+edition.workspace = true
9+license.workspace = true
10+rust-version.workspace = true
11+categories.workspace = true
12+repository.workspace = true
13+homepage.workspace = true
1414
1515[features]
1616default = ["git"]
@@ -23,21 +23,22 @@ name = "hx"
2323path = "src/main.rs"
2424
2525[dependencies]
26−helix-core = { version = "0.6", path = "../helix-core" }
27−helix-view = { version = "0.6", path = "../helix-view" }
28−helix-lsp = { version = "0.6", path = "../helix-lsp" }
29−helix-dap = { version = "0.6", path = "../helix-dap" }
30−helix-vcs = { version = "0.6", path = "../helix-vcs" }
31−helix-loader = { version = "0.6", path = "../helix-loader" }
26+helix-core = { path = "../helix-core" }
27+helix-event = { path = "../helix-event" }
28+helix-view = { path = "../helix-view" }
29+helix-lsp = { path = "../helix-lsp" }
30+helix-dap = { path = "../helix-dap" }
31+helix-vcs = { path = "../helix-vcs" }
32+helix-loader = { path = "../helix-loader" }
3233
3334anyhow = "1"
34−once_cell = "1.18"
35+once_cell = "1.19"
3536
36−which = "4.4"
37+which = "5.0.0"
3738
3839tokio = { version = "1", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot"] }
3940tui = { path = "../helix-tui", package = "helix-tui", default-features = false, features = ["crossterm"] }
40−crossterm = { version = "0.26", features = ["event-stream"] }
41+crossterm = { version = "0.27", features = ["event-stream"] }
4142signal-hook = "0.3"
4243tokio-stream = "0.1"
4344futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
@@ -49,13 +50,17 @@ chrono = { version = "0.4", default-features = false, features = ["clock"] }
4950log = "0.4"
5051
5152# File picker
52−fuzzy-matcher = "0.3"
53+nucleo.workspace = true
5354ignore = "0.4"
5455# markdown doc rendering
5556pulldown-cmark = { version = "0.9", default-features = false }
5657# file type detection
5758content_inspector = "0.2.4"
5859
60+# opening URLs
61+open = "5.0.1"
62+url = "2.5.0"
63+
5964# config
6065toml = "0.7"
6166
@@ -63,20 +68,20 @@ serde_json = "1.0"
6368serde = { version = "1.0", features = ["derive"] }
6469
6570# ripgrep for global search
66−grep-regex = "0.1.11"
67−grep-searcher = "0.1.11"
71+grep-regex = "0.1.12"
72+grep-searcher = "0.1.13"
6873
6974[target.'cfg(not(windows))'.dependencies] # https://github.com/vorner/signal-hook/issues/100
7075signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
71−libc = "0.2.147"
76+libc = "0.2.151"
7277
7378[target.'cfg(target_os = "macos")'.dependencies]
74−crossterm = { version = "0.26", features = ["event-stream", "use-dev-tty"] }
79+crossterm = { version = "0.27", features = ["event-stream", "use-dev-tty"] }
7580
7681[build-dependencies]
77−helix-loader = { version = "0.6", path = "../helix-loader" }
82+helix-loader = { path = "../helix-loader" }
7883
7984[dev-dependencies]
8085smallvec = "1.11"
81−indoc = "2.0.3"
82−tempfile = "3.7.1"
86+indoc = "2.0.4"
87+tempfile = "3.8.1"
helix-term/src/application.rs+111−75
@@ -1,6 +1,7 @@
11use arc_swap::{access::Map, ArcSwap};
22use futures_util::Stream;
33use helix_core::{
4+ chars::char_is_word,
45 diagnostic::{DiagnosticTag, NumberOrString},
56 path::get_relative_path,
67 pos_at_coords, syntax, Selection,
@@ -160,17 +161,21 @@ impl Application {
160161 let path = helix_loader::runtime_file(Path::new("tutor"));
161162 editor.open(&path, Action::VerticalSplit)?;
162163 // Unset path to prevent accidentally saving to the original tutor file.
163− doc_mut!(editor).set_path(None)?;
164+ doc_mut!(editor).set_path(None);
164165 } else if !args.files.is_empty() {
165− let first = &args.files[0].0; // we know it's not empty
166− if first.is_dir() {
167− helix_loader::set_current_working_dir(first.clone())?;
168− editor.new_file(Action::VerticalSplit);
169− let picker = ui::file_picker(".".into(), &config.load().editor);
166+ let mut files_it = args.files.into_iter().peekable();
167+
168+ // If the first file is a directory, skip it and open a picker
169+ if let Some((first, _)) = files_it.next_if(|(p, _)| p.is_dir()) {
170+ let picker = ui::file_picker(first, &config.load().editor);
170171 compositor.push(Box::new(overlaid(picker)));
171− } else {
172− let nr_of_files = args.files.len();
173− for (i, (file, pos)) in args.files.into_iter().enumerate() {
172+ }
173+
174+ // If there are any more files specified, open them
175+ if files_it.peek().is_some() {
176+ let mut nr_of_files = 0;
177+ for (file, pos) in files_it {
178+ nr_of_files += 1;
174179 if file.is_dir() {
175180 return Err(anyhow::anyhow!(
176181 "expected a path to file, found a directory. (to open a directory pass it as first argument)"
@@ -182,7 +187,7 @@ impl Application {
182187 // option. If neither of those two arguments are passed
183188 // in, just load the files normally.
184189 let action = match args.split {
185− _ if i == 0 => Action::VerticalSplit,
190+ _ if nr_of_files == 1 => Action::VerticalSplit,
186191 Some(Layout::Vertical) => Action::VerticalSplit,
187192 Some(Layout::Horizontal) => Action::HorizontalSplit,
188193 None => Action::Load,
@@ -209,6 +214,8 @@ impl Application {
209214 // does not affect views without pos since it is at the top
210215 let (view, doc) = current!(editor);
211216 align_view(doc, view, Align::Center);
217+ } else {
218+ editor.new_file(Action::VerticalSplit);
212219 }
213220 } else if stdin().is_tty() || cfg!(feature = "integration") {
214221 editor.new_file(Action::VerticalSplit);
@@ -251,22 +258,19 @@ impl Application {
251258 }
252259
253260 async fn render(&mut self) {
261+ if self.compositor.full_redraw {
262+ self.terminal.clear().expect("Cannot clear the terminal");
263+ self.compositor.full_redraw = false;
264+ }
265+
254266 let mut cx = crate::compositor::Context {
255267 editor: &mut self.editor,
256268 jobs: &mut self.jobs,
257269 scroll: None,
258270 };
259271
260− // Acquire mutable access to the redraw_handle lock
261− // to ensure that there are no tasks running that want to block rendering
262− drop(cx.editor.redraw_handle.1.write().await);
272+ helix_event::start_frame();
263273 cx.editor.needs_redraw = false;
264− {
265− // exhaust any leftover redraw notifications
266− let notify = cx.editor.redraw_handle.0.notified();
267− tokio::pin!(notify);
268− notify.enable();
269− }
270274
271275 let area = self
272276 .terminal
@@ -288,7 +292,7 @@ impl Application {
288292
289293 pub async fn event_loop<S>(&mut self, input_stream: &mut S)
290294 where
291− S: Stream<Item = crossterm::Result<crossterm::event::Event>> + Unpin,
295+ S: Stream<Item = std::io::Result<crossterm::event::Event>> + Unpin,
292296 {
293297 self.render().await;
294298
@@ -301,7 +305,7 @@ impl Application {
301305
302306 pub async fn event_loop_until_idle<S>(&mut self, input_stream: &mut S) -> bool
303307 where
304− S: Stream<Item = crossterm::Result<crossterm::event::Event>> + Unpin,
308+ S: Stream<Item = std::io::Result<crossterm::event::Event>> + Unpin,
305309 {
306310 loop {
307311 if self.editor.should_close() {
@@ -554,16 +558,7 @@ impl Application {
554558 let bytes = doc_save_event.text.len_bytes();
555559
556560 if doc.path() != Some(&doc_save_event.path) {
557− if let Err(err) = doc.set_path(Some(&doc_save_event.path)) {
558− log::error!(
559− "error setting path for doc '{:?}': {}",
560− doc.path(),
561− err.to_string(),
562− );
563−
564− self.editor.set_error(err.to_string());
565− return;
566− }
561+ doc.set_path(Some(&doc_save_event.path));
567562
568563 let loader = self.editor.syn_loader.clone();
569564
@@ -599,7 +594,7 @@ impl Application {
599594 EditorEvent::LanguageServerMessage((id, call)) => {
600595 self.handle_language_server_message(call, id).await;
601596 // limit render calls for fast language server messages
602− self.editor.redraw_handle.0.notify_one();
597+ helix_event::request_redraw();
603598 }
604599 EditorEvent::DebuggerEvent(payload) => {
605600 let needs_render = self.editor.handle_debugger_message(payload).await;
@@ -607,6 +602,9 @@ impl Application {
607602 self.render().await;
608603 }
609604 }
605+ EditorEvent::Redraw => {
606+ self.render().await;
607+ }
610608 EditorEvent::IdleTimer => {
611609 self.editor.clear_idle_timer();
612610 self.handle_idle_timeout().await;
@@ -621,10 +619,7 @@ impl Application {
621619 false
622620 }
623621
624− pub async fn handle_terminal_events(
625− &mut self,
626− event: Result<CrosstermEvent, crossterm::ErrorKind>,
627− ) {
622+ pub async fn handle_terminal_events(&mut self, event: std::io::Result<CrosstermEvent>) {
628623 let mut cx = crate::compositor::Context {
629624 editor: &mut self.editor,
630625 jobs: &mut self.jobs,
@@ -723,7 +718,7 @@ impl Application {
723718 ));
724719 }
725720 }
726− Notification::PublishDiagnostics(params) => {
721+ Notification::PublishDiagnostics(mut params) => {
727722 let path = match params.uri.to_file_path() {
728723 Ok(path) => path,
729724 Err(_) => {
@@ -737,31 +732,69 @@ impl Application {
737732 return;
738733 }
739734 let offset_encoding = language_server.offset_encoding();
740− let doc = self.editor.document_by_path_mut(&path).filter(|doc| {
741− if let Some(version) = params.version {
742− if version != doc.version() {
743− log::info!("Version ({version}) is out of date for {path:?} (expected ({}), dropping PublishDiagnostic notification", doc.version());
744− return false;
735+ // have to inline the function because of borrow checking...
736+ let doc = self.editor.documents.values_mut()
737+ .find(|doc| doc.path().map(|p| p == &path).unwrap_or(false))
738+ .filter(|doc| {
739+ if let Some(version) = params.version {
740+ if version != doc.version() {
741+ log::info!("Version ({version}) is out of date for {path:?} (expected ({}), dropping PublishDiagnostic notification", doc.version());
742+ return false;
743+ }
745744 }
746− }
747−
748− true
749− });
745+ true
746+ });
750747
751748 if let Some(doc) = doc {
752− let lang_conf = doc.language_config();
753− let text = doc.text();
749+ let lang_conf = doc.language.clone();
750+ let text = doc.text().clone();
751+
752+ let mut unchaged_diag_sources_ = Vec::new();
753+ if let Some(lang_conf) = &lang_conf {
754+ if let Some(old_diagnostics) =
755+ self.editor.diagnostics.get(&params.uri)
756+ {
757+ if !lang_conf.persistent_diagnostic_sources.is_empty() {
758+ // Sort diagnostics first by severity and then by line numbers.
759+ // Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
760+ params
761+ .diagnostics
762+ .sort_unstable_by_key(|d| (d.severity, d.range.start));
763+ }
764+ for source in &lang_conf.persistent_diagnostic_sources {
765+ let new_diagnostics = params
766+ .diagnostics
767+ .iter()
768+ .filter(|d| d.source.as_ref() == Some(source));
769+ let old_diagnostics = old_diagnostics
770+ .iter()
771+ .filter(|(d, d_server)| {
772+ *d_server == server_id
773+ && d.source.as_ref() == Some(source)
774+ })
775+ .map(|(d, _)| d);
776+ if new_diagnostics.eq(old_diagnostics) {
777+ unchaged_diag_sources_.push(source.clone())
778+ }
779+ }
780+ }
781+ }
754782
755− let diagnostics = params
756− .diagnostics
757− .iter()
758− .filter_map(|diagnostic| {
783+ let unchaged_diag_sources = &unchaged_diag_sources_;
784+ let diagnostics =
785+ params.diagnostics.iter().filter_map(move |diagnostic| {
759786 use helix_core::diagnostic::{Diagnostic, Range, Severity::*};
760787 use lsp::DiagnosticSeverity;
761788
789+ if diagnostic.source.as_ref().map_or(false, |source| {
790+ unchaged_diag_sources.contains(source)
791+ }) {
792+ return None;
793+ }
794+
762795 // TODO: convert inside server
763796 let start = if let Some(start) = lsp_pos_to_pos(
764− text,
797+ &text,
765798 diagnostic.range.start,
766799 offset_encoding,
767800 ) {
@@ -772,14 +805,13 @@ impl Application {
772805 };
773806
774807 let end = if let Some(end) =
775− lsp_pos_to_pos(text, diagnostic.range.end, offset_encoding)
808+ lsp_pos_to_pos(&text, diagnostic.range.end, offset_encoding)
776809 {
777810 end
778811 } else {
779812 log::warn!("lsp position out of bounds - {:?}", diagnostic);
780813 return None;
781814 };
782−
783815 let severity =
784816 diagnostic.severity.map(|severity| match severity {
785817 DiagnosticSeverity::ERROR => Error,
@@ -792,7 +824,7 @@ impl Application {
792824 ),
793825 });
794826
795− if let Some(lang_conf) = lang_conf {
827+ if let Some(lang_conf) = &lang_conf {
796828 if let Some(severity) = severity {
797829 if severity < lang_conf.diagnostic_severity {
798830 return None;
@@ -831,8 +863,17 @@ impl Application {
831863 Vec::new()
832864 };
833865
866+ let ends_at_word = start != end
867+ && end != 0
868+ && text.get_char(end - 1).map_or(false, char_is_word);
869+ let starts_at_word = start != end
870+ && text.get_char(start).map_or(false, char_is_word);
871+
834872 Some(Diagnostic {
835873 range: Range { start, end },
874+ ends_at_word,
875+ starts_at_word,
876+ zero_width: start == end,
836877 line: diagnostic.range.start.line as usize,
837878 message: diagnostic.message.clone(),
838879 severity,
@@ -842,38 +883,33 @@ impl Application {
842883 data: diagnostic.data.clone(),
843884 language_server_id: server_id,
844885 })
845− })
846− .collect();
886+ });
847887
848− doc.replace_diagnostics(diagnostics, server_id);
888+ doc.replace_diagnostics(diagnostics, unchaged_diag_sources, server_id);
849889 }
850890
851− let mut diagnostics = params
852− .diagnostics
853− .into_iter()
854− .map(|d| (d, server_id))
855− .collect();
891+ let diagnostics = params.diagnostics.into_iter().map(|d| (d, server_id));
856892
857893 // Insert the original lsp::Diagnostics here because we may have no open document
858894 // for diagnosic message and so we can't calculate the exact position.
859895 // When using them later in the diagnostics picker, we calculate them on-demand.
860− match self.editor.diagnostics.entry(params.uri) {
896+ let diagnostics = match self.editor.diagnostics.entry(params.uri) {
861897 Entry::Occupied(o) => {
862898 let current_diagnostics = o.into_mut();
863899 // there may entries of other language servers, which is why we can't overwrite the whole entry
864900 current_diagnostics.retain(|(_, lsp_id)| *lsp_id != server_id);
865− current_diagnostics.append(&mut diagnostics);
866− // Sort diagnostics first by severity and then by line numbers.
867− // Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
901+ current_diagnostics.extend(diagnostics);
868902 current_diagnostics
869− .sort_unstable_by_key(|(d, _)| (d.severity, d.range.start));
870− }
871− Entry::Vacant(v) => {
872− diagnostics
873− .sort_unstable_by_key(|(d, _)| (d.severity, d.range.start));
874− v.insert(diagnostics);
903+ // Sort diagnostics first by severity and then by line numbers.
875904 }
905+ Entry::Vacant(v) => v.insert(diagnostics.collect()),
876906 };
907+
908+ // Sort diagnostics first by severity and then by line numbers.
909+ // Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
910+ diagnostics.sort_unstable_by_key(|(d, server_id)| {
911+ (d.severity, d.range.start, *server_id)
912+ });
877913 }
878914 Notification::ShowMessage(params) => {
879915 log::warn!("unhandled window/showMessage: {:?}", params);
@@ -1165,7 +1201,7 @@ impl Application {
11651201
11661202 pub async fn run<S>(&mut self, input_stream: &mut S) -> Result<i32, Error>
11671203 where
1168− S: Stream<Item = crossterm::Result<crossterm::event::Event>> + Unpin,
1204+ S: Stream<Item = std::io::Result<crossterm::event::Event>> + Unpin,
11691205 {
11701206 self.claim_term().await?;
11711207
helix-term/src/args.rs+29
@@ -17,12 +17,14 @@ pub struct Args {
1717 pub log_file: Option<PathBuf>,
1818 pub config_file: Option<PathBuf>,
1919 pub files: Vec<(PathBuf, Position)>,
20+ pub working_directory: Option<PathBuf>,
2021}
2122
2223impl Args {
2324 pub fn parse_args() -> Result<Args> {
2425 let mut args = Args::default();
2526 let mut argv = std::env::args().peekable();
27+ let mut line_number = 0;
2628
2729 argv.next(); // skip the program, we don't care about that
2830
@@ -59,6 +61,20 @@ impl Args {
5961 Some(path) => args.log_file = Some(path.into()),
6062 None => anyhow::bail!("--log must specify a path to write"),
6163 },
64+ "-w" | "--working-dir" => match argv.next().as_deref() {
65+ Some(path) => {
66+ args.working_directory = if Path::new(path).is_dir() {
67+ Some(PathBuf::from(path))
68+ } else {
69+ anyhow::bail!(
70+ "--working-dir specified does not exist or is not a directory"
71+ )
72+ }
73+ }
74+ None => {
75+ anyhow::bail!("--working-dir must specify an initial working directory")
76+ }
77+ },
6278 arg if arg.starts_with("--") => {
6379 anyhow::bail!("unexpected double dash argument: {}", arg)
6480 }
@@ -73,6 +89,13 @@ impl Args {
7389 }
7490 }
7591 }
92+ arg if arg.starts_with('+') => {
93+ let arg = &arg[1..];
94+ line_number = match arg.parse::<usize>() {
95+ Ok(n) => n.saturating_sub(1),
96+ _ => anyhow::bail!("bad line number after +"),
97+ };
98+ }
7699 arg => args.files.push(parse_file(arg)),
77100 }
78101 }
@@ -82,6 +105,12 @@ impl Args {
82105 args.files.push(parse_file(&arg));
83106 }
84107
108+ if let Some(file) = args.files.first_mut() {
109+ if line_number != 0 {
110+ file.1.row = line_number;
111+ }
112+ }
113+
85114 Ok(args)
86115 }
87116}
helix-term/src/commands.rs+334−149
@@ -43,7 +43,6 @@ use helix_view::{
4343};
4444
4545use anyhow::{anyhow, bail, ensure, Context as _};
46−use fuzzy_matcher::FuzzyMatcher;
4746use insert::*;
4847use movement::Movement;
4948
@@ -60,9 +59,14 @@ use crate::{
6059};
6160
6261use crate::job::{self, Jobs};
63−use futures_util::{stream::FuturesUnordered, StreamExt, TryStreamExt};
64−use std::{collections::HashMap, fmt, future::Future};
65−use std::{collections::HashSet, num::NonZeroUsize};
62+use futures_util::{stream::FuturesUnordered, TryStreamExt};
63+use std::{
64+ collections::{HashMap, HashSet},
65+ fmt,
66+ future::Future,
67+ io::Read,
68+ num::NonZeroUsize,
69+};
6670
6771use std::{
6872 borrow::Cow,
@@ -71,11 +75,11 @@ use std::{
7175
7276use once_cell::sync::Lazy;
7377use serde::de::{self, Deserialize, Deserializer};
78+use url::Url;
7479
7580use grep_regex::RegexMatcherBuilder;
7681use grep_searcher::{sinks, BinaryDetection, SearcherBuilder};
7782use ignore::{DirEntry, WalkBuilder, WalkState};
78−use tokio_stream::wrappers::UnboundedReceiverStream;
7983
8084pub type OnKeyCallback = Box<dyn FnOnce(&mut Context, KeyEvent)>;
8185
@@ -333,7 +337,7 @@ impl MappableCommand {
333337 goto_implementation, "Goto implementation",
334338 goto_file_start, "Goto line number <n> else file start",
335339 goto_file_end, "Goto file end",
336− goto_file, "Goto files in selection",
340+ goto_file, "Goto files/URLs in selection",
337341 goto_file_hsplit, "Goto files in selection (hsplit)",
338342 goto_file_vsplit, "Goto files in selection (vsplit)",
339343 goto_reference, "Goto references",
@@ -986,6 +990,7 @@ fn align_selections(cx: &mut Context) {
986990
987991 let transaction = Transaction::change(doc.text(), changes.into_iter());
988992 doc.apply(&transaction, view.id);
993+ exit_select_mode(cx);
989994}
990995
991996fn goto_window(cx: &mut Context, align: Align) {
@@ -1160,6 +1165,10 @@ fn goto_file_impl(cx: &mut Context, action: Action) {
11601165 let (view, doc) = current_ref!(cx.editor);
11611166 let text = doc.text();
11621167 let selections = doc.selection(view.id);
1168+ let rel_path = doc
1169+ .relative_path()
1170+ .map(|path| path.parent().unwrap().to_path_buf())
1171+ .unwrap_or_default();
11631172 let mut paths: Vec<_> = selections
11641173 .iter()
11651174 .map(|r| text.slice(r.from()..r.to()).to_string())
@@ -1187,16 +1196,80 @@ fn goto_file_impl(cx: &mut Context, action: Action) {
11871196 .to_string(),
11881197 );
11891198 }
1199+
11901200 for sel in paths {
11911201 let p = sel.trim();
1192− if !p.is_empty() {
1193− if let Err(e) = cx.editor.open(&PathBuf::from(p), action) {
1202+ if p.is_empty() {
1203+ continue;
1204+ }
1205+
1206+ if let Ok(url) = Url::parse(p) {
1207+ return open_url(cx, url, action);
1208+ }
1209+
1210+ let path = &rel_path.join(p);
1211+ if path.is_dir() {
1212+ let picker = ui::file_picker(path.into(), &cx.editor.config());
1213+ cx.push_layer(Box::new(overlaid(picker)));
1214+ } else if let Err(e) = cx.editor.open(path, action) {
1215+ cx.editor.set_error(format!("Open file failed: {:?}", e));
1216+ }
1217+ }
1218+}
1219+
1220+/// Opens the given url. If the URL points to a valid textual file it is open in helix.
1221+// Otherwise, the file is open using external program.
1222+fn open_url(cx: &mut Context, url: Url, action: Action) {
1223+ let doc = doc!(cx.editor);
1224+ let rel_path = doc
1225+ .relative_path()
1226+ .map(|path| path.parent().unwrap().to_path_buf())
1227+ .unwrap_or_default();
1228+
1229+ if url.scheme() != "file" {
1230+ return open_external_url(cx, url);
1231+ }
1232+
1233+ let content_type = std::fs::File::open(url.path()).and_then(|file| {
1234+ // Read up to 1kb to detect the content type
1235+ let mut read_buffer = Vec::new();
1236+ let n = file.take(1024).read_to_end(&mut read_buffer)?;
1237+ Ok(content_inspector::inspect(&read_buffer[..n]))
1238+ });
1239+
1240+ // we attempt to open binary files - files that can't be open in helix - using external
1241+ // program as well, e.g. pdf files or images
1242+ match content_type {
1243+ Ok(content_inspector::ContentType::BINARY) => open_external_url(cx, url),
1244+ Ok(_) | Err(_) => {
1245+ let path = &rel_path.join(url.path());
1246+ if path.is_dir() {
1247+ let picker = ui::file_picker(path.into(), &cx.editor.config());
1248+ cx.push_layer(Box::new(overlaid(picker)));
1249+ } else if let Err(e) = cx.editor.open(path, action) {
11941250 cx.editor.set_error(format!("Open file failed: {:?}", e));
11951251 }
11961252 }
11971253 }
11981254}
11991255
1256+/// Opens URL in external program.
1257+fn open_external_url(cx: &mut Context, url: Url) {
1258+ let commands = open::commands(url.as_str());
1259+ cx.jobs.callback(async {
1260+ for cmd in commands {
1261+ let mut command = tokio::process::Command::new(cmd.get_program());
1262+ command.args(cmd.get_args());
1263+ if command.output().await.is_ok() {
1264+ return Ok(job::Callback::Editor(Box::new(|_| {})));
1265+ }
1266+ }
1267+ Ok(job::Callback::Editor(Box::new(move |editor| {
1268+ editor.set_error("Opening URL in external program failed")
1269+ })))
1270+ });
1271+}
1272+
12001273fn extend_word_impl<F>(cx: &mut Context, extend_fn: F)
12011274where
12021275 F: Fn(RopeSlice, Range, usize) -> Range,
@@ -1245,6 +1318,65 @@ fn extend_next_long_word_end(cx: &mut Context) {
12451318 extend_word_impl(cx, movement::move_next_long_word_end)
12461319}
12471320
1321+/// Separate branch to find_char designed only for `<ret>` char.
1322+//
1323+// This is necessary because the one document can have different line endings inside. And we
1324+// cannot predict what character to find when <ret> is pressed. On the current line it can be `lf`
1325+// but on the next line it can be `crlf`. That's why [`find_char_impl`] cannot be applied here.
1326+fn find_char_line_ending(
1327+ cx: &mut Context,
1328+ count: usize,
1329+ direction: Direction,
1330+ inclusive: bool,
1331+ extend: bool,
1332+) {
1333+ let (view, doc) = current!(cx.editor);
1334+ let text = doc.text().slice(..);
1335+
1336+ let selection = doc.selection(view.id).clone().transform(|range| {
1337+ let cursor = range.cursor(text);
1338+ let cursor_line = range.cursor_line(text);
1339+
1340+ // Finding the line where we're going to find <ret>. Depends mostly on
1341+ // `count`, but also takes into account edge cases where we're already at the end
1342+ // of a line or the beginning of a line
1343+ let find_on_line = match direction {
1344+ Direction::Forward => {
1345+ let on_edge = line_end_char_index(&text, cursor_line) == cursor;
1346+ let line = cursor_line + count - 1 + (on_edge as usize);
1347+ if line >= text.len_lines() - 1 {
1348+ return range;
1349+ } else {
1350+ line
1351+ }
1352+ }
1353+ Direction::Backward => {
1354+ let on_edge = text.line_to_char(cursor_line) == cursor && !inclusive;
1355+ let line = cursor_line as isize - (count as isize - 1 + on_edge as isize);
1356+ if line <= 0 {
1357+ return range;
1358+ } else {
1359+ line as usize
1360+ }
1361+ }
1362+ };
1363+
1364+ let pos = match (direction, inclusive) {
1365+ (Direction::Forward, true) => line_end_char_index(&text, find_on_line),
1366+ (Direction::Forward, false) => line_end_char_index(&text, find_on_line) - 1,
1367+ (Direction::Backward, true) => line_end_char_index(&text, find_on_line - 1),
1368+ (Direction::Backward, false) => text.line_to_char(find_on_line),
1369+ };
1370+
1371+ if extend {
1372+ range.put_cursor(text, pos, true)
1373+ } else {
1374+ Range::point(range.cursor(text)).put_cursor(text, pos, true)
1375+ }
1376+ });
1377+ doc.set_selection(view.id, selection);
1378+}
1379+
12481380fn find_char(cx: &mut Context, direction: Direction, inclusive: bool, extend: bool) {
12491381 // TODO: count is reset to 1 before next key so we move it into the closure here.
12501382 // Would be nice to carry over.
@@ -1258,13 +1390,9 @@ fn find_char(cx: &mut Context, direction: Direction, inclusive: bool, extend: bo
12581390 KeyEvent {
12591391 code: KeyCode::Enter,
12601392 ..
1261− } =>
1262− // TODO: this isn't quite correct when CRLF is involved.
1263− // This hack will work in most cases, since documents don't
1264− // usually mix line endings. But we should fix it eventually
1265− // anyway.
1266− {
1267− doc!(cx.editor).line_ending.as_str().chars().next().unwrap()
1393+ } => {
1394+ find_char_line_ending(cx, count, direction, inclusive, extend);
1395+ return;
12681396 }
12691397
12701398 KeyEvent {
@@ -1466,6 +1594,7 @@ where
14661594 });
14671595
14681596 doc.apply(&transaction, view.id);
1597+ exit_select_mode(cx);
14691598}
14701599
14711600fn switch_case(cx: &mut Context) {
@@ -1707,8 +1836,8 @@ fn select_regex(cx: &mut Context) {
17071836 "select:".into(),
17081837 Some(reg),
17091838 ui::completers::none,
1710− move |editor, regex, event| {
1711− let (view, doc) = current!(editor);
1839+ move |cx, regex, event| {
1840+ let (view, doc) = current!(cx.editor);
17121841 if !matches!(event, PromptEvent::Update | PromptEvent::Validate) {
17131842 return;
17141843 }
@@ -1729,8 +1858,8 @@ fn split_selection(cx: &mut Context) {
17291858 "split:".into(),
17301859 Some(reg),
17311860 ui::completers::none,
1732− move |editor, regex, event| {
1733− let (view, doc) = current!(editor);
1861+ move |cx, regex, event| {
1862+ let (view, doc) = current!(cx.editor);
17341863 if !matches!(event, PromptEvent::Update | PromptEvent::Validate) {
17351864 return;
17361865 }
@@ -1894,12 +2023,14 @@ fn searcher(cx: &mut Context, direction: Direction) {
18942023 .map(|comp| (0.., std::borrow::Cow::Owned(comp.clone())))
18952024 .collect()
18962025 },
1897− move |editor, regex, event| {
1898− if !matches!(event, PromptEvent::Update | PromptEvent::Validate) {
2026+ move |cx, regex, event| {
2027+ if event == PromptEvent::Validate {
2028+ cx.editor.registers.last_search_register = reg;
2029+ } else if event != PromptEvent::Update {
18992030 return;
19002031 }
19012032 search_impl(
1902− editor,
2033+ cx.editor,
19032034 &contents,
19042035 &regex,
19052036 Movement::Move,
@@ -1914,7 +2045,9 @@ fn searcher(cx: &mut Context, direction: Direction) {
19142045
19152046fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Direction) {
19162047 let count = cx.count();
1917− let register = cx.register.unwrap_or('/');
2048+ let register = cx
2049+ .register
2050+ .unwrap_or(cx.editor.registers.last_search_register);
19182051 let config = cx.editor.config();
19192052 let scrolloff = config.scrolloff;
19202053 if let Some(query) = cx.editor.registers.first(register, cx.editor) {
@@ -1982,13 +2115,21 @@ fn search_selection(cx: &mut Context) {
19822115
19832116 let msg = format!("register '{}' set to '{}'", register, &regex);
19842117 match cx.editor.registers.push(register, regex) {
1985− Ok(_) => cx.editor.set_status(msg),
2118+ Ok(_) => {
2119+ cx.editor.registers.last_search_register = register;
2120+ cx.editor.set_status(msg)
2121+ }
19862122 Err(err) => cx.editor.set_error(err.to_string()),
19872123 }
19882124}
19892125
19902126fn make_search_word_bounded(cx: &mut Context) {
1991− let register = cx.register.unwrap_or('/');
2127+ // Defaults to the active search register instead `/` to be more ergonomic assuming most people
2128+ // would use this command following `search_selection`. This avoids selecting the register
2129+ // twice.
2130+ let register = cx
2131+ .register
2132+ .unwrap_or(cx.editor.registers.last_search_register);
19922133 let regex = match cx.editor.registers.first(register, cx.editor) {
19932134 Some(regex) => regex,
19942135 None => return,
@@ -2014,7 +2155,10 @@ fn make_search_word_bounded(cx: &mut Context) {
20142155
20152156 let msg = format!("register '{}' set to '{}'", register, &new_regex);
20162157 match cx.editor.registers.push(register, new_regex) {
2017− Ok(_) => cx.editor.set_status(msg),
2158+ Ok(_) => {
2159+ cx.editor.registers.last_search_register = register;
2160+ cx.editor.set_status(msg)
2161+ }
20182162 Err(err) => cx.editor.set_error(err.to_string()),
20192163 }
20202164}
@@ -2055,13 +2199,11 @@ fn global_search(cx: &mut Context) {
20552199 }
20562200 }
20572201
2058− let (all_matches_sx, all_matches_rx) = tokio::sync::mpsc::unbounded_channel::<FileResult>();
20592202 let config = cx.editor.config();
20602203 let smart_case = config.search.smart_case;
20612204 let file_picker_config = config.file_picker.clone();
20622205
20632206 let reg = cx.register.unwrap_or('/');
2064−
20652207 let completions = search_completions(cx, Some(reg));
20662208 ui::regex_prompt(
20672209 cx,
@@ -2074,52 +2216,66 @@ fn global_search(cx: &mut Context) {
20742216 .map(|comp| (0.., std::borrow::Cow::Owned(comp.clone())))
20752217 .collect()
20762218 },
2077− move |editor, regex, event| {
2219+ move |cx, regex, event| {
20782220 if event != PromptEvent::Validate {
20792221 return;
20802222 }
2223+ cx.editor.registers.last_search_register = reg;
20812224
2082− let documents: Vec<_> = editor
2225+ let current_path = doc_mut!(cx.editor).path().cloned();
2226+ let documents: Vec<_> = cx
2227+ .editor
20832228 .documents()
2084− .map(|doc| (doc.path(), doc.text()))
2229+ .map(|doc| (doc.path().cloned(), doc.text().to_owned()))
20852230 .collect();
20862231
20872232 if let Ok(matcher) = RegexMatcherBuilder::new()
20882233 .case_smart(smart_case)
20892234 .build(regex.as_str())
20902235 {
2091− let searcher = SearcherBuilder::new()
2092− .binary_detection(BinaryDetection::quit(b'\x00'))
2093− .build();
2094−
20952236 let search_root = helix_loader::current_working_dir();
20962237 if !search_root.exists() {
2097− editor.set_error("Current working directory does not exist");
2238+ cx.editor
2239+ .set_error("Current working directory does not exist");
20982240 return;
20992241 }
21002242
2243+ let (picker, injector) = Picker::stream(current_path);
2244+
21012245 let dedup_symlinks = file_picker_config.deduplicate_links;
21022246 let absolute_root = search_root
21032247 .canonicalize()
21042248 .unwrap_or_else(|_| search_root.clone());
2105−
2106− WalkBuilder::new(search_root)
2107− .hidden(file_picker_config.hidden)
2108− .parents(file_picker_config.parents)
2109− .ignore(file_picker_config.ignore)
2110− .follow_links(file_picker_config.follow_symlinks)
2111− .git_ignore(file_picker_config.git_ignore)
2112− .git_global(file_picker_config.git_global)
2113− .git_exclude(file_picker_config.git_exclude)
2114− .max_depth(file_picker_config.max_depth)
2115− .filter_entry(move |entry| {
2116− filter_picker_entry(entry, &absolute_root, dedup_symlinks)
2117− })
2118− .build_parallel()
2119− .run(|| {
2249+ let injector_ = injector.clone();
2250+
2251+ std::thread::spawn(move || {
2252+ let searcher = SearcherBuilder::new()
2253+ .binary_detection(BinaryDetection::quit(b'\x00'))
2254+ .build();
2255+
2256+ let mut walk_builder = WalkBuilder::new(search_root);
2257+
2258+ walk_builder
2259+ .hidden(file_picker_config.hidden)
2260+ .parents(file_picker_config.parents)
2261+ .ignore(file_picker_config.ignore)
2262+ .follow_links(file_picker_config.follow_symlinks)
2263+ .git_ignore(file_picker_config.git_ignore)
2264+ .git_global(file_picker_config.git_global)
2265+ .git_exclude(file_picker_config.git_exclude)
2266+ .max_depth(file_picker_config.max_depth)
2267+ .filter_entry(move |entry| {
2268+ filter_picker_entry(entry, &absolute_root, dedup_symlinks)
2269+ });
2270+
2271+ walk_builder
2272+ .add_custom_ignore_filename(helix_loader::config_dir().join("ignore"));
2273+ walk_builder.add_custom_ignore_filename(".helix/ignore");
2274+
2275+ walk_builder.build_parallel().run(|| {
21202276 let mut searcher = searcher.clone();
21212277 let matcher = matcher.clone();
2122− let all_matches_sx = all_matches_sx.clone();
2278+ let injector = injector_.clone();
21232279 let documents = &documents;
21242280 Box::new(move |entry: Result<DirEntry, ignore::Error>| -> WalkState {
21252281 let entry = match entry {
@@ -2133,21 +2289,24 @@ fn global_search(cx: &mut Context) {
21332289 _ => return WalkState::Continue,
21342290 };
21352291
2292+ let mut stop = false;
21362293 let sink = sinks::UTF8(|line_num, _| {
2137− all_matches_sx
2138− .send(FileResult::new(entry.path(), line_num as usize - 1))
2139− .unwrap();
2294+ stop = injector
2295+ .push(FileResult::new(entry.path(), line_num as usize - 1))
2296+ .is_err();
21402297
2141− Ok(true)
2298+ Ok(!stop)
21422299 });
21432300 let doc = documents.iter().find(|&(doc_path, _)| {
2144− doc_path.map_or(false, |doc_path| doc_path == entry.path())
2301+ doc_path
2302+ .as_ref()
2303+ .map_or(false, |doc_path| doc_path == entry.path())
21452304 });
21462305
21472306 let result = if let Some((_, doc)) = doc {
21482307 // there is already a buffer for this file
21492308 // search the buffer instead of the file because it's faster
2150− // and captures new edits without requireing a save
2309+ // and captures new edits without requiring a save
21512310 if searcher.multi_line_with_matcher(&matcher) {
21522311 // in this case a continous buffer is required
21532312 // convert the rope to a string
@@ -2171,68 +2330,66 @@ fn global_search(cx: &mut Context) {
21712330 err
21722331 );
21732332 }
2174− WalkState::Continue
2333+ if stop {
2334+ WalkState::Quit
2335+ } else {
2336+ WalkState::Continue
2337+ }
21752338 })
21762339 });
2340+ });
2341+
2342+ cx.jobs.callback(async move {
2343+ let call = move |_: &mut Editor, compositor: &mut Compositor| {
2344+ let picker = Picker::with_stream(
2345+ picker,
2346+ injector,
2347+ move |cx, FileResult { path, line_num }, action| {
2348+ let doc = match cx.editor.open(path, action) {
2349+ Ok(id) => doc_mut!(cx.editor, &id),
2350+ Err(e) => {
2351+ cx.editor.set_error(format!(
2352+ "Failed to open file '{}': {}",
2353+ path.display(),
2354+ e
2355+ ));
2356+ return;
2357+ }
2358+ };
2359+
2360+ let line_num = *line_num;
2361+ let view = view_mut!(cx.editor);
2362+ let text = doc.text();
2363+ if line_num >= text.len_lines() {
2364+ cx.editor.set_error(
2365+ "The line you jumped to does not exist anymore because the file has changed.",
2366+ );
2367+ return;
2368+ }
2369+ let start = text.line_to_char(line_num);
2370+ let end = text.line_to_char((line_num + 1).min(text.len_lines()));
2371+
2372+ doc.set_selection(view.id, Selection::single(start, end));
2373+ if action.align_view(view, doc.id()) {
2374+ align_view(doc, view, Align::Center);
2375+ }
2376+ },
2377+ )
2378+ .with_preview(
2379+ |_editor, FileResult { path, line_num }| {
2380+ Some((path.clone().into(), Some((*line_num, *line_num))))
2381+ },
2382+ );
2383+ compositor.push(Box::new(overlaid(picker)))
2384+ };
2385+ Ok(Callback::EditorCompositor(Box::new(call)))
2386+ })
21772387 } else {
21782388 // Otherwise do nothing
21792389 // log::warn!("Global Search Invalid Pattern")
21802390 }
21812391 },
21822392 );
2183−
2184− let current_path = doc_mut!(cx.editor).path().cloned();
2185−
2186− let show_picker = async move {
2187− let all_matches: Vec<FileResult> =
2188− UnboundedReceiverStream::new(all_matches_rx).collect().await;
2189− let call: job::Callback = Callback::EditorCompositor(Box::new(
2190− move |editor: &mut Editor, compositor: &mut Compositor| {
2191− if all_matches.is_empty() {
2192− if !editor.is_err() {
2193− editor.set_status("No matches found");
2194− }
2195− return;
2196− }
2197−
2198− let picker = Picker::new(
2199− all_matches,
2200− current_path,
2201− move |cx, FileResult { path, line_num }, action| {
2202− let doc = match cx.editor.open(path, action) {
2203− Ok(id) => doc_mut!(cx.editor, &id),
2204− Err(e) => {
2205− cx.editor.set_error(format!(
2206− "Failed to open file '{}': {}",
2207− path.display(),
2208− e
2209− ));
2210− return;
2211− }
2212− };
2213− let line_num = *line_num;
2214− let view = view_mut!(cx.editor);
2215− let text = doc.text();
2216− if line_num >= text.len_lines() {
2217− cx.editor.set_error("The line you jumped to does not exist anymore because the file has changed.");
2218− return;
2219− }
2220− let start = text.line_to_char(line_num);
2221− let end = text.line_to_char((line_num + 1).min(text.len_lines()));
2222−
2223− doc.set_selection(view.id, Selection::single(start, end));
2224− if action.align_view(view, doc.id()){
2225− align_view(doc, view, Align::Center);
2226− }
2227− }).with_preview(|_editor, FileResult { path, line_num }| {
2228− Some((path.clone().into(), Some((*line_num, *line_num))))
2229− });
2230− compositor.push(Box::new(overlaid(picker)));
2231− },
2232− ));
2233− Ok(call)
2234− };
2235− cx.jobs.callback(show_picker);
22362393}
22372394
22382395enum Extend {
@@ -2587,6 +2744,7 @@ fn file_picker_in_current_buffer_directory(cx: &mut Context) {
25872744 let picker = ui::file_picker(path, &cx.editor.config());
25882745 cx.push_layer(Box::new(overlaid(picker)));
25892746}
2747+
25902748fn file_picker_in_current_directory(cx: &mut Context) {
25912749 let cwd = helix_loader::current_working_dir();
25922750 if !cwd.exists() {
@@ -2895,6 +3053,7 @@ fn insert_with_indent(cx: &mut Context, cursor_fallback: IndentFallbackPos) {
28953053 let indent = indent::indent_for_newline(
28963054 language_config,
28973055 syntax,
3056+ &doc.config.load().indent_heuristic,
28983057 &doc.indent_style,
28993058 tab_width,
29003059 text,
@@ -2999,6 +3158,7 @@ fn open(cx: &mut Context, open: Open) {
29993158 Open::Below => graphemes::prev_grapheme_boundary(text, range.to()),
30003159 Open::Above => range.from(),
30013160 });
3161+
30023162 let new_line = match open {
30033163 // adjust position to the end of the line (next line - 1)
30043164 Open::Below => cursor_line + 1,
@@ -3006,13 +3166,15 @@ fn open(cx: &mut Context, open: Open) {
30063166 Open::Above => cursor_line,
30073167 };
30083168
3169+ let line_num = new_line.saturating_sub(1);
3170+
30093171 // Index to insert newlines after, as well as the char width
30103172 // to use to compensate for those inserted newlines.
30113173 let (line_end_index, line_end_offset_width) = if new_line == 0 {
30123174 (0, 0)
30133175 } else {
30143176 (
3015− line_end_char_index(&doc.text().slice(..), new_line.saturating_sub(1)),
3177+ line_end_char_index(&text, line_num),
30163178 doc.line_ending.len_chars(),
30173179 )
30183180 };
@@ -3020,13 +3182,15 @@ fn open(cx: &mut Context, open: Open) {
30203182 let indent = indent::indent_for_newline(
30213183 doc.language_config(),
30223184 doc.syntax(),
3185+ &doc.config.load().indent_heuristic,
30233186 &doc.indent_style,
30243187 doc.tab_width(),
30253188 text,
3026− new_line.saturating_sub(1),
3189+ line_num,
30273190 line_end_index,
30283191 cursor_line,
30293192 );
3193+
30303194 let indent_len = indent.len();
30313195 let mut text = String::with_capacity(1 + indent_len);
30323196 text.push_str(doc.line_ending.as_str());
@@ -3558,6 +3722,7 @@ pub mod insert {
35583722 let indent = indent::indent_for_newline(
35593723 doc.language_config(),
35603724 doc.syntax(),
3725+ &doc.config.load().indent_heuristic,
35613726 &doc.indent_style,
35623727 doc.tab_width(),
35633728 text,
@@ -3803,12 +3968,12 @@ fn yank(cx: &mut Context) {
38033968}
38043969
38053970fn yank_to_clipboard(cx: &mut Context) {
3806− yank_impl(cx.editor, '*');
3971+ yank_impl(cx.editor, '+');
38073972 exit_select_mode(cx);
38083973}
38093974
38103975fn yank_to_primary_clipboard(cx: &mut Context) {
3811− yank_impl(cx.editor, '+');
3976+ yank_impl(cx.editor, '*');
38123977 exit_select_mode(cx);
38133978}
38143979
@@ -3865,13 +4030,13 @@ fn yank_joined(cx: &mut Context) {
38654030
38664031fn yank_joined_to_clipboard(cx: &mut Context) {
38674032 let line_ending = doc!(cx.editor).line_ending;
3868− yank_joined_impl(cx.editor, line_ending.as_str(), '*');
4033+ yank_joined_impl(cx.editor, line_ending.as_str(), '+');
38694034 exit_select_mode(cx);
38704035}
38714036
38724037fn yank_joined_to_primary_clipboard(cx: &mut Context) {
38734038 let line_ending = doc!(cx.editor).line_ending;
3874− yank_joined_impl(cx.editor, line_ending.as_str(), '+');
4039+ yank_joined_impl(cx.editor, line_ending.as_str(), '*');
38754040 exit_select_mode(cx);
38764041}
38774042
@@ -3888,12 +4053,12 @@ fn yank_primary_selection_impl(editor: &mut Editor, register: char) {
38884053}
38894054
38904055fn yank_main_selection_to_clipboard(cx: &mut Context) {
3891− yank_primary_selection_impl(cx.editor, '*');
4056+ yank_primary_selection_impl(cx.editor, '+');
38924057 exit_select_mode(cx);
38934058}
38944059
38954060fn yank_main_selection_to_primary_clipboard(cx: &mut Context) {
3896− yank_primary_selection_impl(cx.editor, '+');
4061+ yank_primary_selection_impl(cx.editor, '*');
38974062 exit_select_mode(cx);
38984063}
38994064
@@ -3991,22 +4156,27 @@ pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) {
39914156 };
39924157 let (view, doc) = current!(cx.editor);
39934158 paste_impl(&[contents], doc, view, paste, count, cx.editor.mode);
4159+ exit_select_mode(cx);
39944160}
39954161
39964162fn paste_clipboard_after(cx: &mut Context) {
3997− paste(cx.editor, '*', Paste::After, cx.count());
4163+ paste(cx.editor, '+', Paste::After, cx.count());
4164+ exit_select_mode(cx);
39984165}
39994166
40004167fn paste_clipboard_before(cx: &mut Context) {
4001− paste(cx.editor, '*', Paste::Before, cx.count());
4168+ paste(cx.editor, '+', Paste::Before, cx.count());
4169+ exit_select_mode(cx);
40024170}
40034171
40044172fn paste_primary_clipboard_after(cx: &mut Context) {
4005− paste(cx.editor, '+', Paste::After, cx.count());
4173+ paste(cx.editor, '*', Paste::After, cx.count());
4174+ exit_select_mode(cx);
40064175}
40074176
40084177fn paste_primary_clipboard_before(cx: &mut Context) {
4009− paste(cx.editor, '+', Paste::Before, cx.count());
4178+ paste(cx.editor, '*', Paste::Before, cx.count());
4179+ exit_select_mode(cx);
40104180}
40114181
40124182fn replace_with_yanked(cx: &mut Context) {
@@ -4044,11 +4214,13 @@ fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) {
40444214}
40454215
40464216fn replace_selections_with_clipboard(cx: &mut Context) {
4047− replace_with_yanked_impl(cx.editor, '*', cx.count());
4217+ replace_with_yanked_impl(cx.editor, '+', cx.count());
4218+ exit_select_mode(cx);
40484219}
40494220
40504221fn replace_selections_with_primary_clipboard(cx: &mut Context) {
4051− replace_with_yanked_impl(cx.editor, '+', cx.count());
4222+ replace_with_yanked_impl(cx.editor, '*', cx.count());
4223+ exit_select_mode(cx);
40524224}
40534225
40544226fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
@@ -4066,6 +4238,7 @@ fn paste_after(cx: &mut Context) {
40664238 Paste::After,
40674239 cx.count(),
40684240 );
4241+ exit_select_mode(cx);
40694242}
40704243
40714244fn paste_before(cx: &mut Context) {
@@ -4075,6 +4248,7 @@ fn paste_before(cx: &mut Context) {
40754248 Paste::Before,
40764249 cx.count(),
40774250 );
4251+ exit_select_mode(cx);
40784252}
40794253
40804254fn get_lines(doc: &Document, view_id: ViewId) -> Vec<usize> {
@@ -4113,6 +4287,7 @@ fn indent(cx: &mut Context) {
41134287 }),
41144288 );
41154289 doc.apply(&transaction, view.id);
4290+ exit_select_mode(cx);
41164291}
41174292
41184293fn unindent(cx: &mut Context) {
@@ -4152,6 +4327,7 @@ fn unindent(cx: &mut Context) {
41524327 let transaction = Transaction::change(doc.text(), changes.into_iter());
41534328
41544329 doc.apply(&transaction, view.id);
4330+ exit_select_mode(cx);
41554331}
41564332
41574333fn format_selections(cx: &mut Context) {
@@ -4218,10 +4394,9 @@ fn join_selections_impl(cx: &mut Context, select_space: bool) {
42184394 use movement::skip_while;
42194395 let (view, doc) = current!(cx.editor);
42204396 let text = doc.text();
4221− let slice = doc.text().slice(..);
4397+ let slice = text.slice(..);
42224398
42234399 let mut changes = Vec::new();
4224− let fragment = Tendril::from(" ");
42254400
42264401 for selection in doc.selection(view.id) {
42274402 let (start, mut end) = selection.line_range(slice);
@@ -4237,9 +4412,13 @@ fn join_selections_impl(cx: &mut Context, select_space: bool) {
42374412 let mut end = text.line_to_char(line + 1);
42384413 end = skip_while(slice, end, |ch| matches!(ch, ' ' | '\t')).unwrap_or(end);
42394414
4240− // need to skip from start, not end
4241− let change = (start, end, Some(fragment.clone()));
4242− changes.push(change);
4415+ let separator = if end == line_end_char_index(&slice, line + 1) {
4416+ // the joining line contains only space-characters => don't include a whitespace when joining
4417+ None
4418+ } else {
4419+ Some(Tendril::from(" "))
4420+ };
4421+ changes.push((start, end, separator));
42434422 }
42444423 }
42454424
@@ -4251,9 +4430,6 @@ fn join_selections_impl(cx: &mut Context, select_space: bool) {
42514430 changes.sort_unstable_by_key(|(from, _to, _text)| *from);
42524431 changes.dedup();
42534432
4254− // TODO: joining multiple empty lines should be replaced by a single space.
4255− // need to merge change ranges that touch
4256−
42574433 // select inserted spaces
42584434 let transaction = if select_space {
42594435 let ranges: SmallVec<_> = changes
@@ -4265,9 +4441,9 @@ fn join_selections_impl(cx: &mut Context, select_space: bool) {
42654441 })
42664442 .collect();
42674443 let selection = Selection::new(ranges, 0);
4268− Transaction::change(doc.text(), changes.into_iter()).with_selection(selection)
4444+ Transaction::change(text, changes.into_iter()).with_selection(selection)
42694445 } else {
4270− Transaction::change(doc.text(), changes.into_iter())
4446+ Transaction::change(text, changes.into_iter())
42714447 };
42724448
42734449 doc.apply(&transaction, view.id);
@@ -4281,8 +4457,8 @@ fn keep_or_remove_selections_impl(cx: &mut Context, remove: bool) {
42814457 if remove { "remove:" } else { "keep:" }.into(),
42824458 Some(reg),
42834459 ui::completers::none,
4284− move |editor, regex, event| {
4285− let (view, doc) = current!(editor);
4460+ move |cx, regex, event| {
4461+ let (view, doc) = current!(cx.editor);
42864462 if !matches!(event, PromptEvent::Update | PromptEvent::Validate) {
42874463 return;
42884464 }
@@ -4799,17 +4975,19 @@ fn transpose_view(cx: &mut Context) {
47994975 cx.editor.transpose_view()
48004976}
48014977
4802−// split helper, clear it later
4803−fn split(cx: &mut Context, action: Action) {
4804− let (view, doc) = current!(cx.editor);
4978+/// Open a new split in the given direction specified by the action.
4979+///
4980+/// Maintain the current view (both the cursor's position and view in document).
4981+fn split(editor: &mut Editor, action: Action) {
4982+ let (view, doc) = current!(editor);
48054983 let id = doc.id();
48064984 let selection = doc.selection(view.id).clone();
48074985 let offset = view.offset;
48084986
4809− cx.editor.switch(id, action);
4987+ editor.switch(id, action);
48104988
48114989 // match the selection in the previous view
4812− let (view, doc) = current!(cx.editor);
4990+ let (view, doc) = current!(editor);
48134991 doc.set_selection(view.id, selection);
48144992 // match the view scroll offset (switch doesn't handle this fully
48154993 // since the selection is only matched after the split)
@@ -4817,7 +4995,7 @@ fn split(cx: &mut Context, action: Action) {
48174995}
48184996
48194997fn hsplit(cx: &mut Context) {
4820− split(cx, Action::HorizontalSplit);
4998+ split(cx.editor, Action::HorizontalSplit);
48214999}
48225000
48235001fn hsplit_new(cx: &mut Context) {
@@ -4825,7 +5003,7 @@ fn hsplit_new(cx: &mut Context) {
48255003}
48265004
48275005fn vsplit(cx: &mut Context) {
4828− split(cx, Action::VerticalSplit);
5006+ split(cx.editor, Action::VerticalSplit);
48295007}
48305008
48315009fn vsplit_new(cx: &mut Context) {
@@ -5431,12 +5609,18 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) {
54315609 };
54325610
54335611 // These `usize`s cannot underflow because selection ranges cannot overlap.
5434− // Once the MSRV is 1.66.0 (mixed_integer_ops is stabilized), we can use checked
5435− // arithmetic to assert this.
5436− let anchor = (to as isize + offset - deleted_len as isize) as usize;
5612+ let anchor = to
5613+ .checked_add_signed(offset)
5614+ .expect("Selection ranges cannot overlap")
5615+ .checked_sub(deleted_len)
5616+ .expect("Selection ranges cannot overlap");
54375617 let new_range = Range::new(anchor, anchor + output_len).with_direction(range.direction());
54385618 ranges.push(new_range);
5439− offset = offset + output_len as isize - deleted_len as isize;
5619+ offset = offset
5620+ .checked_add_unsigned(output_len)
5621+ .expect("Selection ranges cannot overlap")
5622+ .checked_sub_unsigned(deleted_len)
5623+ .expect("Selection ranges cannot overlap");
54405624
54415625 changes.push((from, to, Some(output)));
54425626 }
@@ -5575,6 +5759,7 @@ fn increment_impl(cx: &mut Context, increment_direction: IncrementDirection) {
55755759 let transaction = Transaction::change(doc.text(), changes.into_iter());
55765760 let transaction = transaction.with_selection(new_selection);
55775761 doc.apply(&transaction, view.id);
5762+ exit_select_mode(cx);
55785763 }
55795764}
55805765
helix-term/src/commands/dap.rs+13−4
@@ -8,7 +8,7 @@ use dap::{StackFrame, Thread, ThreadStates};
88use helix_core::syntax::{DebugArgumentValue, DebugConfigCompletion, DebugTemplate};
99use helix_dap::{self as dap, Client};
1010use helix_lsp::block_on;
11−use helix_view::editor::Breakpoint;
11+use helix_view::{editor::Breakpoint, graphics::Margin};
1212
1313use serde_json::{to_value, Value};
1414use tokio_stream::wrappers::UnboundedReceiverStream;
@@ -339,8 +339,12 @@ fn debug_parameter_prompt(
339339 .to_owned();
340340
341341 let completer = match field_type {
342− "filename" => ui::completers::filename,
343− "directory" => ui::completers::directory,
342+ "filename" => |editor: &Editor, input: &str| {
343+ ui::completers::filename_with_git_ignore(editor, input, false)
344+ },
345+ "directory" => |editor: &Editor, input: &str| {
346+ ui::completers::directory_with_git_ignore(editor, input, false)
347+ },
344348 _ => ui::completers::none,
345349 };
346350
@@ -577,7 +581,12 @@ pub fn dap_variables(cx: &mut Context) {
577581 }
578582
579583 let contents = Text::from(tui::text::Text::from(variables));
580− let popup = Popup::new("dap-variables", contents);
584+ let margin = if cx.editor.popup_border() {
585+ Margin::all(1)
586+ } else {
587+ Margin::none()
588+ };
589+ let popup = Popup::new("dap-variables", contents).margin(margin);
581590 cx.replace_or_push_layer("dap-variables", popup);
582591}
583592
helix-term/src/commands/lsp.rs+12−2
@@ -23,6 +23,7 @@ use helix_core::{
2323use helix_view::{
2424 document::{DocumentInlayHints, DocumentInlayHintsId, Mode},
2525 editor::Action,
26+ graphics::Margin,
2627 theme::Style,
2728 Document, View,
2829};
@@ -49,7 +50,7 @@ use std::{
4950/// If there is no configured language server that supports the feature, this displays a status message.
5051/// Using this macro in a context where the editor automatically queries the LSP
5152/// (instead of when the user explicitly does so via a keybind like `gd`)
52−/// will spam the "No configured language server supports <feature>" status message confusingly.
53+/// will spam the "No configured language server supports \<feature>" status message confusingly.
5354#[macro_export]
5455macro_rules! language_server_with_feature {
5556 ($editor:expr, $doc:expr, $feature:expr) => {{
@@ -744,7 +745,16 @@ pub fn code_action(cx: &mut Context) {
744745 });
745746 picker.move_down(); // pre-select the first item
746747
747− let popup = Popup::new("code-action", picker).with_scrollbar(false);
748+ let margin = if editor.menu_border() {
749+ Margin::vertical(1)
750+ } else {
751+ Margin::none()
752+ };
753+
754+ let popup = Popup::new("code-action", picker)
755+ .with_scrollbar(false)
756+ .margin(margin);
757+
748758 compositor.replace_or_push("code-action", popup);
749759 };
750760
helix-term/src/commands/typed.rs+872−663
@@ -5,7 +5,10 @@ use crate::job::Job;
55
66use super::*;
77
8−use helix_core::{encoding, shellwords::Shellwords};
8+use helix_core::fuzzy::fuzzy_match;
9+use helix_core::indent::MAX_INDENT;
10+use helix_core::{encoding, line_ending, path::get_canonicalized_path, shellwords::Shellwords};
11+use helix_lsp::{OffsetEncoding, Url};
912use helix_view::document::DEFAULT_LANGUAGE_NAME;
1013use helix_view::editor::{Action, CloseError, ConfigEvent};
1114use serde_json::Value;
@@ -329,12 +332,16 @@ fn write_impl(
329332 path: Option<&Cow<str>>,
330333 force: bool,
331334) -> anyhow::Result<()> {
332− let editor_auto_fmt = cx.editor.config().auto_format;
335+ let config = cx.editor.config();
333336 let jobs = &mut cx.jobs;
334337 let (view, doc) = current!(cx.editor);
335338 let path = path.map(AsRef::as_ref);
336339
337− let fmt = if editor_auto_fmt {
340+ if config.insert_final_newline {
341+ insert_final_newline(doc, view);
342+ }
343+
344+ let fmt = if config.auto_format {
338345 doc.auto_format().map(|fmt| {
339346 let callback = make_format_callback(
340347 doc.id(),
@@ -358,6 +365,16 @@ fn write_impl(
358365 Ok(())
359366}
360367
368+fn insert_final_newline(doc: &mut Document, view: &mut View) {
369+ let text = doc.text();
370+ if line_ending::get_line_ending(&text.slice(..)).is_none() {
371+ let eof = Selection::point(text.len_chars());
372+ let insert = Transaction::insert(text, &eof, doc.line_ending.as_str().into());
373+ doc.apply(&insert, view.id);
374+ doc.append_changes_to_history(view);
375+ }
376+}
377+
361378fn write(
362379 cx: &mut compositor::Context,
363380 args: &[Cow<str>],
@@ -460,8 +477,7 @@ fn set_indent_style(
460477 cx.editor.set_status(match style {
461478 Tabs => "tabs".to_owned(),
462479 Spaces(1) => "1 space".to_owned(),
463− Spaces(n) if (2..=8).contains(&n) => format!("{} spaces", n),
464− _ => unreachable!(), // Shouldn't happen.
480+ Spaces(n) => format!("{} spaces", n),
465481 });
466482 return Ok(());
467483 }
@@ -473,7 +489,7 @@ fn set_indent_style(
473489 Some(arg) => arg
474490 .parse::<u8>()
475491 .ok()
476− .filter(|n| (1..=8).contains(n))
492+ .filter(|n| (1..=MAX_INDENT).contains(n))
477493 .map(Spaces),
478494 _ => None,
479495 };
@@ -558,7 +574,6 @@ fn set_line_ending(
558574
559575 Ok(())
560576}
561−
562577fn earlier(
563578 cx: &mut compositor::Context,
564579 args: &[Cow<str>],
@@ -657,11 +672,10 @@ pub fn write_all_impl(
657672 write_scratch: bool,
658673) -> anyhow::Result<()> {
659674 let mut errors: Vec<&'static str> = Vec::new();
660− let auto_format = cx.editor.config().auto_format;
675+ let config = cx.editor.config();
661676 let jobs = &mut cx.jobs;
662677 let current_view = view!(cx.editor);
663678
664− // save all documents
665679 let saves: Vec<_> = cx
666680 .editor
667681 .documents
@@ -692,32 +706,35 @@ pub fn write_all_impl(
692706 current_view.id
693707 };
694708
695− let fmt = if auto_format {
696− doc.auto_format().map(|fmt| {
697− let callback = make_format_callback(
698− doc.id(),
699− doc.version(),
700− target_view,
701− fmt,
702− Some((None, force)),
703− );
704− jobs.add(Job::with_callback(callback).wait_before_exiting());
705− })
706− } else {
707− None
708− };
709+ Some((doc.id(), target_view))
710+ })
711+ .collect();
709712
710− if fmt.is_none() {
711− return Some(doc.id());
712− }
713+ for (doc_id, target_view) in saves {
714+ let doc = doc_mut!(cx.editor, &doc_id);
715+
716+ if config.insert_final_newline {
717+ insert_final_newline(doc, view_mut!(cx.editor, target_view));
718+ }
713719
720+ let fmt = if config.auto_format {
721+ doc.auto_format().map(|fmt| {
722+ let callback = make_format_callback(
723+ doc_id,
724+ doc.version(),
725+ target_view,
726+ fmt,
727+ Some((None, force)),
728+ );
729+ jobs.add(Job::with_callback(callback).wait_before_exiting());
730+ })
731+ } else {
714732 None
715− })
716− .collect();
733+ };
717734
718− // manually call save for the rest of docs that don't have a formatter
719− for id in saves {
720− cx.editor.save::<PathBuf>(id, None, force)?;
735+ if fmt.is_none() {
736+ cx.editor.save::<PathBuf>(doc_id, None, force)?;
737+ }
721738 }
722739
723740 if !errors.is_empty() && !force {
@@ -904,7 +921,7 @@ fn yank_main_selection_to_clipboard(
904921 return Ok(());
905922 }
906923
907− yank_primary_selection_impl(cx.editor, '*');
924+ yank_primary_selection_impl(cx.editor, '+');
908925 Ok(())
909926}
910927
@@ -939,7 +956,7 @@ fn yank_joined_to_clipboard(
939956 let doc = doc!(cx.editor);
940957 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
941958 let separator = args.first().unwrap_or(&default_sep);
942− yank_joined_impl(cx.editor, separator, '*');
959+ yank_joined_impl(cx.editor, separator, '+');
943960 Ok(())
944961}
945962
@@ -952,7 +969,7 @@ fn yank_main_selection_to_primary_clipboard(
952969 return Ok(());
953970 }
954971
955− yank_primary_selection_impl(cx.editor, '+');
972+ yank_primary_selection_impl(cx.editor, '*');
956973 Ok(())
957974}
958975
@@ -968,7 +985,7 @@ fn yank_joined_to_primary_clipboard(
968985 let doc = doc!(cx.editor);
969986 let default_sep = Cow::Borrowed(doc.line_ending.as_str());
970987 let separator = args.first().unwrap_or(&default_sep);
971− yank_joined_impl(cx.editor, separator, '+');
988+ yank_joined_impl(cx.editor, separator, '*');
972989 Ok(())
973990}
974991
@@ -981,7 +998,7 @@ fn paste_clipboard_after(
981998 return Ok(());
982999 }
9831000
984− paste(cx.editor, '*', Paste::After, 1);
1001+ paste(cx.editor, '+', Paste::After, 1);
9851002 Ok(())
9861003}
9871004
@@ -994,7 +1011,7 @@ fn paste_clipboard_before(
9941011 return Ok(());
9951012 }
9961013
997− paste(cx.editor, '*', Paste::Before, 1);
1014+ paste(cx.editor, '+', Paste::Before, 1);
9981015 Ok(())
9991016}
10001017
@@ -1007,7 +1024,7 @@ fn paste_primary_clipboard_after(
10071024 return Ok(());
10081025 }
10091026
1010− paste(cx.editor, '+', Paste::After, 1);
1027+ paste(cx.editor, '*', Paste::After, 1);
10111028 Ok(())
10121029}
10131030
@@ -1020,7 +1037,7 @@ fn paste_primary_clipboard_before(
10201037 return Ok(());
10211038 }
10221039
1023− paste(cx.editor, '+', Paste::Before, 1);
1040+ paste(cx.editor, '*', Paste::Before, 1);
10241041 Ok(())
10251042}
10261043
@@ -1033,7 +1050,7 @@ fn replace_selections_with_clipboard(
10331050 return Ok(());
10341051 }
10351052
1036− replace_with_yanked_impl(cx.editor, '*', 1);
1053+ replace_with_yanked_impl(cx.editor, '+', 1);
10371054 Ok(())
10381055}
10391056
@@ -1046,7 +1063,7 @@ fn replace_selections_with_primary_clipboard(
10461063 return Ok(());
10471064 }
10481065
1049− replace_with_yanked_impl(cx.editor, '+', 1);
1066+ replace_with_yanked_impl(cx.editor, '*', 1);
10501067 Ok(())
10511068}
10521069
@@ -1265,12 +1282,10 @@ fn reload(
12651282 }
12661283
12671284 let scrolloff = cx.editor.config().scrolloff;
1268− let redraw_handle = cx.editor.redraw_handle.clone();
12691285 let (view, doc) = current!(cx.editor);
1270− doc.reload(view, &cx.editor.diff_providers, redraw_handle)
1271− .map(|_| {
1272− view.ensure_cursor_in_view(doc, scrolloff);
1273− })?;
1286+ doc.reload(view, &cx.editor.diff_providers).map(|_| {
1287+ view.ensure_cursor_in_view(doc, scrolloff);
1288+ })?;
12741289 if let Some(path) = doc.path() {
12751290 cx.editor
12761291 .language_servers
@@ -1316,8 +1331,7 @@ fn reload_all(
13161331 // Ensure that the view is synced with the document's history.
13171332 view.sync_changes(doc);
13181333
1319− let redraw_handle = cx.editor.redraw_handle.clone();
1320− doc.reload(view, &cx.editor.diff_providers, redraw_handle)?;
1334+ doc.reload(view, &cx.editor.diff_providers)?;
13211335 if let Some(path) = doc.path() {
13221336 cx.editor
13231337 .language_servers
@@ -1529,6 +1543,84 @@ fn tree_sitter_scopes(
15291543 Ok(())
15301544}
15311545
1546+fn tree_sitter_highlight_name(
1547+ cx: &mut compositor::Context,
1548+ _args: &[Cow<str>],
1549+ event: PromptEvent,
1550+) -> anyhow::Result<()> {
1551+ fn find_highlight_at_cursor(
1552+ cx: &mut compositor::Context<'_>,
1553+ ) -> Option<helix_core::syntax::Highlight> {
1554+ use helix_core::syntax::HighlightEvent;
1555+
1556+ let (view, doc) = current!(cx.editor);
1557+ let syntax = doc.syntax()?;
1558+ let text = doc.text().slice(..);
1559+ let cursor = doc.selection(view.id).primary().cursor(text);
1560+ let byte = text.char_to_byte(cursor);
1561+ let node = syntax
1562+ .tree()
1563+ .root_node()
1564+ .descendant_for_byte_range(byte, byte)?;
1565+ // Query the same range as the one used in syntax highlighting.
1566+ let range = {
1567+ // Calculate viewport byte ranges:
1568+ let row = text.char_to_line(view.offset.anchor.min(text.len_chars()));
1569+ // Saturating subs to make it inclusive zero indexing.
1570+ let last_line = text.len_lines().saturating_sub(1);
1571+ let height = view.inner_area(doc).height;
1572+ let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line);
1573+ let start = text.line_to_byte(row.min(last_line));
1574+ let end = text.line_to_byte(last_visible_line + 1);
1575+
1576+ start..end
1577+ };
1578+
1579+ let mut highlight = None;
1580+
1581+ for event in syntax.highlight_iter(text, Some(range), None) {
1582+ match event.unwrap() {
1583+ HighlightEvent::Source { start, end }
1584+ if start == node.start_byte() && end == node.end_byte() =>
1585+ {
1586+ return highlight;
1587+ }
1588+ HighlightEvent::HighlightStart(hl) => {
1589+ highlight = Some(hl);
1590+ }
1591+ _ => (),
1592+ }
1593+ }
1594+
1595+ None
1596+ }
1597+
1598+ if event != PromptEvent::Validate {
1599+ return Ok(());
1600+ }
1601+
1602+ let Some(highlight) = find_highlight_at_cursor(cx) else {
1603+ return Ok(());
1604+ };
1605+
1606+ let content = cx.editor.theme.scope(highlight.0).to_string();
1607+
1608+ let callback = async move {
1609+ let call: job::Callback = Callback::EditorCompositor(Box::new(
1610+ move |editor: &mut Editor, compositor: &mut Compositor| {
1611+ let content = ui::Markdown::new(content, editor.syn_loader.clone());
1612+ let popup = Popup::new("hover", content).auto_close(true);
1613+ compositor.replace_or_push("hover", popup);
1614+ },
1615+ ));
1616+ Ok(call)
1617+ };
1618+
1619+ cx.jobs.callback(callback);
1620+
1621+ Ok(())
1622+}
1623+
15321624fn vsplit(
15331625 cx: &mut compositor::Context,
15341626 args: &[Cow<str>],
@@ -1538,10 +1630,8 @@ fn vsplit(
15381630 return Ok(());
15391631 }
15401632
1541− let id = view!(cx.editor).doc;
1542−
15431633 if args.is_empty() {
1544− cx.editor.switch(id, Action::VerticalSplit);
1634+ split(cx.editor, Action::VerticalSplit);
15451635 } else {
15461636 for arg in args {
15471637 cx.editor
@@ -1561,10 +1651,8 @@ fn hsplit(
15611651 return Ok(());
15621652 }
15631653
1564− let id = view!(cx.editor).doc;
1565−
15661654 if args.is_empty() {
1567− cx.editor.switch(id, Action::HorizontalSplit);
1655+ split(cx.editor, Action::HorizontalSplit);
15681656 } else {
15691657 for arg in args {
15701658 cx.editor
@@ -1679,7 +1767,7 @@ fn tutor(
16791767 let path = helix_loader::runtime_file(Path::new("tutor"));
16801768 cx.editor.open(&path, Action::Replace)?;
16811769 // Unset path to prevent accidentally saving to the original tutor file.
1682− doc_mut!(cx.editor).set_path(None)?;
1770+ doc_mut!(cx.editor).set_path(None);
16831771 Ok(())
16841772}
16851773
@@ -1856,14 +1944,29 @@ fn toggle_option(
18561944 .to_string(),
18571945 )
18581946 }
1859− Value::Null | Value::Object(_) | Value::Array(_) | Value::Number(_) => {
1947+ Value::Number(ref value) => {
1948+ ensure!(
1949+ args.len() > 2,
1950+ "Bad arguments. For number configurations use: `:toggle key val1 val2 ...`",
1951+ );
1952+
1953+ Value::Number(
1954+ args[1..]
1955+ .iter()
1956+ .skip_while(|&e| value.to_string() != *e.to_string())
1957+ .nth(1)
1958+ .unwrap_or_else(|| &args[1])
1959+ .parse()?,
1960+ )
1961+ }
1962+ Value::Null | Value::Object(_) | Value::Array(_) => {
18601963 anyhow::bail!("Configuration {key} does not support toggle yet")
18611964 }
18621965 };
18631966
18641967 let status = format!("'{key}' is now set to {value}");
18651968 let config = serde_json::from_value(config)
1866− .map_err(|_| anyhow::anyhow!("Could not parse field: `{:?}`", &args))?;
1969+ .map_err(|err| anyhow::anyhow!("Cannot parse `{:?}`, {}", &args, err))?;
18671970
18681971 cx.editor
18691972 .config_events
@@ -2282,595 +2385,711 @@ fn clear_register(
22822385 Ok(())
22832386}
22842387
2388+fn redraw(
2389+ cx: &mut compositor::Context,
2390+ _args: &[Cow<str>],
2391+ event: PromptEvent,
2392+) -> anyhow::Result<()> {
2393+ if event != PromptEvent::Validate {
2394+ return Ok(());
2395+ }
2396+
2397+ let callback = Box::pin(async move {
2398+ let call: job::Callback =
2399+ job::Callback::EditorCompositor(Box::new(|_editor, compositor| {
2400+ compositor.need_full_redraw();
2401+ }));
2402+
2403+ Ok(call)
2404+ });
2405+
2406+ cx.jobs.callback(callback);
2407+
2408+ Ok(())
2409+}
2410+
2411+fn move_buffer(
2412+ cx: &mut compositor::Context,
2413+ args: &[Cow<str>],
2414+ event: PromptEvent,
2415+) -> anyhow::Result<()> {
2416+ if event != PromptEvent::Validate {
2417+ return Ok(());
2418+ }
2419+
2420+ ensure!(args.len() == 1, format!(":move takes one argument"));
2421+ let doc = doc!(cx.editor);
2422+
2423+ let new_path = get_canonicalized_path(&PathBuf::from(args.first().unwrap().to_string()));
2424+ let old_path = doc
2425+ .path()
2426+ .ok_or_else(|| anyhow!("Scratch buffer cannot be moved. Use :write instead"))?
2427+ .clone();
2428+ let old_path_as_url = doc.url().unwrap();
2429+ let new_path_as_url = Url::from_file_path(&new_path).unwrap();
2430+
2431+ let edits: Vec<(
2432+ helix_lsp::Result<helix_lsp::lsp::WorkspaceEdit>,
2433+ OffsetEncoding,
2434+ String,
2435+ )> = doc
2436+ .language_servers()
2437+ .map(|lsp| {
2438+ (
2439+ lsp.prepare_file_rename(&old_path_as_url, &new_path_as_url),
2440+ lsp.offset_encoding(),
2441+ lsp.name().to_owned(),
2442+ )
2443+ })
2444+ .filter(|(f, _, _)| f.is_some())
2445+ .map(|(f, encoding, name)| (helix_lsp::block_on(f.unwrap()), encoding, name))
2446+ .collect();
2447+
2448+ for (lsp_reply, encoding, name) in edits {
2449+ match lsp_reply {
2450+ Ok(edit) => {
2451+ if let Err(e) = apply_workspace_edit(cx.editor, encoding, &edit) {
2452+ log::error!(
2453+ ":move command failed to apply edits from lsp {}: {:?}",
2454+ name,
2455+ e
2456+ );
2457+ };
2458+ }
2459+ Err(e) => {
2460+ log::error!("LSP {} failed to treat willRename request: {:?}", name, e);
2461+ }
2462+ };
2463+ }
2464+
2465+ let doc = doc_mut!(cx.editor);
2466+
2467+ doc.set_path(Some(new_path.as_path()));
2468+ if let Err(e) = std::fs::rename(&old_path, &new_path) {
2469+ doc.set_path(Some(old_path.as_path()));
2470+ bail!("Could not move file: {}", e);
2471+ };
2472+
2473+ doc.language_servers().for_each(|lsp| {
2474+ lsp.did_file_rename(&old_path_as_url, &new_path_as_url);
2475+ });
2476+
2477+ cx.editor
2478+ .language_servers
2479+ .file_event_handler
2480+ .file_changed(new_path);
2481+
2482+ Ok(())
2483+}
2484+
22852485pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
2286− TypableCommand {
2287− name: "quit",
2288− aliases: &["q"],
2289− doc: "Close the current view.",
2290− fun: quit,
2291− signature: CommandSignature::none(),
2292− },
2293− TypableCommand {
2294− name: "quit!",
2295− aliases: &["q!"],
2296− doc: "Force close the current view, ignoring unsaved changes.",
2297− fun: force_quit,
2298− signature: CommandSignature::none(),
2299− },
2300− TypableCommand {
2301− name: "open",
2302− aliases: &["o"],
2303− doc: "Open a file from disk into the current view.",
2304− fun: open,
2305− signature: CommandSignature::all(completers::filename),
2306− },
2307− TypableCommand {
2308− name: "buffer-close",
2309− aliases: &["bc", "bclose"],
2310− doc: "Close the current buffer.",
2311− fun: buffer_close,
2312− signature: CommandSignature::all(completers::buffer),
2313− },
2314− TypableCommand {
2315− name: "buffer-close!",
2316− aliases: &["bc!", "bclose!"],
2317− doc: "Close the current buffer forcefully, ignoring unsaved changes.",
2318− fun: force_buffer_close,
2319− signature: CommandSignature::all(completers::buffer)
2320− },
2321− TypableCommand {
2322− name: "buffer-close-others",
2323− aliases: &["bco", "bcloseother"],
2324− doc: "Close all buffers but the currently focused one.",
2325− fun: buffer_close_others,
2326− signature: CommandSignature::none(),
2327− },
2328− TypableCommand {
2329− name: "buffer-close-others!",
2330− aliases: &["bco!", "bcloseother!"],
2331− doc: "Force close all buffers but the currently focused one.",
2332− fun: force_buffer_close_others,
2333− signature: CommandSignature::none(),
2334− },
2335− TypableCommand {
2336− name: "buffer-close-all",
2337− aliases: &["bca", "bcloseall"],
2338− doc: "Close all buffers without quitting.",
2339− fun: buffer_close_all,
2340− signature: CommandSignature::none(),
2341− },
2342− TypableCommand {
2343− name: "buffer-close-all!",
2344− aliases: &["bca!", "bcloseall!"],
2345− doc: "Force close all buffers ignoring unsaved changes without quitting.",
2346− fun: force_buffer_close_all,
2347− signature: CommandSignature::none(),
2348− },
2349− TypableCommand {
2350− name: "buffer-next",
2351− aliases: &["bn", "bnext"],
2352− doc: "Goto next buffer.",
2353− fun: buffer_next,
2354− signature: CommandSignature::none(),
2355− },
2356− TypableCommand {
2357− name: "buffer-previous",
2358− aliases: &["bp", "bprev"],
2359− doc: "Goto previous buffer.",
2360− fun: buffer_previous,
2361− signature: CommandSignature::none(),
2362− },
2363− TypableCommand {
2364− name: "write",
2365− aliases: &["w"],
2366− doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)",
2367− fun: write,
2368− signature: CommandSignature::positional(&[completers::filename]),
2369− },
2370− TypableCommand {
2371− name: "write!",
2372− aliases: &["w!"],
2373− doc: "Force write changes to disk creating necessary subdirectories. Accepts an optional path (:write! some/path.txt)",
2374− fun: force_write,
2375− signature: CommandSignature::positional(&[completers::filename]),
2376− },
2377− TypableCommand {
2378− name: "write-buffer-close",
2379− aliases: &["wbc"],
2380− doc: "Write changes to disk and closes the buffer. Accepts an optional path (:write-buffer-close some/path.txt)",
2381− fun: write_buffer_close,
2382− signature: CommandSignature::positional(&[completers::filename]),
2383− },
2384− TypableCommand {
2385− name: "write-buffer-close!",
2386− aliases: &["wbc!"],
2387− doc: "Force write changes to disk creating necessary subdirectories and closes the buffer. Accepts an optional path (:write-buffer-close! some/path.txt)",
2388− fun: force_write_buffer_close,
2389− signature: CommandSignature::positional(&[completers::filename]),
2390− },
2391− TypableCommand {
2392− name: "new",
2393− aliases: &["n"],
2394− doc: "Create a new scratch buffer.",
2395− fun: new_file,
2396− // TODO: This seems to complete with a filename, but doesn't use that filename to
2397− // set the path of the newly created buffer.
2398− signature: CommandSignature::positional(&[completers::filename]),
2399− },
2400− TypableCommand {
2401− name: "format",
2402− aliases: &["fmt"],
2403− doc: "Format the file using the LSP formatter.",
2404− fun: format,
2405− signature: CommandSignature::none(),
2406− },
2407− TypableCommand {
2408− name: "indent-style",
2409− aliases: &[],
2410− doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)",
2411− fun: set_indent_style,
2412− signature: CommandSignature::none(),
2413− },
2414− TypableCommand {
2415− name: "line-ending",
2416− aliases: &[],
2417− #[cfg(not(feature = "unicode-lines"))]
2418− doc: "Set the document's default line ending. Options: crlf, lf.",
2419− #[cfg(feature = "unicode-lines")]
2420− doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.",
2421− fun: set_line_ending,
2422− signature: CommandSignature::none(),
2423− },
2424− TypableCommand {
2425− name: "earlier",
2426− aliases: &["ear"],
2427− doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.",
2428− fun: earlier,
2429− signature: CommandSignature::none(),
2430− },
2431− TypableCommand {
2432− name: "later",
2433− aliases: &["lat"],
2434− doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.",
2435− fun: later,
2436− signature: CommandSignature::none(),
2437− },
2438− TypableCommand {
2439− name: "write-quit",
2440− aliases: &["wq", "x"],
2441− doc: "Write changes to disk and close the current view. Accepts an optional path (:wq some/path.txt)",
2442− fun: write_quit,
2443− signature: CommandSignature::positional(&[completers::filename]),
2444− },
2445− TypableCommand {
2446− name: "write-quit!",
2447− aliases: &["wq!", "x!"],
2448− doc: "Write changes to disk and close the current view forcefully. Accepts an optional path (:wq! some/path.txt)",
2449− fun: force_write_quit,
2450− signature: CommandSignature::positional(&[completers::filename]),
2451− },
2452− TypableCommand {
2453− name: "write-all",
2454− aliases: &["wa"],
2455− doc: "Write changes from all buffers to disk.",
2456− fun: write_all,
2457− signature: CommandSignature::none(),
2458− },
2459− TypableCommand {
2460− name: "write-all!",
2461− aliases: &["wa!"],
2462− doc: "Forcefully write changes from all buffers to disk creating necessary subdirectories.",
2463− fun: force_write_all,
2464− signature: CommandSignature::none(),
2465− },
2466− TypableCommand {
2467− name: "write-quit-all",
2468− aliases: &["wqa", "xa"],
2469− doc: "Write changes from all buffers to disk and close all views.",
2470− fun: write_all_quit,
2471− signature: CommandSignature::none(),
2472− },
2473− TypableCommand {
2474− name: "write-quit-all!",
2475− aliases: &["wqa!", "xa!"],
2476− doc: "Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes).",
2477− fun: force_write_all_quit,
2478− signature: CommandSignature::none(),
2479− },
2480− TypableCommand {
2481− name: "quit-all",
2482− aliases: &["qa"],
2483− doc: "Close all views.",
2484− fun: quit_all,
2485− signature: CommandSignature::none(),
2486− },
2487− TypableCommand {
2488− name: "quit-all!",
2489− aliases: &["qa!"],
2490− doc: "Force close all views ignoring unsaved changes.",
2491− fun: force_quit_all,
2492− signature: CommandSignature::none(),
2493− },
2494− TypableCommand {
2495− name: "cquit",
2496− aliases: &["cq"],
2497− doc: "Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2).",
2498− fun: cquit,
2499− signature: CommandSignature::none(),
2500− },
2501− TypableCommand {
2502− name: "cquit!",
2503− aliases: &["cq!"],
2504− doc: "Force quit with exit code (default 1) ignoring unsaved changes. Accepts an optional integer exit code (:cq! 2).",
2505− fun: force_cquit,
2506− signature: CommandSignature::none(),
2507− },
2508− TypableCommand {
2509− name: "theme",
2510− aliases: &[],
2511− doc: "Change the editor theme (show current theme if no name specified).",
2512− fun: theme,
2513− signature: CommandSignature::positional(&[completers::theme]),
2514− },
2515− TypableCommand {
2516− name: "yank-join",
2517− aliases: &[],
2518− doc: "Yank joined selections. A separator can be provided as first argument. Default value is newline.",
2519− fun: yank_joined,
2520− signature: CommandSignature::none(),
2521− },
2522− TypableCommand {
2523− name: "clipboard-yank",
2524− aliases: &[],
2525− doc: "Yank main selection into system clipboard.",
2526− fun: yank_main_selection_to_clipboard,
2527− signature: CommandSignature::none(),
2528− },
2529− TypableCommand {
2530− name: "clipboard-yank-join",
2531− aliases: &[],
2532− doc: "Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
2533− fun: yank_joined_to_clipboard,
2534− signature: CommandSignature::none(),
2535− },
2536− TypableCommand {
2537− name: "primary-clipboard-yank",
2538− aliases: &[],
2539− doc: "Yank main selection into system primary clipboard.",
2540− fun: yank_main_selection_to_primary_clipboard,
2541− signature: CommandSignature::none(),
2542− },
2543− TypableCommand {
2544− name: "primary-clipboard-yank-join",
2545− aliases: &[],
2546− doc: "Yank joined selections into system primary clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
2547− fun: yank_joined_to_primary_clipboard,
2548− signature: CommandSignature::none(),
2549− },
2550− TypableCommand {
2551− name: "clipboard-paste-after",
2552− aliases: &[],
2553− doc: "Paste system clipboard after selections.",
2554− fun: paste_clipboard_after,
2555− signature: CommandSignature::none(),
2556− },
2557− TypableCommand {
2558− name: "clipboard-paste-before",
2559− aliases: &[],
2560− doc: "Paste system clipboard before selections.",
2561− fun: paste_clipboard_before,
2562− signature: CommandSignature::none(),
2563− },
2564− TypableCommand {
2565− name: "clipboard-paste-replace",
2566− aliases: &[],
2567− doc: "Replace selections with content of system clipboard.",
2568− fun: replace_selections_with_clipboard,
2569− signature: CommandSignature::none(),
2570− },
2571− TypableCommand {
2572− name: "primary-clipboard-paste-after",
2573− aliases: &[],
2574− doc: "Paste primary clipboard after selections.",
2575− fun: paste_primary_clipboard_after,
2576− signature: CommandSignature::none(),
2577− },
2578− TypableCommand {
2579− name: "primary-clipboard-paste-before",
2580− aliases: &[],
2581− doc: "Paste primary clipboard before selections.",
2582− fun: paste_primary_clipboard_before,
2583− signature: CommandSignature::none(),
2584− },
2585− TypableCommand {
2586− name: "primary-clipboard-paste-replace",
2587− aliases: &[],
2588− doc: "Replace selections with content of system primary clipboard.",
2589− fun: replace_selections_with_primary_clipboard,
2590− signature: CommandSignature::none(),
2591− },
2592− TypableCommand {
2593− name: "show-clipboard-provider",
2594− aliases: &[],
2595− doc: "Show clipboard provider name in status bar.",
2596− fun: show_clipboard_provider,
2597− signature: CommandSignature::none(),
2598− },
2599− TypableCommand {
2600− name: "change-current-directory",
2601− aliases: &["cd"],
2602− doc: "Change the current working directory.",
2603− fun: change_current_directory,
2604− signature: CommandSignature::positional(&[completers::directory]),
2605− },
2606− TypableCommand {
2607− name: "show-directory",
2608− aliases: &["pwd"],
2609− doc: "Show the current working directory.",
2610− fun: show_current_directory,
2611− signature: CommandSignature::none(),
2612− },
2613− TypableCommand {
2614− name: "encoding",
2615− aliases: &[],
2616− doc: "Set encoding. Based on `https://encoding.spec.whatwg.org`.",
2617− fun: set_encoding,
2618− signature: CommandSignature::none(),
2619− },
2620− TypableCommand {
2621− name: "character-info",
2622− aliases: &["char"],
2623− doc: "Get info about the character under the primary cursor.",
2624− fun: get_character_info,
2625− signature: CommandSignature::none(),
2626− },
2627− TypableCommand {
2628− name: "reload",
2629− aliases: &["rl"],
2630− doc: "Discard changes and reload from the source file.",
2631− fun: reload,
2632− signature: CommandSignature::none(),
2633− },
2634− TypableCommand {
2635− name: "reload-all",
2636− aliases: &["rla"],
2637− doc: "Discard changes and reload all documents from the source files.",
2638− fun: reload_all,
2639− signature: CommandSignature::none(),
2640− },
2641− TypableCommand {
2642− name: "update",
2643− aliases: &["u"],
2644− doc: "Write changes only if the file has been modified.",
2645− fun: update,
2646− signature: CommandSignature::none(),
2647− },
2648− TypableCommand {
2649− name: "lsp-workspace-command",
2650− aliases: &[],
2651− doc: "Open workspace command picker",
2652− fun: lsp_workspace_command,
2653− signature: CommandSignature::positional(&[completers::lsp_workspace_command]),
2654− },
2655− TypableCommand {
2656− name: "lsp-restart",
2657− aliases: &[],
2658− doc: "Restarts the language servers used by the current doc",
2659− fun: lsp_restart,
2660− signature: CommandSignature::none(),
2661− },
2662− TypableCommand {
2663− name: "lsp-stop",
2664− aliases: &[],
2665− doc: "Stops the language servers that are used by the current doc",
2666− fun: lsp_stop,
2667− signature: CommandSignature::none(),
2668− },
2669− TypableCommand {
2670− name: "tree-sitter-scopes",
2671− aliases: &[],
2672− doc: "Display tree sitter scopes, primarily for theming and development.",
2673− fun: tree_sitter_scopes,
2674− signature: CommandSignature::none(),
2675− },
2676− TypableCommand {
2677− name: "debug-start",
2678− aliases: &["dbg"],
2679− doc: "Start a debug session from a given template with given parameters.",
2680− fun: debug_start,
2681− signature: CommandSignature::none(),
2682− },
2683− TypableCommand {
2684− name: "debug-remote",
2685− aliases: &["dbg-tcp"],
2686− doc: "Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters.",
2687− fun: debug_remote,
2688− signature: CommandSignature::none(),
2689− },
2690− TypableCommand {
2691− name: "debug-eval",
2692− aliases: &[],
2693− doc: "Evaluate expression in current debug context.",
2694− fun: debug_eval,
2695− signature: CommandSignature::none(),
2696− },
2697− TypableCommand {
2698− name: "vsplit",
2699− aliases: &["vs"],
2700− doc: "Open the file in a vertical split.",
2701− fun: vsplit,
2702− signature: CommandSignature::all(completers::filename)
2703− },
2704− TypableCommand {
2705− name: "vsplit-new",
2706− aliases: &["vnew"],
2707− doc: "Open a scratch buffer in a vertical split.",
2708− fun: vsplit_new,
2709− signature: CommandSignature::none(),
2710− },
2711− TypableCommand {
2712− name: "hsplit",
2713− aliases: &["hs", "sp"],
2714− doc: "Open the file in a horizontal split.",
2715− fun: hsplit,
2716− signature: CommandSignature::all(completers::filename)
2717− },
2718− TypableCommand {
2719− name: "hsplit-new",
2720− aliases: &["hnew"],
2721− doc: "Open a scratch buffer in a horizontal split.",
2722− fun: hsplit_new,
2723− signature: CommandSignature::none(),
2724− },
2725− TypableCommand {
2726− name: "tutor",
2727− aliases: &[],
2728− doc: "Open the tutorial.",
2729− fun: tutor,
2730− signature: CommandSignature::none(),
2731− },
2732− TypableCommand {
2733− name: "goto",
2734− aliases: &["g"],
2735− doc: "Goto line number.",
2736− fun: goto_line_number,
2737− signature: CommandSignature::none(),
2738− },
2739− TypableCommand {
2740− name: "set-language",
2741− aliases: &["lang"],
2742− doc: "Set the language of current buffer (show current language if no value specified).",
2743− fun: language,
2744− signature: CommandSignature::positional(&[completers::language]),
2745− },
2746− TypableCommand {
2747− name: "set-option",
2748− aliases: &["set"],
2749− doc: "Set a config option at runtime.\nFor example to disable smart case search, use `:set search.smart-case false`.",
2750− fun: set_option,
2751− // TODO: Add support for completion of the options value(s), when appropriate.
2752− signature: CommandSignature::positional(&[completers::setting]),
2753− },
2754− TypableCommand {
2755− name: "toggle-option",
2756− aliases: &["toggle"],
2757− doc: "Toggle a boolean config option at runtime.\nFor example to toggle smart case search, use `:toggle search.smart-case`.",
2758− fun: toggle_option,
2759− signature: CommandSignature::positional(&[completers::setting]),
2760− },
2761− TypableCommand {
2762− name: "get-option",
2763− aliases: &["get"],
2764− doc: "Get the current value of a config option.",
2765− fun: get_option,
2766− signature: CommandSignature::positional(&[completers::setting]),
2767− },
2768− TypableCommand {
2769− name: "sort",
2770− aliases: &[],
2771− doc: "Sort ranges in selection.",
2772− fun: sort,
2773− signature: CommandSignature::none(),
2774− },
2775− TypableCommand {
2776− name: "rsort",
2777− aliases: &[],
2778− doc: "Sort ranges in selection in reverse order.",
2779− fun: sort_reverse,
2780− signature: CommandSignature::none(),
2781− },
2782− TypableCommand {
2783− name: "reflow",
2784− aliases: &[],
2785− doc: "Hard-wrap the current selection of lines to a given width.",
2786− fun: reflow,
2787− signature: CommandSignature::none(),
2788− },
2789− TypableCommand {
2790− name: "tree-sitter-subtree",
2791− aliases: &["ts-subtree"],
2792− doc: "Display tree sitter subtree under cursor, primarily for debugging queries.",
2793− fun: tree_sitter_subtree,
2794− signature: CommandSignature::none(),
2795− },
2796− TypableCommand {
2797− name: "config-reload",
2798− aliases: &[],
2799− doc: "Refresh user config.",
2800− fun: refresh_config,
2801− signature: CommandSignature::none(),
2802− },
2803− TypableCommand {
2804− name: "config-open",
2805− aliases: &[],
2806− doc: "Open the user config.toml file.",
2807− fun: open_config,
2808− signature: CommandSignature::none(),
2809− },
2810− TypableCommand {
2811− name: "config-open-workspace",
2812− aliases: &[],
2813− doc: "Open the workspace config.toml file.",
2814− fun: open_workspace_config,
2815− signature: CommandSignature::none(),
2816− },
2817− TypableCommand {
2818− name: "log-open",
2819− aliases: &[],
2820− doc: "Open the helix log file.",
2821− fun: open_log,
2822− signature: CommandSignature::none(),
2823− },
2824− TypableCommand {
2825− name: "insert-output",
2826− aliases: &[],
2827− doc: "Run shell command, inserting output before each selection.",
2828− fun: insert_output,
2829− signature: CommandSignature::none(),
2830− },
2831− TypableCommand {
2832− name: "append-output",
2833− aliases: &[],
2834− doc: "Run shell command, appending output after each selection.",
2835− fun: append_output,
2836− signature: CommandSignature::none(),
2837− },
2838− TypableCommand {
2839− name: "pipe",
2840− aliases: &[],
2841− doc: "Pipe each selection to the shell command.",
2842− fun: pipe,
2843− signature: CommandSignature::none(),
2844− },
2845− TypableCommand {
2846− name: "pipe-to",
2847− aliases: &[],
2848− doc: "Pipe each selection to the shell command, ignoring output.",
2849− fun: pipe_to,
2850− signature: CommandSignature::none(),
2851− },
2852− TypableCommand {
2853− name: "run-shell-command",
2854− aliases: &["sh"],
2855− doc: "Run a shell command",
2856− fun: run_shell_command,
2857− signature: CommandSignature::all(completers::filename)
2858− },
2859− TypableCommand {
2860− name: "reset-diff-change",
2861− aliases: &["diffget", "diffg"],
2862− doc: "Reset the diff change at the cursor position.",
2863− fun: reset_diff_change,
2864− signature: CommandSignature::none(),
2865− },
2866− TypableCommand {
2867− name: "clear-register",
2868− aliases: &[],
2869− doc: "Clear given register. If no argument is provided, clear all registers.",
2870− fun: clear_register,
2871− signature: CommandSignature::none(),
2872− },
2873− ];
2486+ TypableCommand {
2487+ name: "quit",
2488+ aliases: &["q"],
2489+ doc: "Close the current view.",
2490+ fun: quit,
2491+ signature: CommandSignature::none(),
2492+ },
2493+ TypableCommand {
2494+ name: "quit!",
2495+ aliases: &["q!"],
2496+ doc: "Force close the current view, ignoring unsaved changes.",
2497+ fun: force_quit,
2498+ signature: CommandSignature::none(),
2499+ },
2500+ TypableCommand {
2501+ name: "open",
2502+ aliases: &["o"],
2503+ doc: "Open a file from disk into the current view.",
2504+ fun: open,
2505+ signature: CommandSignature::all(completers::filename),
2506+ },
2507+ TypableCommand {
2508+ name: "buffer-close",
2509+ aliases: &["bc", "bclose"],
2510+ doc: "Close the current buffer.",
2511+ fun: buffer_close,
2512+ signature: CommandSignature::all(completers::buffer),
2513+ },
2514+ TypableCommand {
2515+ name: "buffer-close!",
2516+ aliases: &["bc!", "bclose!"],
2517+ doc: "Close the current buffer forcefully, ignoring unsaved changes.",
2518+ fun: force_buffer_close,
2519+ signature: CommandSignature::all(completers::buffer)
2520+ },
2521+ TypableCommand {
2522+ name: "buffer-close-others",
2523+ aliases: &["bco", "bcloseother"],
2524+ doc: "Close all buffers but the currently focused one.",
2525+ fun: buffer_close_others,
2526+ signature: CommandSignature::none(),
2527+ },
2528+ TypableCommand {
2529+ name: "buffer-close-others!",
2530+ aliases: &["bco!", "bcloseother!"],
2531+ doc: "Force close all buffers but the currently focused one.",
2532+ fun: force_buffer_close_others,
2533+ signature: CommandSignature::none(),
2534+ },
2535+ TypableCommand {
2536+ name: "buffer-close-all",
2537+ aliases: &["bca", "bcloseall"],
2538+ doc: "Close all buffers without quitting.",
2539+ fun: buffer_close_all,
2540+ signature: CommandSignature::none(),
2541+ },
2542+ TypableCommand {
2543+ name: "buffer-close-all!",
2544+ aliases: &["bca!", "bcloseall!"],
2545+ doc: "Force close all buffers ignoring unsaved changes without quitting.",
2546+ fun: force_buffer_close_all,
2547+ signature: CommandSignature::none(),
2548+ },
2549+ TypableCommand {
2550+ name: "buffer-next",
2551+ aliases: &["bn", "bnext"],
2552+ doc: "Goto next buffer.",
2553+ fun: buffer_next,
2554+ signature: CommandSignature::none(),
2555+ },
2556+ TypableCommand {
2557+ name: "buffer-previous",
2558+ aliases: &["bp", "bprev"],
2559+ doc: "Goto previous buffer.",
2560+ fun: buffer_previous,
2561+ signature: CommandSignature::none(),
2562+ },
2563+ TypableCommand {
2564+ name: "write",
2565+ aliases: &["w"],
2566+ doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)",
2567+ fun: write,
2568+ signature: CommandSignature::positional(&[completers::filename]),
2569+ },
2570+ TypableCommand {
2571+ name: "write!",
2572+ aliases: &["w!"],
2573+ doc: "Force write changes to disk creating necessary subdirectories. Accepts an optional path (:write! some/path.txt)",
2574+ fun: force_write,
2575+ signature: CommandSignature::positional(&[completers::filename]),
2576+ },
2577+ TypableCommand {
2578+ name: "write-buffer-close",
2579+ aliases: &["wbc"],
2580+ doc: "Write changes to disk and closes the buffer. Accepts an optional path (:write-buffer-close some/path.txt)",
2581+ fun: write_buffer_close,
2582+ signature: CommandSignature::positional(&[completers::filename]),
2583+ },
2584+ TypableCommand {
2585+ name: "write-buffer-close!",
2586+ aliases: &["wbc!"],
2587+ doc: "Force write changes to disk creating necessary subdirectories and closes the buffer. Accepts an optional path (:write-buffer-close! some/path.txt)",
2588+ fun: force_write_buffer_close,
2589+ signature: CommandSignature::positional(&[completers::filename]),
2590+ },
2591+ TypableCommand {
2592+ name: "new",
2593+ aliases: &["n"],
2594+ doc: "Create a new scratch buffer.",
2595+ fun: new_file,
2596+ signature: CommandSignature::none(),
2597+ },
2598+ TypableCommand {
2599+ name: "format",
2600+ aliases: &["fmt"],
2601+ doc: "Format the file using the LSP formatter.",
2602+ fun: format,
2603+ signature: CommandSignature::none(),
2604+ },
2605+ TypableCommand {
2606+ name: "indent-style",
2607+ aliases: &[],
2608+ doc: "Set the indentation style for editing. ('t' for tabs or 1-16 for number of spaces.)",
2609+ fun: set_indent_style,
2610+ signature: CommandSignature::none(),
2611+ },
2612+ TypableCommand {
2613+ name: "line-ending",
2614+ aliases: &[],
2615+ #[cfg(not(feature = "unicode-lines"))]
2616+ doc: "Set the document's default line ending. Options: crlf, lf.",
2617+ #[cfg(feature = "unicode-lines")]
2618+ doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.",
2619+ fun: set_line_ending,
2620+ signature: CommandSignature::none(),
2621+ },
2622+ TypableCommand {
2623+ name: "earlier",
2624+ aliases: &["ear"],
2625+ doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.",
2626+ fun: earlier,
2627+ signature: CommandSignature::none(),
2628+ },
2629+ TypableCommand {
2630+ name: "later",
2631+ aliases: &["lat"],
2632+ doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.",
2633+ fun: later,
2634+ signature: CommandSignature::none(),
2635+ },
2636+ TypableCommand {
2637+ name: "write-quit",
2638+ aliases: &["wq", "x"],
2639+ doc: "Write changes to disk and close the current view. Accepts an optional path (:wq some/path.txt)",
2640+ fun: write_quit,
2641+ signature: CommandSignature::positional(&[completers::filename]),
2642+ },
2643+ TypableCommand {
2644+ name: "write-quit!",
2645+ aliases: &["wq!", "x!"],
2646+ doc: "Write changes to disk and close the current view forcefully. Accepts an optional path (:wq! some/path.txt)",
2647+ fun: force_write_quit,
2648+ signature: CommandSignature::positional(&[completers::filename]),
2649+ },
2650+ TypableCommand {
2651+ name: "write-all",
2652+ aliases: &["wa"],
2653+ doc: "Write changes from all buffers to disk.",
2654+ fun: write_all,
2655+ signature: CommandSignature::none(),
2656+ },
2657+ TypableCommand {
2658+ name: "write-all!",
2659+ aliases: &["wa!"],
2660+ doc: "Forcefully write changes from all buffers to disk creating necessary subdirectories.",
2661+ fun: force_write_all,
2662+ signature: CommandSignature::none(),
2663+ },
2664+ TypableCommand {
2665+ name: "write-quit-all",
2666+ aliases: &["wqa", "xa"],
2667+ doc: "Write changes from all buffers to disk and close all views.",
2668+ fun: write_all_quit,
2669+ signature: CommandSignature::none(),
2670+ },
2671+ TypableCommand {
2672+ name: "write-quit-all!",
2673+ aliases: &["wqa!", "xa!"],
2674+ doc: "Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes).",
2675+ fun: force_write_all_quit,
2676+ signature: CommandSignature::none(),
2677+ },
2678+ TypableCommand {
2679+ name: "quit-all",
2680+ aliases: &["qa"],
2681+ doc: "Close all views.",
2682+ fun: quit_all,
2683+ signature: CommandSignature::none(),
2684+ },
2685+ TypableCommand {
2686+ name: "quit-all!",
2687+ aliases: &["qa!"],
2688+ doc: "Force close all views ignoring unsaved changes.",
2689+ fun: force_quit_all,
2690+ signature: CommandSignature::none(),
2691+ },
2692+ TypableCommand {
2693+ name: "cquit",
2694+ aliases: &["cq"],
2695+ doc: "Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2).",
2696+ fun: cquit,
2697+ signature: CommandSignature::none(),
2698+ },
2699+ TypableCommand {
2700+ name: "cquit!",
2701+ aliases: &["cq!"],
2702+ doc: "Force quit with exit code (default 1) ignoring unsaved changes. Accepts an optional integer exit code (:cq! 2).",
2703+ fun: force_cquit,
2704+ signature: CommandSignature::none(),
2705+ },
2706+ TypableCommand {
2707+ name: "theme",
2708+ aliases: &[],
2709+ doc: "Change the editor theme (show current theme if no name specified).",
2710+ fun: theme,
2711+ signature: CommandSignature::positional(&[completers::theme]),
2712+ },
2713+ TypableCommand {
2714+ name: "yank-join",
2715+ aliases: &[],
2716+ doc: "Yank joined selections. A separator can be provided as first argument. Default value is newline.",
2717+ fun: yank_joined,
2718+ signature: CommandSignature::none(),
2719+ },
2720+ TypableCommand {
2721+ name: "clipboard-yank",
2722+ aliases: &[],
2723+ doc: "Yank main selection into system clipboard.",
2724+ fun: yank_main_selection_to_clipboard,
2725+ signature: CommandSignature::none(),
2726+ },
2727+ TypableCommand {
2728+ name: "clipboard-yank-join",
2729+ aliases: &[],
2730+ doc: "Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
2731+ fun: yank_joined_to_clipboard,
2732+ signature: CommandSignature::none(),
2733+ },
2734+ TypableCommand {
2735+ name: "primary-clipboard-yank",
2736+ aliases: &[],
2737+ doc: "Yank main selection into system primary clipboard.",
2738+ fun: yank_main_selection_to_primary_clipboard,
2739+ signature: CommandSignature::none(),
2740+ },
2741+ TypableCommand {
2742+ name: "primary-clipboard-yank-join",
2743+ aliases: &[],
2744+ doc: "Yank joined selections into system primary clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
2745+ fun: yank_joined_to_primary_clipboard,
2746+ signature: CommandSignature::none(),
2747+ },
2748+ TypableCommand {
2749+ name: "clipboard-paste-after",
2750+ aliases: &[],
2751+ doc: "Paste system clipboard after selections.",
2752+ fun: paste_clipboard_after,
2753+ signature: CommandSignature::none(),
2754+ },
2755+ TypableCommand {
2756+ name: "clipboard-paste-before",
2757+ aliases: &[],
2758+ doc: "Paste system clipboard before selections.",
2759+ fun: paste_clipboard_before,
2760+ signature: CommandSignature::none(),
2761+ },
2762+ TypableCommand {
2763+ name: "clipboard-paste-replace",
2764+ aliases: &[],
2765+ doc: "Replace selections with content of system clipboard.",
2766+ fun: replace_selections_with_clipboard,
2767+ signature: CommandSignature::none(),
2768+ },
2769+ TypableCommand {
2770+ name: "primary-clipboard-paste-after",
2771+ aliases: &[],
2772+ doc: "Paste primary clipboard after selections.",
2773+ fun: paste_primary_clipboard_after,
2774+ signature: CommandSignature::none(),
2775+ },
2776+ TypableCommand {
2777+ name: "primary-clipboard-paste-before",
2778+ aliases: &[],
2779+ doc: "Paste primary clipboard before selections.",
2780+ fun: paste_primary_clipboard_before,
2781+ signature: CommandSignature::none(),
2782+ },
2783+ TypableCommand {
2784+ name: "primary-clipboard-paste-replace",
2785+ aliases: &[],
2786+ doc: "Replace selections with content of system primary clipboard.",
2787+ fun: replace_selections_with_primary_clipboard,
2788+ signature: CommandSignature::none(),
2789+ },
2790+ TypableCommand {
2791+ name: "show-clipboard-provider",
2792+ aliases: &[],
2793+ doc: "Show clipboard provider name in status bar.",
2794+ fun: show_clipboard_provider,
2795+ signature: CommandSignature::none(),
2796+ },
2797+ TypableCommand {
2798+ name: "change-current-directory",
2799+ aliases: &["cd"],
2800+ doc: "Change the current working directory.",
2801+ fun: change_current_directory,
2802+ signature: CommandSignature::positional(&[completers::directory]),
2803+ },
2804+ TypableCommand {
2805+ name: "show-directory",
2806+ aliases: &["pwd"],
2807+ doc: "Show the current working directory.",
2808+ fun: show_current_directory,
2809+ signature: CommandSignature::none(),
2810+ },
2811+ TypableCommand {
2812+ name: "encoding",
2813+ aliases: &[],
2814+ doc: "Set encoding. Based on `https://encoding.spec.whatwg.org`.",
2815+ fun: set_encoding,
2816+ signature: CommandSignature::none(),
2817+ },
2818+ TypableCommand {
2819+ name: "character-info",
2820+ aliases: &["char"],
2821+ doc: "Get info about the character under the primary cursor.",
2822+ fun: get_character_info,
2823+ signature: CommandSignature::none(),
2824+ },
2825+ TypableCommand {
2826+ name: "reload",
2827+ aliases: &["rl"],
2828+ doc: "Discard changes and reload from the source file.",
2829+ fun: reload,
2830+ signature: CommandSignature::none(),
2831+ },
2832+ TypableCommand {
2833+ name: "reload-all",
2834+ aliases: &["rla"],
2835+ doc: "Discard changes and reload all documents from the source files.",
2836+ fun: reload_all,
2837+ signature: CommandSignature::none(),
2838+ },
2839+ TypableCommand {
2840+ name: "update",
2841+ aliases: &["u"],
2842+ doc: "Write changes only if the file has been modified.",
2843+ fun: update,
2844+ signature: CommandSignature::none(),
2845+ },
2846+ TypableCommand {
2847+ name: "lsp-workspace-command",
2848+ aliases: &[],
2849+ doc: "Open workspace command picker",
2850+ fun: lsp_workspace_command,
2851+ signature: CommandSignature::positional(&[completers::lsp_workspace_command]),
2852+ },
2853+ TypableCommand {
2854+ name: "lsp-restart",
2855+ aliases: &[],
2856+ doc: "Restarts the language servers used by the current doc",
2857+ fun: lsp_restart,
2858+ signature: CommandSignature::none(),
2859+ },
2860+ TypableCommand {
2861+ name: "lsp-stop",
2862+ aliases: &[],
2863+ doc: "Stops the language servers that are used by the current doc",
2864+ fun: lsp_stop,
2865+ signature: CommandSignature::none(),
2866+ },
2867+ TypableCommand {
2868+ name: "tree-sitter-scopes",
2869+ aliases: &[],
2870+ doc: "Display tree sitter scopes, primarily for theming and development.",
2871+ fun: tree_sitter_scopes,
2872+ signature: CommandSignature::none(),
2873+ },
2874+ TypableCommand {
2875+ name: "tree-sitter-highlight-name",
2876+ aliases: &[],
2877+ doc: "Display name of tree-sitter highlight scope under the cursor.",
2878+ fun: tree_sitter_highlight_name,
2879+ signature: CommandSignature::none(),
2880+ },
2881+ TypableCommand {
2882+ name: "debug-start",
2883+ aliases: &["dbg"],
2884+ doc: "Start a debug session from a given template with given parameters.",
2885+ fun: debug_start,
2886+ signature: CommandSignature::none(),
2887+ },
2888+ TypableCommand {
2889+ name: "debug-remote",
2890+ aliases: &["dbg-tcp"],
2891+ doc: "Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters.",
2892+ fun: debug_remote,
2893+ signature: CommandSignature::none(),
2894+ },
2895+ TypableCommand {
2896+ name: "debug-eval",
2897+ aliases: &[],
2898+ doc: "Evaluate expression in current debug context.",
2899+ fun: debug_eval,
2900+ signature: CommandSignature::none(),
2901+ },
2902+ TypableCommand {
2903+ name: "vsplit",
2904+ aliases: &["vs"],
2905+ doc: "Open the file in a vertical split.",
2906+ fun: vsplit,
2907+ signature: CommandSignature::all(completers::filename)
2908+ },
2909+ TypableCommand {
2910+ name: "vsplit-new",
2911+ aliases: &["vnew"],
2912+ doc: "Open a scratch buffer in a vertical split.",
2913+ fun: vsplit_new,
2914+ signature: CommandSignature::none(),
2915+ },
2916+ TypableCommand {
2917+ name: "hsplit",
2918+ aliases: &["hs", "sp"],
2919+ doc: "Open the file in a horizontal split.",
2920+ fun: hsplit,
2921+ signature: CommandSignature::all(completers::filename)
2922+ },
2923+ TypableCommand {
2924+ name: "hsplit-new",
2925+ aliases: &["hnew"],
2926+ doc: "Open a scratch buffer in a horizontal split.",
2927+ fun: hsplit_new,
2928+ signature: CommandSignature::none(),
2929+ },
2930+ TypableCommand {
2931+ name: "tutor",
2932+ aliases: &[],
2933+ doc: "Open the tutorial.",
2934+ fun: tutor,
2935+ signature: CommandSignature::none(),
2936+ },
2937+ TypableCommand {
2938+ name: "goto",
2939+ aliases: &["g"],
2940+ doc: "Goto line number.",
2941+ fun: goto_line_number,
2942+ signature: CommandSignature::none(),
2943+ },
2944+ TypableCommand {
2945+ name: "set-language",
2946+ aliases: &["lang"],
2947+ doc: "Set the language of current buffer (show current language if no value specified).",
2948+ fun: language,
2949+ signature: CommandSignature::positional(&[completers::language]),
2950+ },
2951+ TypableCommand {
2952+ name: "set-option",
2953+ aliases: &["set"],
2954+ doc: "Set a config option at runtime.\nFor example to disable smart case search, use `:set search.smart-case false`.",
2955+ fun: set_option,
2956+ // TODO: Add support for completion of the options value(s), when appropriate.
2957+ signature: CommandSignature::positional(&[completers::setting]),
2958+ },
2959+ TypableCommand {
2960+ name: "toggle-option",
2961+ aliases: &["toggle"],
2962+ doc: "Toggle a boolean config option at runtime.\nFor example to toggle smart case search, use `:toggle search.smart-case`.",
2963+ fun: toggle_option,
2964+ signature: CommandSignature::positional(&[completers::setting]),
2965+ },
2966+ TypableCommand {
2967+ name: "get-option",
2968+ aliases: &["get"],
2969+ doc: "Get the current value of a config option.",
2970+ fun: get_option,
2971+ signature: CommandSignature::positional(&[completers::setting]),
2972+ },
2973+ TypableCommand {
2974+ name: "sort",
2975+ aliases: &[],
2976+ doc: "Sort ranges in selection.",
2977+ fun: sort,
2978+ signature: CommandSignature::none(),
2979+ },
2980+ TypableCommand {
2981+ name: "rsort",
2982+ aliases: &[],
2983+ doc: "Sort ranges in selection in reverse order.",
2984+ fun: sort_reverse,
2985+ signature: CommandSignature::none(),
2986+ },
2987+ TypableCommand {
2988+ name: "reflow",
2989+ aliases: &[],
2990+ doc: "Hard-wrap the current selection of lines to a given width.",
2991+ fun: reflow,
2992+ signature: CommandSignature::none(),
2993+ },
2994+ TypableCommand {
2995+ name: "tree-sitter-subtree",
2996+ aliases: &["ts-subtree"],
2997+ doc: "Display tree sitter subtree under cursor, primarily for debugging queries.",
2998+ fun: tree_sitter_subtree,
2999+ signature: CommandSignature::none(),
3000+ },
3001+ TypableCommand {
3002+ name: "config-reload",
3003+ aliases: &[],
3004+ doc: "Refresh user config.",
3005+ fun: refresh_config,
3006+ signature: CommandSignature::none(),
3007+ },
3008+ TypableCommand {
3009+ name: "config-open",
3010+ aliases: &[],
3011+ doc: "Open the user config.toml file.",
3012+ fun: open_config,
3013+ signature: CommandSignature::none(),
3014+ },
3015+ TypableCommand {
3016+ name: "config-open-workspace",
3017+ aliases: &[],
3018+ doc: "Open the workspace config.toml file.",
3019+ fun: open_workspace_config,
3020+ signature: CommandSignature::none(),
3021+ },
3022+ TypableCommand {
3023+ name: "log-open",
3024+ aliases: &[],
3025+ doc: "Open the helix log file.",
3026+ fun: open_log,
3027+ signature: CommandSignature::none(),
3028+ },
3029+ TypableCommand {
3030+ name: "insert-output",
3031+ aliases: &[],
3032+ doc: "Run shell command, inserting output before each selection.",
3033+ fun: insert_output,
3034+ signature: CommandSignature::none(),
3035+ },
3036+ TypableCommand {
3037+ name: "append-output",
3038+ aliases: &[],
3039+ doc: "Run shell command, appending output after each selection.",
3040+ fun: append_output,
3041+ signature: CommandSignature::none(),
3042+ },
3043+ TypableCommand {
3044+ name: "pipe",
3045+ aliases: &[],
3046+ doc: "Pipe each selection to the shell command.",
3047+ fun: pipe,
3048+ signature: CommandSignature::none(),
3049+ },
3050+ TypableCommand {
3051+ name: "pipe-to",
3052+ aliases: &[],
3053+ doc: "Pipe each selection to the shell command, ignoring output.",
3054+ fun: pipe_to,
3055+ signature: CommandSignature::none(),
3056+ },
3057+ TypableCommand {
3058+ name: "run-shell-command",
3059+ aliases: &["sh"],
3060+ doc: "Run a shell command",
3061+ fun: run_shell_command,
3062+ signature: CommandSignature::all(completers::filename)
3063+ },
3064+ TypableCommand {
3065+ name: "reset-diff-change",
3066+ aliases: &["diffget", "diffg"],
3067+ doc: "Reset the diff change at the cursor position.",
3068+ fun: reset_diff_change,
3069+ signature: CommandSignature::none(),
3070+ },
3071+ TypableCommand {
3072+ name: "clear-register",
3073+ aliases: &[],
3074+ doc: "Clear given register. If no argument is provided, clear all registers.",
3075+ fun: clear_register,
3076+ signature: CommandSignature::none(),
3077+ },
3078+ TypableCommand {
3079+ name: "redraw",
3080+ aliases: &[],
3081+ doc: "Clear and re-render the whole UI",
3082+ fun: redraw,
3083+ signature: CommandSignature::none(),
3084+ },
3085+ TypableCommand {
3086+ name: "move",
3087+ aliases: &[],
3088+ doc: "Move the current buffer and its corresponding file to a different path",
3089+ fun: move_buffer,
3090+ signature: CommandSignature::positional(&[completers::filename]),
3091+ },
3092+];
28743093
28753094pub static TYPABLE_COMMAND_MAP: Lazy<HashMap<&'static str, &'static TypableCommand>> =
28763095 Lazy::new(|| {
@@ -2889,28 +3108,18 @@ pub(super) fn command_mode(cx: &mut Context) {
28893108 ":".into(),
28903109 Some(':'),
28913110 |editor: &Editor, input: &str| {
2892− static FUZZY_MATCHER: Lazy<fuzzy_matcher::skim::SkimMatcherV2> =
2893− Lazy::new(fuzzy_matcher::skim::SkimMatcherV2::default);
2894−
28953111 let shellwords = Shellwords::from(input);
28963112 let words = shellwords.words();
28973113
28983114 if words.is_empty() || (words.len() == 1 && !shellwords.ends_with_whitespace()) {
2899− // If the command has not been finished yet, complete commands.
2900− let mut matches: Vec<_> = typed::TYPABLE_COMMAND_LIST
2901− .iter()
2902− .filter_map(|command| {
2903− FUZZY_MATCHER
2904− .fuzzy_match(command.name, input)
2905− .map(|score| (command.name, score))
2906− })
2907− .collect();
2908−
2909− matches.sort_unstable_by_key(|(_file, score)| std::cmp::Reverse(*score));
2910− matches
2911− .into_iter()
2912− .map(|(name, _)| (0.., name.into()))
2913− .collect()
3115+ fuzzy_match(
3116+ input,
3117+ TYPABLE_COMMAND_LIST.iter().map(|command| command.name),
3118+ false,
3119+ )
3120+ .into_iter()
3121+ .map(|(name, _)| (0.., name.into()))
3122+ .collect()
29143123 } else {
29153124 // Otherwise, use the command's completer and the last shellword
29163125 // as completion input.
helix-term/src/compositor.rs+12
@@ -16,6 +16,7 @@ pub enum EventResult {
1616}
1717
1818use crate::job::Jobs;
19+use crate::ui::picker;
1920use helix_view::Editor;
2021
2122pub use helix_view::input::Event;
@@ -79,6 +80,7 @@ pub struct Compositor {
7980 area: Rect,
8081
8182 pub(crate) last_picker: Option<Box<dyn Component>>,
83+ pub(crate) full_redraw: bool,
8284}
8385
8486impl Compositor {
@@ -87,6 +89,7 @@ impl Compositor {
8789 layers: Vec::new(),
8890 area,
8991 last_picker: None,
92+ full_redraw: false,
9093 }
9194 }
9295
@@ -100,6 +103,11 @@ impl Compositor {
100103
101104 /// Add a layer to be rendered in front of all existing layers.
102105 pub fn push(&mut self, mut layer: Box<dyn Component>) {
106+ // immediately clear last_picker field to avoid excessive memory
107+ // consumption for picker with many items
108+ if layer.id() == Some(picker::ID) {
109+ self.last_picker = None;
110+ }
103111 let size = self.size();
104112 // trigger required_size on init
105113 layer.required_size((size.width, size.height));
@@ -200,6 +208,10 @@ impl Compositor {
200208 .find(|component| component.id() == Some(id))
201209 .and_then(|component| component.as_any_mut().downcast_mut())
202210 }
211+
212+ pub fn need_full_redraw(&mut self) {
213+ self.full_redraw = true;
214+ }
203215}
204216
205217// View casting, taken straight from Cursive
helix-term/src/health.rs+44−16
@@ -181,8 +181,8 @@ pub fn languages_all() -> std::io::Result<()> {
181181 .language
182182 .sort_unstable_by_key(|l| l.language_id.clone());
183183
184− let check_binary = |cmd: Option<String>| match cmd {
185− Some(cmd) => match which::which(&cmd) {
184+ let check_binary = |cmd: Option<&str>| match cmd {
185+ Some(cmd) => match which::which(cmd) {
186186 Ok(_) => column(&format!("✓ {}", cmd), Color::Green),
187187 Err(_) => column(&format!("✘ {}", cmd), Color::Red),
188188 },
@@ -192,17 +192,15 @@ pub fn languages_all() -> std::io::Result<()> {
192192 for lang in &syn_loader_conf.language {
193193 column(&lang.language_id, Color::Reset);
194194
195− // TODO multiple language servers (check binary for each supported language server, not just the first)
196−
197− let lsp = lang.language_servers.first().and_then(|ls| {
195+ let mut cmds = lang.language_servers.iter().filter_map(|ls| {
198196 syn_loader_conf
199197 .language_server
200198 .get(&ls.name)
201− .map(|config| config.command.clone())
199+ .map(|config| config.command.as_str())
202200 });
203− check_binary(lsp);
201+ check_binary(cmds.next());
204202
205− let dap = lang.debugger.as_ref().map(|dap| dap.command.to_string());
203+ let dap = lang.debugger.as_ref().map(|dap| dap.command.as_str());
206204 check_binary(dap);
207205
208206 for ts_feat in TsFeature::all() {
@@ -213,6 +211,12 @@ pub fn languages_all() -> std::io::Result<()> {
213211 }
214212
215213 writeln!(stdout)?;
214+
215+ for cmd in cmds {
216+ column("", Color::Reset);
217+ check_binary(Some(cmd));
218+ writeln!(stdout)?;
219+ }
216220 }
217221
218222 Ok(())
@@ -268,15 +272,12 @@ pub fn language(lang_str: String) -> std::io::Result<()> {
268272 }
269273 };
270274
271− // TODO multiple language servers
272− probe_protocol(
275+ probe_protocols(
273276 "language server",
274− lang.language_servers.first().and_then(|ls| {
275− syn_loader_conf
276− .language_server
277− .get(&ls.name)
278− .map(|config| config.command.clone())
279− }),
277+ lang.language_servers
278+ .iter()
279+ .filter_map(|ls| syn_loader_conf.language_server.get(&ls.name))
280+ .map(|config| config.command.as_str()),
280281 )?;
281282
282283 probe_protocol(
@@ -291,6 +292,33 @@ pub fn language(lang_str: String) -> std::io::Result<()> {
291292 Ok(())
292293}
293294
295+/// Display diagnostics about multiple LSPs and DAPs.
296+fn probe_protocols<'a, I: Iterator<Item = &'a str> + 'a>(
297+ protocol_name: &str,
298+ server_cmds: I,
299+) -> std::io::Result<()> {
300+ let stdout = std::io::stdout();
301+ let mut stdout = stdout.lock();
302+ let mut server_cmds = server_cmds.peekable();
303+
304+ write!(stdout, "Configured {}s:", protocol_name)?;
305+ if server_cmds.peek().is_none() {
306+ writeln!(stdout, "{}", " None".yellow())?;
307+ return Ok(());
308+ }
309+ writeln!(stdout)?;
310+
311+ for cmd in server_cmds {
312+ let (path, icon) = match which::which(cmd) {
313+ Ok(path) => (path.display().to_string().green(), "✓".green()),
314+ Err(_) => (format!("'{}' not found in $PATH", cmd).red(), "✘".red()),
315+ };
316+ writeln!(stdout, " {} {}: {}", icon, cmd, path)?;
317+ }
318+
319+ Ok(())
320+}
321+
294322/// Display diagnostics about LSP and DAP.
295323fn probe_protocol(protocol_name: &str, server_cmd: Option<String>) -> std::io::Result<()> {
296324 let stdout = std::io::stdout();
helix-term/src/keymap.rs+14−14
@@ -401,14 +401,14 @@ mod tests {
401401 fn merge_partial_keys() {
402402 let keymap = hashmap! {
403403 Mode::Normal => keymap!({ "Normal mode"
404− "i" => normal_mode,
405− "无" => insert_mode,
406− "z" => jump_backward,
407− "g" => { "Merge into goto mode"
408− "$" => goto_line_end,
409− "g" => delete_char_forward,
410− },
411− })
404+ "i" => normal_mode,
405+ "无" => insert_mode,
406+ "z" => jump_backward,
407+ "g" => { "Merge into goto mode"
408+ "$" => goto_line_end,
409+ "g" => delete_char_forward,
410+ },
411+ })
412412 };
413413 let mut merged_keyamp = default();
414414 merge_keys(&mut merged_keyamp, keymap.clone());
@@ -474,13 +474,13 @@ mod tests {
474474 fn order_should_be_set() {
475475 let keymap = hashmap! {
476476 Mode::Normal => keymap!({ "Normal mode"
477− "space" => { ""
478− "s" => { ""
479− "v" => vsplit,
480− "c" => hsplit,
481− },
477+ "space" => { ""
478+ "s" => { ""
479+ "v" => vsplit,
480+ "c" => hsplit,
482481 },
483− })
482+ },
483+ })
484484 };
485485 let mut merged_keyamp = default();
486486 merge_keys(&mut merged_keyamp, keymap.clone());
helix-term/src/main.rs+17−1
@@ -66,6 +66,8 @@ FLAGS:
6666 -V, --version Prints version information
6767 --vsplit Splits all given files vertically into different windows
6868 --hsplit Splits all given files horizontally into different windows
69+ -w, --working-dir <path> Specify an initial working directory
70+ +N Open the first given file at line number N
6971",
7072 env!("CARGO_PKG_NAME"),
7173 VERSION_AND_GIT_HASH,
@@ -74,7 +76,7 @@ FLAGS:
7476 helix_loader::default_log_file().display(),
7577 );
7678
77− let args = Args::parse_args().context("could not parse arguments")?;
79+ let mut args = Args::parse_args().context("could not parse arguments")?;
7880
7981 helix_loader::initialize_config_file(args.config_file.clone());
8082 helix_loader::initialize_log_file(args.log_file.clone());
@@ -114,6 +116,20 @@ FLAGS:
114116
115117 setup_logging(args.verbosity).context("failed to initialize logging")?;
116118
119+ // Before setting the working directory, resolve all the paths in args.files
120+ for (path, _) in args.files.iter_mut() {
121+ *path = helix_core::path::get_canonicalized_path(path);
122+ }
123+
124+ // NOTE: Set the working directory early so the correct configuration is loaded. Be aware that
125+ // Application::new() depends on this logic so it must be updated if this changes.
126+ if let Some(path) = &args.working_directory {
127+ helix_loader::set_current_working_dir(path)?;
128+ } else if let Some((path, _)) = args.files.first().filter(|p| p.0.is_dir()) {
129+ // If the first file is a directory, it will be the working directory unless -w was specified
130+ helix_loader::set_current_working_dir(path)?;
131+ }
132+
117133 let config = match Config::load_default() {
118134 Ok(config) => config,
119135 Err(ConfigLoadError::Error(err)) if err.kind() == std::io::ErrorKind::NotFound => {
helix-term/src/ui/completion.rs+17−1
@@ -2,6 +2,7 @@ use crate::compositor::{Component, Context, Event, EventResult};
22use helix_view::{
33 document::SavePoint,
44 editor::CompleteAction,
5+ graphics::Margin,
56 theme::{Modifier, Style},
67 ViewId,
78};
@@ -326,9 +327,18 @@ impl Completion {
326327 }
327328 };
328329 });
330+
331+ let margin = if editor.menu_border() {
332+ Margin::vertical(1)
333+ } else {
334+ Margin::none()
335+ };
336+
329337 let popup = Popup::new(Self::ID, menu)
330338 .with_scrollbar(false)
331− .ignore_escape_key(true);
339+ .ignore_escape_key(true)
340+ .margin(margin);
341+
332342 let mut completion = Self {
333343 popup,
334344 start_offset,
@@ -569,6 +579,12 @@ impl Component for Completion {
569579 // clear area
570580 let background = cx.editor.theme.get("ui.popup");
571581 surface.clear_with(doc_area, background);
582+
583+ if cx.editor.popup_border() {
584+ use tui::widgets::{Block, Borders, Widget};
585+ Widget::render(Block::default().borders(Borders::ALL), doc_area, surface);
586+ }
587+
572588 markdown_doc.render(doc_area, surface, cx);
573589 }
574590}
helix-term/src/ui/document.rs+60−24
@@ -97,7 +97,8 @@ pub fn render_document(
9797 doc: &Document,
9898 offset: ViewPosition,
9999 doc_annotations: &TextAnnotations,
100− highlight_iter: impl Iterator<Item = HighlightEvent>,
100+ syntax_highlight_iter: impl Iterator<Item = HighlightEvent>,
101+ overlay_highlight_iter: impl Iterator<Item = HighlightEvent>,
101102 theme: &Theme,
102103 line_decoration: &mut [Box<dyn LineDecoration + '_>],
103104 translated_positions: &mut [TranslatedPosition],
@@ -109,7 +110,8 @@ pub fn render_document(
109110 offset,
110111 &doc.text_format(viewport.width, Some(theme)),
111112 doc_annotations,
112− highlight_iter,
113+ syntax_highlight_iter,
114+ overlay_highlight_iter,
113115 theme,
114116 line_decoration,
115117 translated_positions,
@@ -157,7 +159,8 @@ pub fn render_text<'t>(
157159 offset: ViewPosition,
158160 text_fmt: &TextFormat,
159161 text_annotations: &TextAnnotations,
160− highlight_iter: impl Iterator<Item = HighlightEvent>,
162+ syntax_highlight_iter: impl Iterator<Item = HighlightEvent>,
163+ overlay_highlight_iter: impl Iterator<Item = HighlightEvent>,
161164 theme: &Theme,
162165 line_decorations: &mut [Box<dyn LineDecoration + '_>],
163166 translated_positions: &mut [TranslatedPosition],
@@ -178,10 +181,16 @@ pub fn render_text<'t>(
178181
179182 let (mut formatter, mut first_visible_char_idx) =
180183 DocumentFormatter::new_at_prev_checkpoint(text, text_fmt, text_annotations, offset.anchor);
181− let mut styles = StyleIter {
184+ let mut syntax_styles = StyleIter {
182185 text_style: renderer.text_style,
183186 active_highlights: Vec::with_capacity(64),
184− highlight_iter,
187+ highlight_iter: syntax_highlight_iter,
188+ theme,
189+ };
190+ let mut overlay_styles = StyleIter {
191+ text_style: Style::default(),
192+ active_highlights: Vec::with_capacity(64),
193+ highlight_iter: overlay_highlight_iter,
185194 theme,
186195 };
187196
@@ -193,7 +202,10 @@ pub fn render_text<'t>(
193202 };
194203 let mut is_in_indent_area = true;
195204 let mut last_line_indent_level = 0;
196− let mut style_span = styles
205+ let mut syntax_style_span = syntax_styles
206+ .next()
207+ .unwrap_or_else(|| (Style::default(), usize::MAX));
208+ let mut overlay_style_span = overlay_styles
197209 .next()
198210 .unwrap_or_else(|| (Style::default(), usize::MAX));
199211
@@ -221,9 +233,16 @@ pub fn render_text<'t>(
221233
222234 // skip any graphemes on visual lines before the block start
223235 if pos.row < row_off {
224− if char_pos >= style_span.1 {
225− style_span = if let Some(style_span) = styles.next() {
226− style_span
236+ if char_pos >= syntax_style_span.1 {
237+ syntax_style_span = if let Some(syntax_style_span) = syntax_styles.next() {
238+ syntax_style_span
239+ } else {
240+ break;
241+ }
242+ }
243+ if char_pos >= overlay_style_span.1 {
244+ overlay_style_span = if let Some(overlay_style_span) = overlay_styles.next() {
245+ overlay_style_span
227246 } else {
228247 break;
229248 }
@@ -260,8 +279,15 @@ pub fn render_text<'t>(
260279 }
261280
262281 // acquire the correct grapheme style
263− if char_pos >= style_span.1 {
264− style_span = styles.next().unwrap_or((Style::default(), usize::MAX));
282+ if char_pos >= syntax_style_span.1 {
283+ syntax_style_span = syntax_styles
284+ .next()
285+ .unwrap_or((Style::default(), usize::MAX));
286+ }
287+ if char_pos >= overlay_style_span.1 {
288+ overlay_style_span = overlay_styles
289+ .next()
290+ .unwrap_or((Style::default(), usize::MAX));
265291 }
266292 char_pos += grapheme.doc_chars();
267293
@@ -275,22 +301,25 @@ pub fn render_text<'t>(
275301 pos,
276302 );
277303
278− let grapheme_style = if let GraphemeSource::VirtualText { highlight } = grapheme.source {
279− let style = renderer.text_style;
280− if let Some(highlight) = highlight {
281− style.patch(theme.highlight(highlight.0))
304+ let (syntax_style, overlay_style) =
305+ if let GraphemeSource::VirtualText { highlight } = grapheme.source {
306+ let mut style = renderer.text_style;
307+ if let Some(highlight) = highlight {
308+ style = style.patch(theme.highlight(highlight.0))
309+ }
310+ (style, Style::default())
282311 } else {
283− style
284− }
285− } else {
286− style_span.0
287− };
312+ (syntax_style_span.0, overlay_style_span.0)
313+ };
288314
289− let virt = grapheme.is_virtual();
315+ let is_virtual = grapheme.is_virtual();
290316 renderer.draw_grapheme(
291317 grapheme.grapheme,
292− grapheme_style,
293− virt,
318+ GraphemeStyle {
319+ syntax_style,
320+ overlay_style,
321+ },
322+ is_virtual,
294323 &mut last_line_indent_level,
295324 &mut is_in_indent_area,
296325 pos,
@@ -322,6 +351,11 @@ pub struct TextRenderer<'a> {
322351 pub viewport: Rect,
323352}
324353
354+pub struct GraphemeStyle {
355+ syntax_style: Style,
356+ overlay_style: Style,
357+}
358+
325359impl<'a> TextRenderer<'a> {
326360 pub fn new(
327361 surface: &'a mut Surface,
@@ -395,7 +429,7 @@ impl<'a> TextRenderer<'a> {
395429 pub fn draw_grapheme(
396430 &mut self,
397431 grapheme: Grapheme,
398− mut style: Style,
432+ grapheme_style: GraphemeStyle,
399433 is_virtual: bool,
400434 last_indent_level: &mut usize,
401435 is_in_indent_area: &mut bool,
@@ -405,9 +439,11 @@ impl<'a> TextRenderer<'a> {
405439 let is_whitespace = grapheme.is_whitespace();
406440
407441 // TODO is it correct to apply the whitespace style to all unicode white spaces?
442+ let mut style = grapheme_style.syntax_style;
408443 if is_whitespace {
409444 style = style.patch(self.whitespace_style);
410445 }
446+ style = style.patch(grapheme_style.overlay_style);
411447
412448 let width = grapheme.width();
413449 let space = if is_virtual { " " } else { &self.space };
helix-term/src/ui/editor.rs+91−46
@@ -43,6 +43,8 @@ pub struct EditorView {
4343 pub(crate) last_insert: (commands::MappableCommand, Vec<InsertEvent>),
4444 pub(crate) completion: Option<Completion>,
4545 spinners: ProgressSpinners,
46+ /// Tracks if the terminal window is focused by reaction to terminal focus events
47+ terminal_focused: bool,
4648}
4749
4850#[derive(Debug, Clone)]
@@ -71,6 +73,7 @@ impl EditorView {
7173 last_insert: (commands::MappableCommand::normal_mode, Vec::new()),
7274 completion: None,
7375 spinners: ProgressSpinners::default(),
76+ terminal_focused: true,
7477 }
7578 }
7679
@@ -121,16 +124,20 @@ impl EditorView {
121124 line_decorations.push(Box::new(line_decoration));
122125 }
123126
124− let mut highlights =
127+ let syntax_highlights =
125128 Self::doc_syntax_highlights(doc, view.offset.anchor, inner.height, theme);
126− let overlay_highlights = Self::overlay_syntax_highlights(
129+
130+ let mut overlay_highlights =
131+ Self::empty_highlight_iter(doc, view.offset.anchor, inner.height);
132+ let overlay_syntax_highlights = Self::overlay_syntax_highlights(
127133 doc,
128134 view.offset.anchor,
129135 inner.height,
130136 &text_annotations,
131137 );
132− if !overlay_highlights.is_empty() {
133− highlights = Box::new(syntax::merge(highlights, overlay_highlights));
138+ if !overlay_syntax_highlights.is_empty() {
139+ overlay_highlights =
140+ Box::new(syntax::merge(overlay_highlights, overlay_syntax_highlights));
134141 }
135142
136143 for diagnostic in Self::doc_diagnostics_highlights(doc, theme) {
@@ -139,29 +146,28 @@ impl EditorView {
139146 if diagnostic.is_empty() {
140147 continue;
141148 }
142− highlights = Box::new(syntax::merge(highlights, diagnostic));
149+ overlay_highlights = Box::new(syntax::merge(overlay_highlights, diagnostic));
143150 }
144151
145− let highlights: Box<dyn Iterator<Item = HighlightEvent>> = if is_focused {
152+ if is_focused {
146153 let highlights = syntax::merge(
147− highlights,
154+ overlay_highlights,
148155 Self::doc_selection_highlights(
149156 editor.mode(),
150157 doc,
151158 view,
152159 theme,
153160 &config.cursor_shape,
161+ self.terminal_focused,
154162 ),
155163 );
156164 let focused_view_elements = Self::highlight_focused_view_elements(view, doc, theme);
157165 if focused_view_elements.is_empty() {
158− Box::new(highlights)
166+ overlay_highlights = Box::new(highlights)
159167 } else {
160− Box::new(syntax::merge(highlights, focused_view_elements))
168+ overlay_highlights = Box::new(syntax::merge(highlights, focused_view_elements))
161169 }
162− } else {
163− Box::new(highlights)
164− };
170+ }
165171
166172 let gutter_overflow = view.gutter_offset(doc) == 0;
167173 if !gutter_overflow {
@@ -171,7 +177,7 @@ impl EditorView {
171177 view,
172178 view.area,
173179 theme,
174− is_focused,
180+ is_focused & self.terminal_focused,
175181 &mut line_decorations,
176182 );
177183 }
@@ -194,7 +200,8 @@ impl EditorView {
194200 doc,
195201 view.offset,
196202 &text_annotations,
197− highlights,
203+ syntax_highlights,
204+ overlay_highlights,
198205 theme,
199206 &mut line_decorations,
200207 &mut translated_positions,
@@ -254,27 +261,39 @@ impl EditorView {
254261 .for_each(|area| surface.set_style(area, ruler_theme))
255262 }
256263
257− pub fn overlay_syntax_highlights(
264+ fn viewport_byte_range(
265+ text: helix_core::RopeSlice,
266+ row: usize,
267+ height: u16,
268+ ) -> std::ops::Range<usize> {
269+ // Calculate viewport byte ranges:
270+ // Saturating subs to make it inclusive zero indexing.
271+ let last_line = text.len_lines().saturating_sub(1);
272+ let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line);
273+ let start = text.line_to_byte(row.min(last_line));
274+ let end = text.line_to_byte(last_visible_line + 1);
275+
276+ start..end
277+ }
278+
279+ pub fn empty_highlight_iter(
258280 doc: &Document,
259281 anchor: usize,
260282 height: u16,
261− text_annotations: &TextAnnotations,
262− ) -> Vec<(usize, std::ops::Range<usize>)> {
283+ ) -> Box<dyn Iterator<Item = HighlightEvent>> {
263284 let text = doc.text().slice(..);
264285 let row = text.char_to_line(anchor.min(text.len_chars()));
265286
266− let range = {
267− // Calculate viewport byte ranges:
268− // Saturating subs to make it inclusive zero indexing.
269− let last_line = text.len_lines().saturating_sub(1);
270− let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line);
271− let start = text.line_to_byte(row.min(last_line));
272− let end = text.line_to_byte(last_visible_line + 1);
273−
274− start..end
275− };
276−
277− text_annotations.collect_overlay_highlights(range)
287+ // Calculate viewport byte ranges:
288+ // Saturating subs to make it inclusive zero indexing.
289+ let range = Self::viewport_byte_range(text, row, height);
290+ Box::new(
291+ [HighlightEvent::Source {
292+ start: text.byte_to_char(range.start),
293+ end: text.byte_to_char(range.end),
294+ }]
295+ .into_iter(),
296+ )
278297 }
279298
280299 /// Get syntax highlights for a document in a view represented by the first line
@@ -289,16 +308,7 @@ impl EditorView {
289308 let text = doc.text().slice(..);
290309 let row = text.char_to_line(anchor.min(text.len_chars()));
291310
292− let range = {
293− // Calculate viewport byte ranges:
294− // Saturating subs to make it inclusive zero indexing.
295− let last_line = text.len_lines().saturating_sub(1);
296− let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line);
297− let start = text.line_to_byte(row.min(last_line));
298− let end = text.line_to_byte(last_visible_line + 1);
299−
300− start..end
301− };
311+ let range = Self::viewport_byte_range(text, row, height);
302312
303313 match doc.syntax() {
304314 Some(syntax) => {
@@ -331,6 +341,20 @@ impl EditorView {
331341 }
332342 }
333343
344+ pub fn overlay_syntax_highlights(
345+ doc: &Document,
346+ anchor: usize,
347+ height: u16,
348+ text_annotations: &TextAnnotations,
349+ ) -> Vec<(usize, std::ops::Range<usize>)> {
350+ let text = doc.text().slice(..);
351+ let row = text.char_to_line(anchor.min(text.len_chars()));
352+
353+ let range = Self::viewport_byte_range(text, row, height);
354+
355+ text_annotations.collect_overlay_highlights(range)
356+ }
357+
334358 /// Get highlight spans for document diagnostics
335359 pub fn doc_diagnostics_highlights(
336360 doc: &Document,
@@ -362,7 +386,7 @@ impl EditorView {
362386 let mut warning_vec = Vec::new();
363387 let mut error_vec = Vec::new();
364388
365− for diagnostic in doc.diagnostics() {
389+ for diagnostic in doc.shown_diagnostics() {
366390 // Separate diagnostics into different Vecs by severity.
367391 let (vec, scope) = match diagnostic.severity {
368392 Some(Severity::Info) => (&mut info_vec, info),
@@ -397,6 +421,7 @@ impl EditorView {
397421 view: &View,
398422 theme: &Theme,
399423 cursor_shape_config: &CursorShapeConfig,
424+ is_terminal_focused: bool,
400425 ) -> Vec<(usize, std::ops::Range<usize>)> {
401426 let text = doc.text().slice(..);
402427 let selection = doc.selection(view.id);
@@ -444,7 +469,7 @@ impl EditorView {
444469
445470 // Special-case: cursor at end of the rope.
446471 if range.head == range.anchor && range.head == text.len_chars() {
447− if !selection_is_primary || cursor_is_block {
472+ if !selection_is_primary || (cursor_is_block && is_terminal_focused) {
448473 // Bar and underline cursors are drawn by the terminal
449474 // BUG: If the editor area loses focus while having a bar or
450475 // underline cursor (eg. when a regex prompt has focus) then
@@ -467,13 +492,17 @@ impl EditorView {
467492 cursor_start
468493 };
469494 spans.push((selection_scope, range.anchor..selection_end));
470− if !selection_is_primary || cursor_is_block {
495+ // add block cursors
496+ // skip primary cursor if terminal is unfocused - crossterm cursor is used in that case
497+ if !selection_is_primary || (cursor_is_block && is_terminal_focused) {
471498 spans.push((cursor_scope, cursor_start..range.head));
472499 }
473500 } else {
474501 // Reverse case.
475502 let cursor_end = next_grapheme_boundary(text, range.head);
476− if !selection_is_primary || cursor_is_block {
503+ // add block cursors
504+ // skip primary cursor if terminal is unfocused - crossterm cursor is used in that case
505+ if !selection_is_primary || (cursor_is_block && is_terminal_focused) {
477506 spans.push((cursor_scope, range.head..cursor_end));
478507 }
479508 // non block cursors look like they exclude the cursor
@@ -1070,6 +1099,7 @@ impl EditorView {
10701099 let editor = &mut cxt.editor;
10711100
10721101 if let Some((pos, view_id)) = pos_and_view(editor, row, column, true) {
1102+ let prev_view_id = view!(editor).id;
10731103 let doc = doc_mut!(editor, &view!(editor, view_id).doc);
10741104
10751105 if modifiers == KeyModifiers::ALT {
@@ -1079,6 +1109,10 @@ impl EditorView {
10791109 doc.set_selection(view_id, Selection::point(pos));
10801110 }
10811111
1112+ if view_id != prev_view_id {
1113+ self.clear_completion(editor);
1114+ }
1115+
10821116 editor.focus(view_id);
10831117 editor.ensure_cursor_in_view(view_id);
10841118
@@ -1372,13 +1406,17 @@ impl Component for EditorView {
13721406
13731407 Event::Mouse(event) => self.handle_mouse_event(event, &mut cx),
13741408 Event::IdleTimeout => self.handle_idle_timeout(&mut cx),
1375− Event::FocusGained => EventResult::Ignored(None),
1409+ Event::FocusGained => {
1410+ self.terminal_focused = true;
1411+ EventResult::Consumed(None)
1412+ }
13761413 Event::FocusLost => {
13771414 if context.editor.config().auto_save {
13781415 if let Err(e) = commands::typed::write_all_impl(context, false, false) {
13791416 context.editor.set_error(format!("{}", e));
13801417 }
13811418 }
1419+ self.terminal_focused = false;
13821420 EventResult::Consumed(None)
13831421 }
13841422 }
@@ -1488,8 +1526,15 @@ impl Component for EditorView {
14881526
14891527 fn cursor(&self, _area: Rect, editor: &Editor) -> (Option<Position>, CursorKind) {
14901528 match editor.cursor() {
1491− // All block cursors are drawn manually
1492− (pos, CursorKind::Block) => (pos, CursorKind::Hidden),
1529+ // all block cursors are drawn manually
1530+ (pos, CursorKind::Block) => {
1531+ if self.terminal_focused {
1532+ (pos, CursorKind::Hidden)
1533+ } else {
1534+ // use crossterm cursor when terminal loses focus
1535+ (pos, CursorKind::Underline)
1536+ }
1537+ }
14931538 cursor => cursor,
14941539 }
14951540 }
helix-term/src/ui/fuzzy_match.rsdeleted−239
@@ -1,239 +0,0 @@
1−use fuzzy_matcher::skim::SkimMatcherV2 as Matcher;
2−use fuzzy_matcher::FuzzyMatcher;
3−
4−#[cfg(test)]
5−mod test;
6−
7−struct QueryAtom {
8− kind: QueryAtomKind,
9− atom: String,
10− ignore_case: bool,
11− inverse: bool,
12−}
13−impl QueryAtom {
14− fn new(atom: &str) -> Option<QueryAtom> {
15− let mut atom = atom.to_string();
16− let inverse = atom.starts_with('!');
17− if inverse {
18− atom.remove(0);
19− }
20−
21− let mut kind = match atom.chars().next() {
22− Some('^') => QueryAtomKind::Prefix,
23− Some('\'') => QueryAtomKind::Substring,
24− _ if inverse => QueryAtomKind::Substring,
25− _ => QueryAtomKind::Fuzzy,
26− };
27−
28− if atom.starts_with(['^', '\'']) {
29− atom.remove(0);
30− }
31−
32− if atom.is_empty() {
33− return None;
34− }
35−
36− if atom.ends_with('$') && !atom.ends_with("\\$") {
37− atom.pop();
38− kind = if kind == QueryAtomKind::Prefix {
39− QueryAtomKind::Exact
40− } else {
41− QueryAtomKind::Postfix
42− }
43− }
44−
45− Some(QueryAtom {
46− kind,
47− atom: atom.replace('\\', ""),
48− // not ideal but fuzzy_matches only knows ascii uppercase so more consistent
49− // to behave the same
50− ignore_case: kind != QueryAtomKind::Fuzzy
51− && atom.chars().all(|c| c.is_ascii_lowercase()),
52− inverse,
53− })
54− }
55−
56− fn indices(&self, matcher: &Matcher, item: &str, indices: &mut Vec<usize>) -> bool {
57− // for inverse there are no indices to return
58− // just return whether we matched
59− if self.inverse {
60− return self.matches(matcher, item);
61− }
62− let buf;
63− let item = if self.ignore_case {
64− buf = item.to_ascii_lowercase();
65− &buf
66− } else {
67− item
68− };
69− let off = match self.kind {
70− QueryAtomKind::Fuzzy => {
71− if let Some((_, fuzzy_indices)) = matcher.fuzzy_indices(item, &self.atom) {
72− indices.extend_from_slice(&fuzzy_indices);
73− return true;
74− } else {
75− return false;
76− }
77− }
78− QueryAtomKind::Substring => {
79− if let Some(off) = item.find(&self.atom) {
80− off
81− } else {
82− return false;
83− }
84− }
85− QueryAtomKind::Prefix if item.starts_with(&self.atom) => 0,
86− QueryAtomKind::Postfix if item.ends_with(&self.atom) => item.len() - self.atom.len(),
87− QueryAtomKind::Exact if item == self.atom => 0,
88− _ => return false,
89− };
90−
91− indices.extend(off..(off + self.atom.len()));
92− true
93− }
94−
95− fn matches(&self, matcher: &Matcher, item: &str) -> bool {
96− let buf;
97− let item = if self.ignore_case {
98− buf = item.to_ascii_lowercase();
99− &buf
100− } else {
101− item
102− };
103− let mut res = match self.kind {
104− QueryAtomKind::Fuzzy => matcher.fuzzy_match(item, &self.atom).is_some(),
105− QueryAtomKind::Substring => item.contains(&self.atom),
106− QueryAtomKind::Prefix => item.starts_with(&self.atom),
107− QueryAtomKind::Postfix => item.ends_with(&self.atom),
108− QueryAtomKind::Exact => item == self.atom,
109− };
110− if self.inverse {
111− res = !res;
112− }
113− res
114− }
115−}
116−
117−#[derive(Debug, PartialEq, Eq, Clone, Copy)]
118−enum QueryAtomKind {
119− /// Item is a fuzzy match of this behaviour
120− ///
121− /// Usage: `foo`
122− Fuzzy,
123− /// Item contains query atom as a continuous substring
124− ///
125− /// Usage `'foo`
126− Substring,
127− /// Item starts with query atom
128− ///
129− /// Usage: `^foo`
130− Prefix,
131− /// Item ends with query atom
132− ///
133− /// Usage: `foo$`
134− Postfix,
135− /// Item is equal to query atom
136− ///
137− /// Usage `^foo$`
138− Exact,
139−}
140−
141−#[derive(Default)]
142−pub struct FuzzyQuery {
143− first_fuzzy_atom: Option<String>,
144− query_atoms: Vec<QueryAtom>,
145−}
146−
147−fn query_atoms(query: &str) -> impl Iterator<Item = &str> + '_ {
148− let mut saw_backslash = false;
149− query.split(move |c| {
150− saw_backslash = match c {
151− ' ' if !saw_backslash => return true,
152− '\\' => true,
153− _ => false,
154− };
155− false
156− })
157−}
158−
159−impl FuzzyQuery {
160− pub fn refine(&self, query: &str, old_query: &str) -> (FuzzyQuery, bool) {
161− // TODO: we could be a lot smarter about this
162− let new_query = Self::new(query);
163− let mut is_refinement = query.starts_with(old_query);
164−
165− // if the last atom is an inverse atom adding more text to it
166− // will actually increase the number of matches and we can not refine
167− // the matches.
168− if is_refinement && !self.query_atoms.is_empty() {
169− let last_idx = self.query_atoms.len() - 1;
170− if self.query_atoms[last_idx].inverse
171− && self.query_atoms[last_idx].atom != new_query.query_atoms[last_idx].atom
172− {
173− is_refinement = false;
174− }
175− }
176−
177− (new_query, is_refinement)
178− }
179−
180− pub fn new(query: &str) -> FuzzyQuery {
181− let mut first_fuzzy_query = None;
182− let query_atoms = query_atoms(query)
183− .filter_map(|atom| {
184− let atom = QueryAtom::new(atom)?;
185− if atom.kind == QueryAtomKind::Fuzzy && first_fuzzy_query.is_none() {
186− first_fuzzy_query = Some(atom.atom);
187− None
188− } else {
189− Some(atom)
190− }
191− })
192− .collect();
193− FuzzyQuery {
194− first_fuzzy_atom: first_fuzzy_query,
195− query_atoms,
196− }
197− }
198−
199− pub fn fuzzy_match(&self, item: &str, matcher: &Matcher) -> Option<i64> {
200− // use the rank of the first fuzzzy query for the rank, because merging ranks is not really possible
201− // this behaviour matches fzf and skim
202− let score = self
203− .first_fuzzy_atom
204− .as_ref()
205− .map_or(Some(0), |atom| matcher.fuzzy_match(item, atom))?;
206− if self
207− .query_atoms
208− .iter()
209− .any(|atom| !atom.matches(matcher, item))
210− {
211− return None;
212− }
213− Some(score)
214− }
215−
216− pub fn fuzzy_indices(&self, item: &str, matcher: &Matcher) -> Option<(i64, Vec<usize>)> {
217− let (score, mut indices) = self.first_fuzzy_atom.as_ref().map_or_else(
218− || Some((0, Vec::new())),
219− |atom| matcher.fuzzy_indices(item, atom),
220− )?;
221−
222− // fast path for the common case of just a single atom
223− if self.query_atoms.is_empty() {
224− return Some((score, indices));
225− }
226−
227− for atom in &self.query_atoms {
228− if !atom.indices(matcher, item, &mut indices) {
229− return None;
230− }
231− }
232−
233− // deadup and remove duplicate matches
234− indices.sort_unstable();
235− indices.dedup();
236−
237− Some((score, indices))
238− }
239−}
helix-term/src/ui/fuzzy_match/test.rsdeleted−47
@@ -1,47 +0,0 @@
1−use crate::ui::fuzzy_match::FuzzyQuery;
2−use crate::ui::fuzzy_match::Matcher;
3−
4−fn run_test<'a>(query: &str, items: &'a [&'a str]) -> Vec<String> {
5− let query = FuzzyQuery::new(query);
6− let matcher = Matcher::default();
7− items
8− .iter()
9− .filter_map(|item| {
10− let (_, indices) = query.fuzzy_indices(item, &matcher)?;
11− let matched_string = indices
12− .iter()
13− .map(|&pos| item.chars().nth(pos).unwrap())
14− .collect();
15− Some(matched_string)
16− })
17− .collect()
18−}
19−
20−#[test]
21−fn match_single_value() {
22− let matches = run_test("foo", &["foobar", "foo", "bar"]);
23− assert_eq!(matches, &["foo", "foo"])
24−}
25−
26−#[test]
27−fn match_multiple_values() {
28− let matches = run_test(
29− "foo bar",
30− &["foo bar", "foo bar", "bar foo", "bar", "foo"],
31− );
32− assert_eq!(matches, &["foobar", "foobar", "barfoo"])
33−}
34−
35−#[test]
36−fn space_escape() {
37− let matches = run_test(r"foo\ bar", &["bar foo", "foo bar", "foobar"]);
38− assert_eq!(matches, &["foo bar"])
39−}
40−
41−#[test]
42−fn trim() {
43− let matches = run_test(r" foo bar ", &["bar foo", "foo bar", "foobar"]);
44− assert_eq!(matches, &["barfoo", "foobar", "foobar"]);
45− let matches = run_test(r" foo bar\ ", &["bar foo", "foo bar", "foobar"]);
46− assert_eq!(matches, &["bar foo"])
47−}
helix-term/src/ui/lsp.rs+3−1
@@ -92,7 +92,9 @@ impl Component for SignatureHelp {
9292 Some(doc) => Markdown::new(doc.clone(), Arc::clone(&self.config_loader)),
9393 };
9494 let sig_doc = sig_doc.parse(Some(&cx.editor.theme));
95− let sig_doc_area = area.clip_top(sig_text_area.height + 2);
95+ let sig_doc_area = area
96+ .clip_top(sig_text_area.height + 2)
97+ .clip_bottom(u16::from(cx.editor.popup_border()));
9698 let sig_doc_para = Paragraph::new(sig_doc)
9799 .wrap(Wrap { trim: false })
98100 .scroll((cx.scroll.unwrap_or_default() as u16, 0));
helix-term/src/ui/markdown.rs+12−5
@@ -14,6 +14,7 @@ use helix_core::{
1414};
1515use helix_view::{
1616 graphics::{Margin, Rect, Style},
17+ theme::Modifier,
1718 Theme,
1819};
1920
@@ -183,7 +184,9 @@ impl Markdown {
183184 // Transform text in `<code>` blocks into `Event::Code`
184185 let mut in_code = false;
185186 let parser = parser.filter_map(|event| match event {
186− Event::Html(tag) if *tag == *"<code>" => {
187+ Event::Html(tag)
188+ if tag.starts_with("<code") && matches!(tag.chars().nth(5), Some(' ' | '>')) =>
189+ {
187190 in_code = true;
188191 None
189192 }
@@ -275,17 +278,21 @@ impl Markdown {
275278 );
276279 lines.extend(tui_text.lines.into_iter());
277280 } else {
278− let style = if let Some(Tag::Heading(level, ..)) = tags.last() {
279− match level {
281+ let style = match tags.last() {
282+ Some(Tag::Heading(level, ..)) => match level {
280283 HeadingLevel::H1 => heading_styles[0],
281284 HeadingLevel::H2 => heading_styles[1],
282285 HeadingLevel::H3 => heading_styles[2],
283286 HeadingLevel::H4 => heading_styles[3],
284287 HeadingLevel::H5 => heading_styles[4],
285288 HeadingLevel::H6 => heading_styles[5],
289+ },
290+ Some(Tag::Emphasis) => text_style.add_modifier(Modifier::ITALIC),
291+ Some(Tag::Strong) => text_style.add_modifier(Modifier::BOLD),
292+ Some(Tag::Strikethrough) => {
293+ text_style.add_modifier(Modifier::CROSSED_OUT)
286294 }
287− } else {
288− text_style
295+ _ => text_style,
289296 };
290297 spans.push(Span::styled(text, style));
291298 }
helix-term/src/ui/menu.rs+58−40
@@ -1,22 +1,29 @@
1−use std::{borrow::Cow, path::PathBuf};
1+use std::{borrow::Cow, cmp::Reverse, path::PathBuf};
22
33use crate::{
44 compositor::{Callback, Component, Compositor, Context, Event, EventResult},
55 ctrl, key, shift,
66};
7−use tui::{buffer::Buffer as Surface, widgets::Table};
7+use helix_core::fuzzy::MATCHER;
8+use nucleo::pattern::{Atom, AtomKind, CaseMatching};
9+use nucleo::{Config, Utf32Str};
10+use tui::{
11+ buffer::Buffer as Surface,
12+ widgets::{Block, Borders, Table, Widget},
13+};
814
915pub use tui::widgets::{Cell, Row};
1016
11−use fuzzy_matcher::skim::SkimMatcherV2 as Matcher;
12−use fuzzy_matcher::FuzzyMatcher;
13−
14−use helix_view::{editor::SmartTabConfig, graphics::Rect, Editor};
17+use helix_view::{
18+ editor::SmartTabConfig,
19+ graphics::{Margin, Rect},
20+ Editor,
21+};
1522use tui::layout::Constraint;
1623
17−pub trait Item {
24+pub trait Item: Sync + Send + 'static {
1825 /// Additional editor state that is used for label calculation.
19− type Data;
26+ type Data: Sync + Send + 'static;
2027
2128 fn format(&self, data: &Self::Data) -> Row;
2229
@@ -51,9 +58,8 @@ pub struct Menu<T: Item> {
5158
5259 cursor: Option<usize>,
5360
54− matcher: Box<Matcher>,
5561 /// (index, score)
56− matches: Vec<(usize, i64)>,
62+ matches: Vec<(u32, u32)>,
5763
5864 widths: Vec<Constraint>,
5965
@@ -75,11 +81,10 @@ impl<T: Item> Menu<T> {
7581 editor_data: <T as Item>::Data,
7682 callback_fn: impl Fn(&mut Editor, Option<&T>, MenuEvent) + 'static,
7783 ) -> Self {
78− let matches = (0..options.len()).map(|i| (i, 0)).collect();
84+ let matches = (0..options.len() as u32).map(|i| (i, 0)).collect();
7985 Self {
8086 options,
8187 editor_data,
82− matcher: Box::new(Matcher::default().ignore_case()),
8388 matches,
8489 cursor: None,
8590 widths: Vec::new(),
@@ -94,20 +99,19 @@ impl<T: Item> Menu<T> {
9499 pub fn score(&mut self, pattern: &str) {
95100 // reuse the matches allocation
96101 self.matches.clear();
97− self.matches.extend(
98− self.options
99− .iter()
100− .enumerate()
101− .filter_map(|(index, option)| {
102− let text = option.filter_text(&self.editor_data);
103− // TODO: using fuzzy_indices could give us the char idx for match highlighting
104− self.matcher
105− .fuzzy_match(&text, pattern)
106− .map(|score| (index, score))
107− }),
108− );
109− // Order of equal elements needs to be preserved as LSP preselected items come in order of high to low priority
110− self.matches.sort_by_key(|(_, score)| -score);
102+ let mut matcher = MATCHER.lock();
103+ matcher.config = Config::DEFAULT;
104+ let pattern = Atom::new(pattern, CaseMatching::Ignore, AtomKind::Fuzzy, false);
105+ let mut buf = Vec::new();
106+ let matches = self.options.iter().enumerate().filter_map(|(i, option)| {
107+ let text = option.filter_text(&self.editor_data);
108+ pattern
109+ .score(Utf32Str::new(&text, &mut buf), &mut matcher)
110+ .map(|score| (i as u32, score as u32))
111+ });
112+ self.matches.extend(matches);
113+ self.matches
114+ .sort_unstable_by_key(|&(i, score)| (Reverse(score), i));
111115
112116 // reset cursor position
113117 self.cursor = None;
@@ -201,7 +205,7 @@ impl<T: Item> Menu<T> {
201205 self.cursor.and_then(|cursor| {
202206 self.matches
203207 .get(cursor)
204− .map(|(index, _score)| &self.options[*index])
208+ .map(|(index, _score)| &self.options[*index as usize])
205209 })
206210 }
207211
@@ -209,7 +213,7 @@ impl<T: Item> Menu<T> {
209213 self.cursor.and_then(|cursor| {
210214 self.matches
211215 .get(cursor)
212− .map(|(index, _score)| &mut self.options[*index])
216+ .map(|(index, _score)| &mut self.options[*index as usize])
213217 })
214218 }
215219
@@ -325,6 +329,15 @@ impl<T: Item + 'static> Component for Menu<T> {
325329 let selected = theme.get("ui.menu.selected");
326330 surface.clear_with(area, style);
327331
332+ let render_borders = cx.editor.menu_border();
333+
334+ let area = if render_borders {
335+ Widget::render(Block::default().borders(Borders::ALL), area, surface);
336+ area.inner(&Margin::vertical(1))
337+ } else {
338+ area
339+ };
340+
328341 let scroll = self.scroll;
329342
330343 let options: Vec<_> = self
@@ -332,7 +345,7 @@ impl<T: Item + 'static> Component for Menu<T> {
332345 .iter()
333346 .map(|(index, _score)| {
334347 // (index, self.options.get(*index).unwrap()) // get_unchecked
335− &self.options[*index] // get_unchecked
348+ &self.options[*index as usize] // get_unchecked
336349 })
337350 .collect();
338351
@@ -365,15 +378,19 @@ impl<T: Item + 'static> Component for Menu<T> {
365378 false,
366379 );
367380
368− if let Some(cursor) = self.cursor {
369− let offset_from_top = cursor - scroll;
370− let left = &mut surface[(area.left(), area.y + offset_from_top as u16)];
371− left.set_style(selected);
372− let right = &mut surface[(
373− area.right().saturating_sub(1),
374− area.y + offset_from_top as u16,
375− )];
376− right.set_style(selected);
381+ let render_borders = cx.editor.menu_border();
382+
383+ if !render_borders {
384+ if let Some(cursor) = self.cursor {
385+ let offset_from_top = cursor - scroll;
386+ let left = &mut surface[(area.left(), area.y + offset_from_top as u16)];
387+ left.set_style(selected);
388+ let right = &mut surface[(
389+ area.right().saturating_sub(1),
390+ area.y + offset_from_top as u16,
391+ )];
392+ right.set_style(selected);
393+ }
377394 }
378395
379396 let fits = len <= win_height;
@@ -388,12 +405,13 @@ impl<T: Item + 'static> Component for Menu<T> {
388405 for i in 0..win_height {
389406 cell = &mut surface[(area.right() - 1, area.top() + i as u16)];
390407
391− cell.set_symbol("▐"); // right half block
408+ let half_block = if render_borders { "▌" } else { "▐" };
392409
393410 if scroll_line <= i && i < scroll_line + scroll_height {
394411 // Draw scroll thumb
412+ cell.set_symbol(half_block);
395413 cell.set_fg(scroll_style.fg.unwrap_or(helix_view::theme::Color::Reset));
396− } else {
414+ } else if !render_borders {
397415 // Draw scroll track
398416 cell.set_fg(scroll_style.bg.unwrap_or(helix_view::theme::Color::Reset));
399417 }
helix-term/src/ui/mod.rs+88−145
@@ -1,13 +1,12 @@
11mod completion;
22mod document;
33pub(crate) mod editor;
4−mod fuzzy_match;
54mod info;
65pub mod lsp;
76mod markdown;
87pub mod menu;
98pub mod overlay;
10−mod picker;
9+pub mod picker;
1110pub mod popup;
1211mod prompt;
1312mod spinner;
@@ -64,7 +63,7 @@ pub fn regex_prompt(
6463 prompt: std::borrow::Cow<'static, str>,
6564 history_register: Option<char>,
6665 completion_fn: impl FnMut(&Editor, &str) -> Vec<prompt::Completion> + 'static,
67− fun: impl Fn(&mut Editor, Regex, PromptEvent) + 'static,
66+ fun: impl Fn(&mut crate::compositor::Context, Regex, PromptEvent) + 'static,
6867) {
6968 let (view, doc) = current!(cx.editor);
7069 let doc_id = view.doc;
@@ -111,7 +110,7 @@ pub fn regex_prompt(
111110 view.jumps.push((doc_id, snapshot.clone()));
112111 }
113112
114− fun(cx.editor, regex, event);
113+ fun(cx, regex, event);
115114
116115 let (view, doc) = current!(cx.editor);
117116 view.ensure_cursor_in_view(doc, config.scrolloff);
@@ -174,9 +173,13 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> Picker
174173 .git_ignore(config.file_picker.git_ignore)
175174 .git_global(config.file_picker.git_global)
176175 .git_exclude(config.file_picker.git_exclude)
176+ .sort_by_file_name(|name1, name2| name1.cmp(name2))
177177 .max_depth(config.file_picker.max_depth)
178178 .filter_entry(move |entry| filter_picker_entry(entry, &absolute_root, dedup_symlinks));
179179
180+ walk_builder.add_custom_ignore_filename(helix_loader::config_dir().join("ignore"));
181+ walk_builder.add_custom_ignore_filename(".helix/ignore");
182+
180183 // We want to exclude files that the editor can't handle yet
181184 let mut type_builder = TypesBuilder::new();
182185 type_builder
@@ -190,32 +193,16 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> Picker
190193 .build()
191194 .expect("failed to build excluded_types");
192195 walk_builder.types(excluded_types);
193−
194− // We want files along with their modification date for sorting
195− let files = walk_builder.build().filter_map(|entry| {
196+ let mut files = walk_builder.build().filter_map(|entry| {
196197 let entry = entry.ok()?;
197− // This is faster than entry.path().is_dir() since it uses cached fs::Metadata fetched by ignore/walkdir
198− if entry.file_type()?.is_file() {
199− Some(entry.into_path())
200− } else {
201− None
198+ if !entry.file_type()?.is_file() {
199+ return None;
202200 }
201+ Some(entry.into_path())
203202 });
204−
205− // Cap the number of files if we aren't in a git project, preventing
206− // hangs when using the picker in your home directory
207− let mut files: Vec<PathBuf> = if root.join(".git").exists() {
208− files.collect()
209− } else {
210− // const MAX: usize = 8192;
211− const MAX: usize = 100_000;
212− files.take(MAX).collect()
213− };
214− files.sort();
215−
216203 log::debug!("file_picker init {:?}", Instant::now().duration_since(now));
217204
218− Picker::new(files, root, move |cx, path: &PathBuf, action| {
205+ let picker = Picker::new(Vec::new(), root, move |cx, path: &PathBuf, action| {
219206 if let Err(e) = cx.editor.open(path, action) {
220207 let err = if let Some(err) = e.source() {
221208 format!("{}", err)
@@ -225,20 +212,41 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> Picker
225212 cx.editor.set_error(err);
226213 }
227214 })
228− .with_preview(|_editor, path| Some((path.clone().into(), None)))
215+ .with_preview(|_editor, path| Some((path.clone().into(), None)));
216+ let injector = picker.injector();
217+ let timeout = std::time::Instant::now() + std::time::Duration::from_millis(30);
218+
219+ let mut hit_timeout = false;
220+ for file in &mut files {
221+ if injector.push(file).is_err() {
222+ break;
223+ }
224+ if std::time::Instant::now() >= timeout {
225+ hit_timeout = true;
226+ break;
227+ }
228+ }
229+ if hit_timeout {
230+ std::thread::spawn(move || {
231+ for file in files {
232+ if injector.push(file).is_err() {
233+ break;
234+ }
235+ }
236+ });
237+ }
238+ picker
229239}
230240
231241pub mod completers {
232242 use crate::ui::prompt::Completion;
233− use fuzzy_matcher::skim::SkimMatcherV2 as Matcher;
234− use fuzzy_matcher::FuzzyMatcher;
243+ use helix_core::fuzzy::fuzzy_match;
235244 use helix_core::syntax::LanguageServerFeature;
236245 use helix_view::document::SCRATCH_BUFFER_NAME;
237246 use helix_view::theme;
238247 use helix_view::{editor::Config, Editor};
239248 use once_cell::sync::Lazy;
240249 use std::borrow::Cow;
241− use std::cmp::Reverse;
242250
243251 pub type Completer = fn(&Editor, &str) -> Vec<Completion>;
244252
@@ -247,31 +255,16 @@ pub mod completers {
247255 }
248256
249257 pub fn buffer(editor: &Editor, input: &str) -> Vec<Completion> {
250− let mut names: Vec<_> = editor
251− .documents
252− .values()
253− .map(|doc| {
254− let name = doc
255− .relative_path()
256− .map(|p| p.display().to_string())
257− .unwrap_or_else(|| String::from(SCRATCH_BUFFER_NAME));
258− ((0..), Cow::from(name))
259− })
260− .collect();
261−
262− let matcher = Matcher::default();
263−
264− let mut matches: Vec<_> = names
265− .into_iter()
266− .filter_map(|(_range, name)| {
267− matcher.fuzzy_match(&name, input).map(|score| (name, score))
268− })
269− .collect();
270−
271− matches.sort_unstable_by_key(|(_file, score)| Reverse(*score));
272− names = matches.into_iter().map(|(name, _)| ((0..), name)).collect();
258+ let names = editor.documents.values().map(|doc| {
259+ doc.relative_path()
260+ .map(|p| p.display().to_string().into())
261+ .unwrap_or_else(|| Cow::from(SCRATCH_BUFFER_NAME))
262+ });
273263
274− names
264+ fuzzy_match(input, names, true)
265+ .into_iter()
266+ .map(|(name, _)| ((0..), name))
267+ .collect()
275268 }
276269
277270 pub fn theme(_editor: &Editor, input: &str) -> Vec<Completion> {
@@ -284,26 +277,10 @@ pub mod completers {
284277 names.sort();
285278 names.dedup();
286279
287− let mut names: Vec<_> = names
280+ fuzzy_match(input, names, false)
288281 .into_iter()
289− .map(|name| ((0..), Cow::from(name)))
290− .collect();
291−
292− let matcher = Matcher::default();
293−
294− let mut matches: Vec<_> = names
295− .into_iter()
296− .filter_map(|(_range, name)| {
297− matcher.fuzzy_match(&name, input).map(|score| (name, score))
298− })
299− .collect();
300−
301− matches.sort_unstable_by(|(name1, score1), (name2, score2)| {
302− (Reverse(*score1), name1).cmp(&(Reverse(*score2), name2))
303− });
304− names = matches.into_iter().map(|(name, _)| ((0..), name)).collect();
305−
306− names
282+ .map(|(name, _)| ((0..), name.into()))
283+ .collect()
307284 }
308285
309286 /// Recursive function to get all keys from this value and add them to vec
@@ -330,22 +307,22 @@ pub mod completers {
330307 keys
331308 });
332309
333− let matcher = Matcher::default();
334−
335− let mut matches: Vec<_> = KEYS
336− .iter()
337− .filter_map(|name| matcher.fuzzy_match(name, input).map(|score| (name, score)))
338− .collect();
339−
340− matches.sort_unstable_by_key(|(_file, score)| Reverse(*score));
341− matches
310+ fuzzy_match(input, &*KEYS, false)
342311 .into_iter()
343312 .map(|(name, _)| ((0..), name.into()))
344313 .collect()
345314 }
346315
347316 pub fn filename(editor: &Editor, input: &str) -> Vec<Completion> {
348− filename_impl(editor, input, |entry| {
317+ filename_with_git_ignore(editor, input, true)
318+ }
319+
320+ pub fn filename_with_git_ignore(
321+ editor: &Editor,
322+ input: &str,
323+ git_ignore: bool,
324+ ) -> Vec<Completion> {
325+ filename_impl(editor, input, git_ignore, |entry| {
349326 let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
350327
351328 if is_dir {
@@ -357,8 +334,6 @@ pub mod completers {
357334 }
358335
359336 pub fn language(editor: &Editor, input: &str) -> Vec<Completion> {
360− let matcher = Matcher::default();
361−
362337 let text: String = "text".into();
363338
364339 let language_ids = editor
@@ -367,27 +342,13 @@ pub mod completers {
367342 .map(|config| &config.language_id)
368343 .chain(std::iter::once(&text));
369344
370− let mut matches: Vec<_> = language_ids
371− .filter_map(|language_id| {
372− matcher
373− .fuzzy_match(language_id, input)
374− .map(|score| (language_id, score))
375− })
376− .collect();
377−
378− matches.sort_unstable_by(|(language1, score1), (language2, score2)| {
379− (Reverse(*score1), language1).cmp(&(Reverse(*score2), language2))
380− });
381−
382− matches
345+ fuzzy_match(input, language_ids, false)
383346 .into_iter()
384− .map(|(language, _score)| ((0..), language.clone().into()))
347+ .map(|(name, _)| ((0..), name.to_owned().into()))
385348 .collect()
386349 }
387350
388351 pub fn lsp_workspace_command(editor: &Editor, input: &str) -> Vec<Completion> {
389− let matcher = Matcher::default();
390−
391352 let Some(options) = doc!(editor)
392353 .language_servers_with_feature(LanguageServerFeature::WorkspaceCommand)
393354 .find_map(|ls| ls.capabilities().execute_command_provider.as_ref())
@@ -395,28 +356,22 @@ pub mod completers {
395356 return vec![];
396357 };
397358
398− let mut matches: Vec<_> = options
399− .commands
400− .iter()
401− .filter_map(|command| {
402− matcher
403− .fuzzy_match(command, input)
404− .map(|score| (command, score))
405− })
406− .collect();
407−
408− matches.sort_unstable_by(|(command1, score1), (command2, score2)| {
409− (Reverse(*score1), command1).cmp(&(Reverse(*score2), command2))
410− });
411−
412− matches
359+ fuzzy_match(input, &options.commands, false)
413360 .into_iter()
414− .map(|(command, _score)| ((0..), command.clone().into()))
361+ .map(|(name, _)| ((0..), name.to_owned().into()))
415362 .collect()
416363 }
417364
418365 pub fn directory(editor: &Editor, input: &str) -> Vec<Completion> {
419− filename_impl(editor, input, |entry| {
366+ directory_with_git_ignore(editor, input, true)
367+ }
368+
369+ pub fn directory_with_git_ignore(
370+ editor: &Editor,
371+ input: &str,
372+ git_ignore: bool,
373+ ) -> Vec<Completion> {
374+ filename_impl(editor, input, git_ignore, |entry| {
420375 let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
421376
422377 if is_dir {
@@ -439,7 +394,12 @@ pub mod completers {
439394 }
440395
441396 // TODO: we could return an iter/lazy thing so it can fetch as many as it needs.
442− fn filename_impl<F>(_editor: &Editor, input: &str, filter_fn: F) -> Vec<Completion>
397+ fn filename_impl<F>(
398+ _editor: &Editor,
399+ input: &str,
400+ git_ignore: bool,
401+ filter_fn: F,
402+ ) -> Vec<Completion>
443403 where
444404 F: Fn(&ignore::DirEntry) -> FileMatch,
445405 {
@@ -479,9 +439,10 @@ pub mod completers {
479439
480440 let end = input.len()..;
481441
482− let mut files: Vec<_> = WalkBuilder::new(&dir)
442+ let files = WalkBuilder::new(&dir)
483443 .hidden(false)
484444 .follow_links(false) // We're scanning over depth 1
445+ .git_ignore(git_ignore)
485446 .max_depth(Some(1))
486447 .build()
487448 .filter_map(|file| {
@@ -510,43 +471,25 @@ pub mod completers {
510471 path.push("");
511472 }
512473
513− let path = path.to_str()?.to_owned();
514− Some((end.clone(), Cow::from(path)))
474+ let path = path.into_os_string().into_string().ok()?;
475+ Some(Cow::from(path))
515476 })
516477 }) // TODO: unwrap or skip
517− .filter(|(_, path)| !path.is_empty()) // TODO
518− .collect();
478+ .filter(|path| !path.is_empty());
519479
520480 // if empty, return a list of dirs and files in current dir
521481 if let Some(file_name) = file_name {
522− let matcher = Matcher::default();
523−
524− // inefficient, but we need to calculate the scores, filter out None, then sort.
525− let mut matches: Vec<_> = files
526− .into_iter()
527− .filter_map(|(_range, file)| {
528− matcher
529− .fuzzy_match(&file, &file_name)
530− .map(|score| (file, score))
531− })
532− .collect();
533−
534482 let range = (input.len().saturating_sub(file_name.len()))..;
535−
536− matches.sort_unstable_by(|(file1, score1), (file2, score2)| {
537− (Reverse(*score1), file1).cmp(&(Reverse(*score2), file2))
538− });
539−
540− files = matches
483+ fuzzy_match(&file_name, files, true)
541484 .into_iter()
542− .map(|(file, _)| (range.clone(), file))
543− .collect();
485+ .map(|(name, _)| (range.clone(), name))
486+ .collect()
544487
545488 // TODO: complete to longest common match
546489 } else {
490+ let mut files: Vec<_> = files.map(|file| (end.clone(), file)).collect();
547491 files.sort_unstable_by(|(_, path1), (_, path2)| path1.cmp(path2));
492+ files
548493 }
549−
550− files
551494 }
552495}
helix-term/src/ui/picker.rs+353−319
@@ -7,11 +7,12 @@ use crate::{
77 ui::{
88 self,
99 document::{render_document, LineDecoration, LinePos, TextRenderer},
10− fuzzy_match::FuzzyQuery,
1110 EditorView,
1211 },
1312};
1413use futures_util::{future::BoxFuture, FutureExt};
14+use nucleo::pattern::CaseMatching;
15+use nucleo::{Config, Nucleo, Utf32String};
1516use tui::{
1617 buffer::Buffer as Surface,
1718 layout::Constraint,
@@ -19,16 +20,23 @@ use tui::{
1920 widgets::{Block, BorderType, Borders, Cell, Table},
2021};
2122
22−use fuzzy_matcher::skim::SkimMatcherV2 as Matcher;
2323use tui::widgets::Widget;
2424
25−use std::cmp::{self, Ordering};
26−use std::{collections::HashMap, io::Read, path::PathBuf};
25+use std::{
26+ collections::HashMap,
27+ io::Read,
28+ path::PathBuf,
29+ sync::{
30+ atomic::{self, AtomicBool},
31+ Arc,
32+ },
33+};
2734
2835use crate::ui::{Prompt, PromptEvent};
2936use helix_core::{
30− char_idx_at_visual_offset, movement::Direction, text_annotations::TextAnnotations,
31− unicode::segmentation::UnicodeSegmentation, Position, Syntax,
37+ char_idx_at_visual_offset, fuzzy::MATCHER, movement::Direction,
38+ text_annotations::TextAnnotations, unicode::segmentation::UnicodeSegmentation, Position,
39+ Syntax,
3240};
3341use helix_view::{
3442 editor::Action,
@@ -38,6 +46,7 @@ use helix_view::{
3846 Document, DocumentId, Editor,
3947};
4048
49+pub const ID: &str = "picker";
4150use super::{menu::Item, overlay::Overlay};
4251
4352pub const MIN_AREA_WIDTH_FOR_PREVIEW: u16 = 72;
@@ -51,12 +60,12 @@ pub enum PathOrId {
5160}
5261
5362impl PathOrId {
54− fn get_canonicalized(self) -> std::io::Result<Self> {
63+ fn get_canonicalized(self) -> Self {
5564 use PathOrId::*;
56− Ok(match self {
57− Path(path) => Path(helix_core::path::get_canonicalized_path(&path)?),
65+ match self {
66+ Path(path) => Path(helix_core::path::get_canonicalized_path(&path)),
5867 Id(id) => Id(id),
59− })
68+ }
6069 }
6170}
6271
@@ -103,9 +112,9 @@ impl Preview<'_, '_> {
103112 /// Alternate text to show for the preview.
104113 fn placeholder(&self) -> &str {
105114 match *self {
106− Self::EditorDocument(_) => "<File preview>",
115+ Self::EditorDocument(_) => "<Invalid file location>",
107116 Self::Cached(preview) => match preview {
108− CachedPreview::Document(_) => "<File preview>",
117+ CachedPreview::Document(_) => "<Invalid file location>",
109118 CachedPreview::Binary => "<Binary file>",
110119 CachedPreview::LargeFile => "<File too large to preview>",
111120 CachedPreview::NotFound => "<File not found>",
@@ -114,20 +123,71 @@ impl Preview<'_, '_> {
114123 }
115124}
116125
126+fn item_to_nucleo<T: Item>(item: T, editor_data: &T::Data) -> Option<(T, Utf32String)> {
127+ let row = item.format(editor_data);
128+ let mut cells = row.cells.iter();
129+ let mut text = String::with_capacity(row.cell_text().map(|cell| cell.len()).sum());
130+ let cell = cells.next()?;
131+ if let Some(cell) = cell.content.lines.first() {
132+ for span in &cell.0 {
133+ text.push_str(&span.content);
134+ }
135+ }
136+
137+ for cell in cells {
138+ text.push(' ');
139+ if let Some(cell) = cell.content.lines.first() {
140+ for span in &cell.0 {
141+ text.push_str(&span.content);
142+ }
143+ }
144+ }
145+ Some((item, text.into()))
146+}
147+
148+pub struct Injector<T: Item> {
149+ dst: nucleo::Injector<T>,
150+ editor_data: Arc<T::Data>,
151+ shutown: Arc<AtomicBool>,
152+}
153+
154+impl<T: Item> Clone for Injector<T> {
155+ fn clone(&self) -> Self {
156+ Injector {
157+ dst: self.dst.clone(),
158+ editor_data: self.editor_data.clone(),
159+ shutown: self.shutown.clone(),
160+ }
161+ }
162+}
163+
164+pub struct InjectorShutdown;
165+
166+impl<T: Item> Injector<T> {
167+ pub fn push(&self, item: T) -> Result<(), InjectorShutdown> {
168+ if self.shutown.load(atomic::Ordering::Relaxed) {
169+ return Err(InjectorShutdown);
170+ }
171+
172+ if let Some((item, matcher_text)) = item_to_nucleo(item, &self.editor_data) {
173+ self.dst.push(item, |dst| dst[0] = matcher_text);
174+ }
175+ Ok(())
176+ }
177+}
178+
117179pub struct Picker<T: Item> {
118− options: Vec<T>,
119− editor_data: T::Data,
120− // filter: String,
121− matcher: Box<Matcher>,
122− matches: Vec<PickerMatch>,
180+ editor_data: Arc<T::Data>,
181+ shutdown: Arc<AtomicBool>,
182+ matcher: Nucleo<T>,
123183
124184 /// Current height of the completions box
125185 completion_height: u16,
126186
127− cursor: usize,
128− // pattern: String,
187+ cursor: u32,
129188 prompt: Prompt,
130− previous_pattern: (String, FuzzyQuery),
189+ previous_pattern: String,
190+
131191 /// Whether to show the preview panel (default true)
132192 show_preview: bool,
133193 /// Constraints for tabular formatting
@@ -144,10 +204,59 @@ pub struct Picker<T: Item> {
144204}
145205
146206impl<T: Item + 'static> Picker<T> {
207+ pub fn stream(editor_data: T::Data) -> (Nucleo<T>, Injector<T>) {
208+ let matcher = Nucleo::new(
209+ Config::DEFAULT,
210+ Arc::new(helix_event::request_redraw),
211+ None,
212+ 1,
213+ );
214+ let streamer = Injector {
215+ dst: matcher.injector(),
216+ editor_data: Arc::new(editor_data),
217+ shutown: Arc::new(AtomicBool::new(false)),
218+ };
219+ (matcher, streamer)
220+ }
221+
147222 pub fn new(
148223 options: Vec<T>,
149224 editor_data: T::Data,
150225 callback_fn: impl Fn(&mut Context, &T, Action) + 'static,
226+ ) -> Self {
227+ let matcher = Nucleo::new(
228+ Config::DEFAULT,
229+ Arc::new(helix_event::request_redraw),
230+ None,
231+ 1,
232+ );
233+ let injector = matcher.injector();
234+ for item in options {
235+ if let Some((item, matcher_text)) = item_to_nucleo(item, &editor_data) {
236+ injector.push(item, |dst| dst[0] = matcher_text);
237+ }
238+ }
239+ Self::with(
240+ matcher,
241+ Arc::new(editor_data),
242+ Arc::new(AtomicBool::new(false)),
243+ callback_fn,
244+ )
245+ }
246+
247+ pub fn with_stream(
248+ matcher: Nucleo<T>,
249+ injector: Injector<T>,
250+ callback_fn: impl Fn(&mut Context, &T, Action) + 'static,
251+ ) -> Self {
252+ Self::with(matcher, injector.editor_data, injector.shutown, callback_fn)
253+ }
254+
255+ fn with(
256+ matcher: Nucleo<T>,
257+ editor_data: Arc<T::Data>,
258+ shutdown: Arc<AtomicBool>,
259+ callback_fn: impl Fn(&mut Context, &T, Action) + 'static,
151260 ) -> Self {
152261 let prompt = Prompt::new(
153262 "".into(),
@@ -156,14 +265,13 @@ impl<T: Item + 'static> Picker<T> {
156265 |_editor: &mut Context, _pattern: &str, _event: PromptEvent| {},
157266 );
158267
159− let mut picker = Self {
160− options,
268+ Self {
269+ matcher,
161270 editor_data,
162− matcher: Box::default(),
163− matches: Vec::new(),
271+ shutdown,
164272 cursor: 0,
165273 prompt,
166− previous_pattern: (String::new(), FuzzyQuery::default()),
274+ previous_pattern: String::new(),
167275 truncate_start: true,
168276 show_preview: true,
169277 callback_fn: Box::new(callback_fn),
@@ -172,24 +280,15 @@ impl<T: Item + 'static> Picker<T> {
172280 preview_cache: HashMap::new(),
173281 read_buffer: Vec::with_capacity(1024),
174282 file_fn: None,
175− };
176−
177− picker.calculate_column_widths();
178−
179− // scoring on empty input
180− // TODO: just reuse score()
181− picker
182− .matches
183− .extend(picker.options.iter().enumerate().map(|(index, option)| {
184− let text = option.filter_text(&picker.editor_data);
185− PickerMatch {
186− index,
187− score: 0,
188− len: text.chars().count(),
189− }
190− }));
283+ }
284+ }
191285
192− picker
286+ pub fn injector(&self) -> Injector<T> {
287+ Injector {
288+ dst: self.matcher.injector(),
289+ editor_data: self.editor_data.clone(),
290+ shutown: self.shutdown.clone(),
291+ }
193292 }
194293
195294 pub fn truncate_start(mut self, truncate_start: bool) -> Self {
@@ -202,122 +301,25 @@ impl<T: Item + 'static> Picker<T> {
202301 preview_fn: impl Fn(&Editor, &T) -> Option<FileLocation> + 'static,
203302 ) -> Self {
204303 self.file_fn = Some(Box::new(preview_fn));
304+ // assumption: if we have a preview we are matching paths... If this is ever
305+ // not true this could be a separate builder function
306+ self.matcher.update_config(Config::DEFAULT.match_paths());
205307 self
206308 }
207309
208310 pub fn set_options(&mut self, new_options: Vec<T>) {
209− self.options = new_options;
210− self.cursor = 0;
211− self.force_score();
212− self.calculate_column_widths();
213− }
214−
215− /// Calculate the width constraints using the maximum widths of each column
216− /// for the current options.
217− fn calculate_column_widths(&mut self) {
218− let n = self
219− .options
220− .first()
221− .map(|option| option.format(&self.editor_data).cells.len())
222− .unwrap_or_default();
223− let max_lens = self.options.iter().fold(vec![0; n], |mut acc, option| {
224− let row = option.format(&self.editor_data);
225− // maintain max for each column
226− for (acc, cell) in acc.iter_mut().zip(row.cells.iter()) {
227− let width = cell.content.width();
228− if width > *acc {
229− *acc = width;
230− }
311+ self.matcher.restart(false);
312+ let injector = self.matcher.injector();
313+ for item in new_options {
314+ if let Some((item, matcher_text)) = item_to_nucleo(item, &self.editor_data) {
315+ injector.push(item, |dst| dst[0] = matcher_text);
231316 }
232− acc
233− });
234− self.widths = max_lens
235− .into_iter()
236− .map(|len| Constraint::Length(len as u16))
237− .collect();
238− }
239−
240− pub fn score(&mut self) {
241− let pattern = self.prompt.line();
242−
243− if pattern == &self.previous_pattern.0 {
244− return;
245317 }
246−
247− let (query, is_refined) = self
248− .previous_pattern
249− .1
250− .refine(pattern, &self.previous_pattern.0);
251−
252− if pattern.is_empty() {
253− // Fast path for no pattern.
254− self.matches.clear();
255− self.matches
256− .extend(self.options.iter().enumerate().map(|(index, option)| {
257− let text = option.filter_text(&self.editor_data);
258− PickerMatch {
259− index,
260− score: 0,
261− len: text.chars().count(),
262− }
263− }));
264− } else if is_refined {
265− // optimization: if the pattern is a more specific version of the previous one
266− // then we can score the filtered set.
267− self.matches.retain_mut(|pmatch| {
268− let option = &self.options[pmatch.index];
269− let text = option.sort_text(&self.editor_data);
270−
271− match query.fuzzy_match(&text, &self.matcher) {
272− Some(s) => {
273− // Update the score
274− pmatch.score = s;
275− true
276− }
277− None => false,
278− }
279− });
280−
281− self.matches.sort_unstable();
282− } else {
283− self.force_score();
284− }
285−
286− // reset cursor position
287− self.cursor = 0;
288− let pattern = self.prompt.line();
289− self.previous_pattern.0.clone_from(pattern);
290− self.previous_pattern.1 = query;
291− }
292−
293− pub fn force_score(&mut self) {
294− let pattern = self.prompt.line();
295−
296− let query = FuzzyQuery::new(pattern);
297− self.matches.clear();
298− self.matches.extend(
299− self.options
300− .iter()
301− .enumerate()
302− .filter_map(|(index, option)| {
303− let text = option.filter_text(&self.editor_data);
304−
305− query
306− .fuzzy_match(&text, &self.matcher)
307− .map(|score| PickerMatch {
308− index,
309− score,
310− len: text.chars().count(),
311− })
312− }),
313− );
314−
315− self.matches.sort_unstable();
316318 }
317319
318320 /// Move the cursor by a number of lines, either down (`Forward`) or up (`Backward`)
319− pub fn move_by(&mut self, amount: usize, direction: Direction) {
320− let len = self.matches.len();
321+ pub fn move_by(&mut self, amount: u32, direction: Direction) {
322+ let len = self.matcher.snapshot().matched_item_count();
321323
322324 if len == 0 {
323325 // No results, can't move.
@@ -336,12 +338,12 @@ impl<T: Item + 'static> Picker<T> {
336338
337339 /// Move the cursor down by exactly one page. After the last page comes the first page.
338340 pub fn page_up(&mut self) {
339− self.move_by(self.completion_height as usize, Direction::Backward);
341+ self.move_by(self.completion_height as u32, Direction::Backward);
340342 }
341343
342344 /// Move the cursor up by exactly one page. After the first page comes the last page.
343345 pub fn page_down(&mut self) {
344− self.move_by(self.completion_height as usize, Direction::Forward);
346+ self.move_by(self.completion_height as u32, Direction::Forward);
345347 }
346348
347349 /// Move the cursor to the first entry
@@ -351,13 +353,18 @@ impl<T: Item + 'static> Picker<T> {
351353
352354 /// Move the cursor to the last entry
353355 pub fn to_end(&mut self) {
354− self.cursor = self.matches.len().saturating_sub(1);
356+ self.cursor = self
357+ .matcher
358+ .snapshot()
359+ .matched_item_count()
360+ .saturating_sub(1);
355361 }
356362
357363 pub fn selection(&self) -> Option<&T> {
358− self.matches
359− .get(self.cursor)
360− .map(|pmatch| &self.options[pmatch.index])
364+ self.matcher
365+ .snapshot()
366+ .get_matched_item(self.cursor)
367+ .map(|item| item.data)
361368 }
362369
363370 pub fn toggle_preview(&mut self) {
@@ -366,8 +373,17 @@ impl<T: Item + 'static> Picker<T> {
366373
367374 fn prompt_handle_event(&mut self, event: &Event, cx: &mut Context) -> EventResult {
368375 if let EventResult::Consumed(_) = self.prompt.handle_event(event, cx) {
369− // TODO: recalculate only if pattern changed
370− self.score();
376+ let pattern = self.prompt.line();
377+ // TODO: better track how the pattern has changed
378+ if pattern != &self.previous_pattern {
379+ self.matcher.pattern.reparse(
380+ 0,
381+ pattern,
382+ CaseMatching::Smart,
383+ pattern.starts_with(&self.previous_pattern),
384+ );
385+ self.previous_pattern = pattern.clone();
386+ }
371387 }
372388 EventResult::Consumed(None)
373389 }
@@ -375,7 +391,7 @@ impl<T: Item + 'static> Picker<T> {
375391 fn current_file(&self, editor: &Editor) -> Option<FileLocation> {
376392 self.selection()
377393 .and_then(|current| (self.file_fn.as_ref()?)(editor, current))
378− .and_then(|(path_or_id, line)| path_or_id.get_canonicalized().ok().zip(Some(line)))
394+ .map(|(path_or_id, line)| (path_or_id.get_canonicalized(), line))
379395 }
380396
381397 /// Get (cached) preview for a given path. If a document corresponding
@@ -411,12 +427,9 @@ impl<T: Item + 'static> Picker<T> {
411427 (size, _) if size > MAX_FILE_SIZE_FOR_PREVIEW => {
412428 CachedPreview::LargeFile
413429 }
414− _ => {
415− // TODO: enable syntax highlighting; blocked by async rendering
416− Document::open(path, None, None, editor.config.clone())
417− .map(|doc| CachedPreview::Document(Box::new(doc)))
418− .unwrap_or(CachedPreview::NotFound)
419− }
430+ _ => Document::open(path, None, None, editor.config.clone())
431+ .map(|doc| CachedPreview::Document(Box::new(doc)))
432+ .unwrap_or(CachedPreview::NotFound),
420433 },
421434 )
422435 .unwrap_or(CachedPreview::NotFound);
@@ -461,9 +474,13 @@ impl<T: Item + 'static> Picker<T> {
461474 log::info!("highlighting picker item failed");
462475 return;
463476 };
464− let Some(Overlay {
465− content: picker, ..
466− }) = compositor.find::<Overlay<Self>>()
477+ let picker = match compositor.find::<Overlay<Self>>() {
478+ Some(Overlay { content, .. }) => Some(content),
479+ None => compositor
480+ .find::<Overlay<DynamicPicker<T>>>()
481+ .map(|overlay| &mut overlay.content.file_picker),
482+ };
483+ let Some(picker) = picker
467484 else {
468485 log::info!("picker closed before syntax highlighting finished");
469486 return;
@@ -495,6 +512,14 @@ impl<T: Item + 'static> Picker<T> {
495512 }
496513
497514 fn render_picker(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
515+ let status = self.matcher.tick(10);
516+ let snapshot = self.matcher.snapshot();
517+ if status.changed {
518+ self.cursor = self
519+ .cursor
520+ .min(snapshot.matched_item_count().saturating_sub(1))
521+ }
522+
498523 let text_style = cx.editor.theme.get("ui.text");
499524 let selected = cx.editor.theme.get("ui.text.focus");
500525 let highlight_style = cx.editor.theme.get("special").add_modifier(Modifier::BOLD);
@@ -515,8 +540,15 @@ impl<T: Item + 'static> Picker<T> {
515540 // -- Render the input bar:
516541
517542 let area = inner.clip_left(1).with_height(1);
543+ // render the prompt first since it will clear its background
544+ self.prompt.render(area, surface, cx);
518545
519− let count = format!("{}/{}", self.matches.len(), self.options.len());
546+ let count = format!(
547+ "{}{}/{}",
548+ if status.running { "(running) " } else { "" },
549+ snapshot.matched_item_count(),
550+ snapshot.item_count(),
551+ );
520552 surface.set_stringn(
521553 (area.x + area.width).saturating_sub(count.len() as u16 + 1),
522554 area.y,
@@ -525,8 +557,6 @@ impl<T: Item + 'static> Picker<T> {
525557 text_style,
526558 );
527559
528− self.prompt.render(area, surface, cx);
529−
530560 // -- Separator
531561 let sep_style = cx.editor.theme.get("ui.background.separator");
532562 let borders = BorderType::line_symbols(BorderType::Plain);
@@ -539,106 +569,89 @@ impl<T: Item + 'static> Picker<T> {
539569 // -- Render the contents:
540570 // subtract area of prompt from top
541571 let inner = inner.clip_top(2);
542−
543− let rows = inner.height;
544− let offset = self.cursor - (self.cursor % std::cmp::max(1, rows as usize));
572+ let rows = inner.height as u32;
573+ let offset = self.cursor - (self.cursor % std::cmp::max(1, rows));
545574 let cursor = self.cursor.saturating_sub(offset);
575+ let end = offset
576+ .saturating_add(rows)
577+ .min(snapshot.matched_item_count());
578+ let mut indices = Vec::new();
579+ let mut matcher = MATCHER.lock();
580+ matcher.config = Config::DEFAULT;
581+ if self.file_fn.is_some() {
582+ matcher.config.set_match_paths()
583+ }
546584
547− let options = self
548− .matches
549− .iter()
550− .skip(offset)
551− .take(rows as usize)
552− .map(|pmatch| &self.options[pmatch.index])
553− .map(|option| option.format(&self.editor_data))
554− .map(|mut row| {
555− const TEMP_CELL_SEP: &str = " ";
556−
557− let line = row.cell_text().fold(String::new(), |mut s, frag| {
558− s.push_str(&frag);
559− s.push_str(TEMP_CELL_SEP);
560− s
561− });
562−
563− // Items are filtered by using the text returned by menu::Item::filter_text
564− // but we do highlighting here using the text in Row and therefore there
565− // might be inconsistencies. This is the best we can do since only the
566− // text in Row is displayed to the end user.
567− let (_score, highlights) = FuzzyQuery::new(self.prompt.line())
568− .fuzzy_indices(&line, &self.matcher)
569− .unwrap_or_default();
570−
571− let highlight_byte_ranges: Vec<_> = line
572− .char_indices()
573− .enumerate()
574− .filter_map(|(char_idx, (byte_offset, ch))| {
575− highlights
576− .contains(&char_idx)
577− .then(|| byte_offset..byte_offset + ch.len_utf8())
578− })
579− .collect();
580−
581− // The starting byte index of the current (iterating) cell
582− let mut cell_start_byte_offset = 0;
583− for cell in row.cells.iter_mut() {
584− let spans = match cell.content.lines.get(0) {
585− Some(s) => s,
586− None => {
587− cell_start_byte_offset += TEMP_CELL_SEP.len();
588− continue;
589− }
590− };
585+ let options = snapshot.matched_items(offset..end).map(|item| {
586+ snapshot.pattern().column_pattern(0).indices(
587+ item.matcher_columns[0].slice(..),
588+ &mut matcher,
589+ &mut indices,
590+ );
591+ indices.sort_unstable();
592+ indices.dedup();
593+ let mut row = item.data.format(&self.editor_data);
594+
595+ let mut grapheme_idx = 0u32;
596+ let mut indices = indices.drain(..);
597+ let mut next_highlight_idx = indices.next().unwrap_or(u32::MAX);
598+ if self.widths.len() < row.cells.len() {
599+ self.widths.resize(row.cells.len(), Constraint::Length(0));
600+ }
601+ let mut widths = self.widths.iter_mut();
602+ for cell in &mut row.cells {
603+ let Some(Constraint::Length(max_width)) = widths.next() else {
604+ unreachable!();
605+ };
591606
592− let mut cell_len = 0;
593−
594− let graphemes_with_style: Vec<_> = spans
595− .0
596− .iter()
597− .flat_map(|span| {
598− span.content
599− .grapheme_indices(true)
600− .zip(std::iter::repeat(span.style))
601− })
602− .map(|((grapheme_byte_offset, grapheme), style)| {
603− cell_len += grapheme.len();
604− let start = cell_start_byte_offset;
605−
606− let grapheme_byte_range =
607− grapheme_byte_offset..grapheme_byte_offset + grapheme.len();
608−
609− if highlight_byte_ranges.iter().any(|hl_rng| {
610− hl_rng.start >= start + grapheme_byte_range.start
611− && hl_rng.end <= start + grapheme_byte_range.end
612− }) {
613− (grapheme, style.patch(highlight_style))
614− } else {
615− (grapheme, style)
616− }
617− })
618− .collect();
619−
620− let mut span_list: Vec<(String, Style)> = Vec::new();
621− for (grapheme, style) in graphemes_with_style {
622− if span_list.last().map(|(_, sty)| sty) == Some(&style) {
623− let (string, _) = span_list.last_mut().unwrap();
624− string.push_str(grapheme);
607+ // merge index highlights on top of existing hightlights
608+ let mut span_list = Vec::new();
609+ let mut current_span = String::new();
610+ let mut current_style = Style::default();
611+ let mut width = 0;
612+
613+ let spans: &[Span] = cell.content.lines.first().map_or(&[], |it| it.0.as_slice());
614+ for span in spans {
615+ // this looks like a bug on first glance, we are iterating
616+ // graphemes but treating them as char indices. The reason that
617+ // this is correct is that nucleo will only ever consider the first char
618+ // of a grapheme (and discard the rest of the grapheme) so the indices
619+ // returned by nucleo are essentially grapheme indecies
620+ for grapheme in span.content.graphemes(true) {
621+ let style = if grapheme_idx == next_highlight_idx {
622+ next_highlight_idx = indices.next().unwrap_or(u32::MAX);
623+ span.style.patch(highlight_style)
625624 } else {
626− span_list.push((String::from(grapheme), style))
625+ span.style
626+ };
627+ if style != current_style {
628+ if !current_span.is_empty() {
629+ span_list.push(Span::styled(current_span, current_style))
630+ }
631+ current_span = String::new();
632+ current_style = style;
627633 }
634+ current_span.push_str(grapheme);
635+ grapheme_idx += 1;
628636 }
637+ width += span.width();
638+ }
629639
630− let spans: Vec<Span> = span_list
631− .into_iter()
632− .map(|(string, style)| Span::styled(string, style))
633− .collect();
634− let spans: Spans = spans.into();
635− *cell = Cell::from(spans);
640+ span_list.push(Span::styled(current_span, current_style));
641+ if width as u16 > *max_width {
642+ *max_width = width as u16;
643+ }
644+ *cell = Cell::from(Spans::from(span_list));
636645
637− cell_start_byte_offset += cell_len + TEMP_CELL_SEP.len();
646+ // spacer
647+ if grapheme_idx == next_highlight_idx {
648+ next_highlight_idx = indices.next().unwrap_or(u32::MAX);
638649 }
650+ grapheme_idx += 1;
651+ }
639652
640− row
641− });
653+ row
654+ });
642655
643656 let table = Table::new(options)
644657 .style(text_style)
@@ -654,7 +667,7 @@ impl<T: Item + 'static> Picker<T> {
654667 surface,
655668 &mut TableState {
656669 offset: 0,
657− selected: Some(cursor),
670+ selected: Some(cursor as usize),
658671 },
659672 self.truncate_start,
660673 );
@@ -680,8 +693,14 @@ impl<T: Item + 'static> Picker<T> {
680693 if let Some((path, range)) = self.current_file(cx.editor) {
681694 let preview = self.get_preview(path, cx.editor);
682695 let doc = match preview.document() {
683− Some(doc) => doc,
684− None => {
696+ Some(doc)
697+ if range.map_or(true, |(start, end)| {
698+ start <= end && end <= doc.text().len_lines()
699+ }) =>
700+ {
701+ doc
702+ }
703+ _ => {
685704 let alt_text = preview.placeholder();
686705 let x = inner.x + inner.width.saturating_sub(alt_text.len() as u16) / 2;
687706 let y = inner.y + inner.height / 2;
@@ -691,31 +710,46 @@ impl<T: Item + 'static> Picker<T> {
691710 };
692711
693712 let mut offset = ViewPosition::default();
694− if let Some(range) = range {
695− let text_fmt = doc.text_format(inner.width, None);
696− let annotations = TextAnnotations::default();
697− (offset.anchor, offset.vertical_offset) = char_idx_at_visual_offset(
698− doc.text().slice(..),
699− doc.text().line_to_char(range.0),
700− // align to middle
701− -(inner.height as isize / 2),
702− 0,
703− &text_fmt,
704− &annotations,
705− );
713+ if let Some((start_line, end_line)) = range {
714+ let height = end_line - start_line;
715+ let text = doc.text().slice(..);
716+ let start = text.line_to_char(start_line);
717+ let middle = text.line_to_char(start_line + height / 2);
718+ if height < inner.height as usize {
719+ let text_fmt = doc.text_format(inner.width, None);
720+ let annotations = TextAnnotations::default();
721+ (offset.anchor, offset.vertical_offset) = char_idx_at_visual_offset(
722+ text,
723+ middle,
724+ // align to middle
725+ -(inner.height as isize / 2),
726+ 0,
727+ &text_fmt,
728+ &annotations,
729+ );
730+ if start < offset.anchor {
731+ offset.anchor = start;
732+ offset.vertical_offset = 0;
733+ }
734+ } else {
735+ offset.anchor = start;
736+ }
706737 }
707738
708− let mut highlights = EditorView::doc_syntax_highlights(
739+ let syntax_highlights = EditorView::doc_syntax_highlights(
709740 doc,
710741 offset.anchor,
711742 area.height,
712743 &cx.editor.theme,
713744 );
745+
746+ let mut overlay_highlights =
747+ EditorView::empty_highlight_iter(doc, offset.anchor, area.height);
714748 for spans in EditorView::doc_diagnostics_highlights(doc, &cx.editor.theme) {
715749 if spans.is_empty() {
716750 continue;
717751 }
718− highlights = Box::new(helix_core::syntax::merge(highlights, spans));
752+ overlay_highlights = Box::new(helix_core::syntax::merge(overlay_highlights, spans));
719753 }
720754 let mut decorations: Vec<Box<dyn LineDecoration>> = Vec::new();
721755
@@ -746,7 +780,8 @@ impl<T: Item + 'static> Picker<T> {
746780 offset,
747781 // TODO: compute text annotations asynchronously here (like inlay hints)
748782 &TextAnnotations::default(),
749− highlights,
783+ syntax_highlights,
784+ overlay_highlights,
750785 &cx.editor.theme,
751786 &mut decorations,
752787 &mut [],
@@ -755,7 +790,7 @@ impl<T: Item + 'static> Picker<T> {
755790 }
756791}
757792
758−impl<T: Item + 'static> Component for Picker<T> {
793+impl<T: Item + 'static + Send + Sync> Component for Picker<T> {
759794 fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
760795 // +---------+ +---------+
761796 // |prompt | |preview |
@@ -764,7 +799,8 @@ impl<T: Item + 'static> Component for Picker<T> {
764799 // | | | |
765800 // +---------+ +---------+
766801
767− let render_preview = self.show_preview && area.width > MIN_AREA_WIDTH_FOR_PREVIEW;
802+ let render_preview =
803+ self.show_preview && self.file_fn.is_some() && area.width > MIN_AREA_WIDTH_FOR_PREVIEW;
768804
769805 let picker_width = if render_preview {
770806 area.width / 2
@@ -794,11 +830,28 @@ impl<T: Item + 'static> Component for Picker<T> {
794830 _ => return EventResult::Ignored(None),
795831 };
796832
797− let close_fn =
798− EventResult::Consumed(Some(Box::new(|compositor: &mut Compositor, _ctx| {
799− // remove the layer
800− compositor.last_picker = compositor.pop();
801− })));
833+ let close_fn = |picker: &mut Self| {
834+ // if the picker is very large don't store it as last_picker to avoid
835+ // excessive memory consumption
836+ let callback: compositor::Callback = if picker.matcher.snapshot().item_count() > 100_000
837+ {
838+ Box::new(|compositor: &mut Compositor, _ctx| {
839+ // remove the layer
840+ compositor.pop();
841+ })
842+ } else {
843+ // stop streaming in new items in the background, really we should
844+ // be restarting the stream somehow once the picker gets
845+ // reopened instead (like for an FS crawl) that would also remove the
846+ // need for the special case above but that is pretty tricky
847+ picker.shutdown.store(true, atomic::Ordering::Relaxed);
848+ Box::new(|compositor: &mut Compositor, _ctx| {
849+ // remove the layer
850+ compositor.last_picker = compositor.pop();
851+ })
852+ };
853+ EventResult::Consumed(Some(callback))
854+ };
802855
803856 // So that idle timeout retriggers
804857 ctx.editor.reset_idle_timer();
@@ -822,9 +875,7 @@ impl<T: Item + 'static> Component for Picker<T> {
822875 key!(End) => {
823876 self.to_end();
824877 }
825− key!(Esc) | ctrl!('c') => {
826− return close_fn;
827− }
878+ key!(Esc) | ctrl!('c') => return close_fn(self),
828879 alt!(Enter) => {
829880 if let Some(option) = self.selection() {
830881 (self.callback_fn)(ctx, option, Action::Load);
@@ -834,19 +885,19 @@ impl<T: Item + 'static> Component for Picker<T> {
834885 if let Some(option) = self.selection() {
835886 (self.callback_fn)(ctx, option, Action::Replace);
836887 }
837− return close_fn;
888+ return close_fn(self);
838889 }
839890 ctrl!('s') => {
840891 if let Some(option) = self.selection() {
841892 (self.callback_fn)(ctx, option, Action::HorizontalSplit);
842893 }
843− return close_fn;
894+ return close_fn(self);
844895 }
845896 ctrl!('v') => {
846897 if let Some(option) = self.selection() {
847898 (self.callback_fn)(ctx, option, Action::VerticalSplit);
848899 }
849− return close_fn;
900+ return close_fn(self);
850901 }
851902 ctrl!('t') => {
852903 self.toggle_preview();
@@ -874,30 +925,15 @@ impl<T: Item + 'static> Component for Picker<T> {
874925 self.completion_height = height.saturating_sub(4);
875926 Some((width, height))
876927 }
877−}
878−
879−#[derive(PartialEq, Eq, Debug)]
880−struct PickerMatch {
881− score: i64,
882− index: usize,
883− len: usize,
884−}
885−
886−impl PickerMatch {
887− fn key(&self) -> impl Ord {
888− (cmp::Reverse(self.score), self.len, self.index)
889− }
890−}
891928
892−impl PartialOrd for PickerMatch {
893− fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
894− Some(self.cmp(other))
929+ fn id(&self) -> Option<&'static str> {
930+ Some(ID)
895931 }
896932}
897−
898−impl Ord for PickerMatch {
899− fn cmp(&self, other: &Self) -> Ordering {
900− self.key().cmp(&other.key())
933+impl<T: Item> Drop for Picker<T> {
934+ fn drop(&mut self) {
935+ // ensure we cancel any ongoing background threads streaming into the picker
936+ self.shutdown.store(true, atomic::Ordering::Relaxed)
901937 }
902938}
903939
@@ -910,15 +946,13 @@ pub type DynQueryCallback<T> =
910946
911947/// A picker that updates its contents via a callback whenever the
912948/// query string changes. Useful for live grep, workspace symbols, etc.
913−pub struct DynamicPicker<T: ui::menu::Item + Send> {
949+pub struct DynamicPicker<T: ui::menu::Item + Send + Sync> {
914950 file_picker: Picker<T>,
915951 query_callback: DynQueryCallback<T>,
916952 query: String,
917953}
918954
919−impl<T: ui::menu::Item + Send> DynamicPicker<T> {
920− pub const ID: &'static str = "dynamic-picker";
921−
955+impl<T: ui::menu::Item + Send + Sync> DynamicPicker<T> {
922956 pub fn new(file_picker: Picker<T>, query_callback: DynQueryCallback<T>) -> Self {
923957 Self {
924958 file_picker,
@@ -928,7 +962,7 @@ impl<T: ui::menu::Item + Send> DynamicPicker<T> {
928962 }
929963}
930964
931−impl<T: Item + Send + 'static> Component for DynamicPicker<T> {
965+impl<T: Item + Send + Sync + 'static> Component for DynamicPicker<T> {
932966 fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
933967 self.file_picker.render(area, surface, cx);
934968 }
@@ -950,7 +984,7 @@ impl<T: Item + Send + 'static> Component for DynamicPicker<T> {
950984 let callback = Callback::EditorCompositor(Box::new(move |editor, compositor| {
951985 // Wrapping of pickers in overlay is done outside the picker code,
952986 // so this is fragile and will break if wrapped in some other widget.
953− let picker = match compositor.find_id::<Overlay<DynamicPicker<T>>>(Self::ID) {
987+ let picker = match compositor.find_id::<Overlay<DynamicPicker<T>>>(ID) {
954988 Some(overlay) => &mut overlay.content.file_picker,
955989 None => return,
956990 };
@@ -971,6 +1005,6 @@ impl<T: Item + Send + 'static> Component for DynamicPicker<T> {
9711005 }
9721006
9731007 fn id(&self) -> Option<&'static str> {
974− Some(Self::ID)
1008+ Some(ID)
9751009 }
9761010}
helix-term/src/ui/popup.rs+27−7
@@ -3,7 +3,10 @@ use crate::{
33 compositor::{Callback, Component, Context, Event, EventResult},
44 ctrl, key,
55};
6−use tui::buffer::Buffer as Surface;
6+use tui::{
7+ buffer::Buffer as Surface,
8+ widgets::{Block, Borders, Widget},
9+};
710
811use helix_core::Position;
912use helix_view::{
@@ -252,13 +255,29 @@ impl<T: Component> Component for Popup<T> {
252255 let background = cx.editor.theme.get("ui.popup");
253256 surface.clear_with(area, background);
254257
255− let inner = area.inner(&self.margin);
258+ let render_borders = cx.editor.popup_border();
259+
260+ let inner = if self
261+ .contents
262+ .type_name()
263+ .starts_with("helix_term::ui::menu::Menu")
264+ {
265+ area
266+ } else {
267+ area.inner(&self.margin)
268+ };
269+
270+ let border = usize::from(render_borders);
271+ if render_borders {
272+ Widget::render(Block::default().borders(Borders::ALL), area, surface);
273+ }
274+
256275 self.contents.render(inner, surface, cx);
257276
258277 // render scrollbar if contents do not fit
259278 if self.has_scrollbar {
260− let win_height = inner.height as usize;
261− let len = self.child_size.1 as usize;
279+ let win_height = (inner.height as usize).saturating_sub(2 * border);
280+ let len = (self.child_size.1 as usize).saturating_sub(2 * border);
262281 let fits = len <= win_height;
263282 let scroll = self.scroll;
264283 let scroll_style = cx.editor.theme.get("ui.menu.scroll");
@@ -274,14 +293,15 @@ impl<T: Component> Component for Popup<T> {
274293
275294 let mut cell;
276295 for i in 0..win_height {
277− cell = &mut surface[(inner.right() - 1, inner.top() + i as u16)];
296+ cell = &mut surface[(inner.right() - 1, inner.top() + (border + i) as u16)];
278297
279− cell.set_symbol("▐"); // right half block
298+ let half_block = if render_borders { "▌" } else { "▐" };
280299
281300 if scroll_line <= i && i < scroll_line + scroll_height {
282301 // Draw scroll thumb
302+ cell.set_symbol(half_block);
283303 cell.set_fg(scroll_style.fg.unwrap_or(helix_view::theme::Color::Reset));
284− } else {
304+ } else if !render_borders {
285305 // Draw scroll track
286306 cell.set_fg(scroll_style.bg.unwrap_or(helix_view::theme::Color::Reset));
287307 }
helix-term/tests/integration.rs+1−1
@@ -18,8 +18,8 @@ mod test {
1818 mod auto_indent;
1919 mod auto_pairs;
2020 mod commands;
21+ mod languages;
2122 mod movement;
22− mod picker;
2323 mod prompt;
2424 mod splits;
2525}
helix-term/tests/test/commands.rs+46
@@ -480,3 +480,49 @@ fn bar() {#(\n|)#\
480480
481481 Ok(())
482482}
483+
484+#[tokio::test(flavor = "multi_thread")]
485+async fn test_join_selections() -> anyhow::Result<()> {
486+ // normal join
487+ test((
488+ platform_line(indoc! {"\
489+ #[a|]#bc
490+ def
491+ "}),
492+ "J",
493+ platform_line(indoc! {"\
494+ #[a|]#bc def
495+ "}),
496+ ))
497+ .await?;
498+
499+ // join with empty line
500+ test((
501+ platform_line(indoc! {"\
502+ #[a|]#bc
503+
504+ def
505+ "}),
506+ "JJ",
507+ platform_line(indoc! {"\
508+ #[a|]#bc def
509+ "}),
510+ ))
511+ .await?;
512+
513+ // join with additional space in non-empty line
514+ test((
515+ platform_line(indoc! {"\
516+ #[a|]#bc
517+
518+ def
519+ "}),
520+ "JJ",
521+ platform_line(indoc! {"\
522+ #[a|]#bc def
523+ "}),
524+ ))
525+ .await?;
526+
527+ Ok(())
528+}
helix-term/tests/test/commands/write.rs+122−3
@@ -93,7 +93,7 @@ async fn test_buffer_close_concurrent() -> anyhow::Result<()> {
9393 )
9494 .await?;
9595
96− helpers::assert_file_has_content(file.as_file_mut(), &RANGE.end().to_string())?;
96+ helpers::assert_file_has_content(file.as_file_mut(), &platform_line(&RANGE.end().to_string()))?;
9797
9898 Ok(())
9999}
@@ -209,7 +209,7 @@ async fn test_write_concurrent() -> anyhow::Result<()> {
209209
210210 let mut file_content = String::new();
211211 file.as_file_mut().read_to_string(&mut file_content)?;
212− assert_eq!(RANGE.end().to_string(), file_content);
212+ assert_eq!(platform_line(&RANGE.end().to_string()), file_content);
213213
214214 Ok(())
215215}
@@ -424,13 +424,132 @@ async fn test_write_utf_bom_file() -> anyhow::Result<()> {
424424 Ok(())
425425}
426426
427+#[tokio::test(flavor = "multi_thread")]
428+async fn test_write_insert_final_newline_added_if_missing() -> anyhow::Result<()> {
429+ let mut file = tempfile::NamedTempFile::new()?;
430+ let mut app = helpers::AppBuilder::new()
431+ .with_file(file.path(), None)
432+ .with_input_text("#[h|]#ave you tried chamomile tea?")
433+ .build()?;
434+
435+ test_key_sequence(&mut app, Some(":w<ret>"), None, false).await?;
436+
437+ helpers::assert_file_has_content(
438+ file.as_file_mut(),
439+ &helpers::platform_line("have you tried chamomile tea?\n"),
440+ )?;
441+
442+ Ok(())
443+}
444+
445+#[tokio::test(flavor = "multi_thread")]
446+async fn test_write_insert_final_newline_unchanged_if_not_missing() -> anyhow::Result<()> {
447+ let mut file = tempfile::NamedTempFile::new()?;
448+ let mut app = helpers::AppBuilder::new()
449+ .with_file(file.path(), None)
450+ .with_input_text(&helpers::platform_line("#[t|]#en minutes, please\n"))
451+ .build()?;
452+
453+ test_key_sequence(&mut app, Some(":w<ret>"), None, false).await?;
454+
455+ helpers::assert_file_has_content(
456+ file.as_file_mut(),
457+ &helpers::platform_line("ten minutes, please\n"),
458+ )?;
459+
460+ Ok(())
461+}
462+
463+#[tokio::test(flavor = "multi_thread")]
464+async fn test_write_insert_final_newline_unchanged_if_missing_and_false() -> anyhow::Result<()> {
465+ let mut file = tempfile::NamedTempFile::new()?;
466+ let mut app = helpers::AppBuilder::new()
467+ .with_config(Config {
468+ editor: helix_view::editor::Config {
469+ insert_final_newline: false,
470+ ..Default::default()
471+ },
472+ ..Default::default()
473+ })
474+ .with_file(file.path(), None)
475+ .with_input_text("#[t|]#he quiet rain continued through the night")
476+ .build()?;
477+
478+ test_key_sequence(&mut app, Some(":w<ret>"), None, false).await?;
479+
480+ helpers::assert_file_has_content(
481+ file.as_file_mut(),
482+ "the quiet rain continued through the night",
483+ )?;
484+
485+ Ok(())
486+}
487+
488+#[tokio::test(flavor = "multi_thread")]
489+async fn test_write_all_insert_final_newline_add_if_missing_and_modified() -> anyhow::Result<()> {
490+ let mut file1 = tempfile::NamedTempFile::new()?;
491+ let mut file2 = tempfile::NamedTempFile::new()?;
492+ let mut app = helpers::AppBuilder::new()
493+ .with_file(file1.path(), None)
494+ .with_input_text("#[w|]#e don't serve time travelers here")
495+ .build()?;
496+
497+ test_key_sequence(
498+ &mut app,
499+ Some(&format!(
500+ ":o {}<ret>ia time traveler walks into a bar<esc>:wa<ret>",
501+ file2.path().to_string_lossy()
502+ )),
503+ None,
504+ false,
505+ )
506+ .await?;
507+
508+ helpers::assert_file_has_content(
509+ file1.as_file_mut(),
510+ &helpers::platform_line("we don't serve time travelers here\n"),
511+ )?;
512+
513+ helpers::assert_file_has_content(
514+ file2.as_file_mut(),
515+ &helpers::platform_line("a time traveler walks into a bar\n"),
516+ )?;
517+
518+ Ok(())
519+}
520+
521+#[tokio::test(flavor = "multi_thread")]
522+async fn test_write_all_insert_final_newline_do_not_add_if_unmodified() -> anyhow::Result<()> {
523+ let mut file = tempfile::NamedTempFile::new()?;
524+ let mut app = helpers::AppBuilder::new()
525+ .with_file(file.path(), None)
526+ .build()?;
527+
528+ file.write_all(b"i lost on Jeopardy!")?;
529+ file.rewind()?;
530+
531+ test_key_sequence(&mut app, Some(":wa<ret>"), None, false).await?;
532+
533+ helpers::assert_file_has_content(file.as_file_mut(), "i lost on Jeopardy!")?;
534+
535+ Ok(())
536+}
537+
427538async fn edit_file_with_content(file_content: &[u8]) -> anyhow::Result<()> {
428539 let mut file = tempfile::NamedTempFile::new()?;
429540
430541 file.as_file_mut().write_all(&file_content)?;
431542
432543 helpers::test_key_sequence(
433− &mut helpers::AppBuilder::new().build()?,
544+ &mut helpers::AppBuilder::new()
545+ .with_config(Config {
546+ editor: helix_view::editor::Config {
547+ insert_final_newline: false,
548+ ..Default::default()
549+ },
550+ ..Default::default()
551+ })
552+ .build()?,
434553 Some(&format!(":o {}<ret>:x<ret>", file.path().to_string_lossy())),
435554 None,
436555 true,
helix-term/tests/test/helpers.rs+9−1
@@ -320,6 +320,14 @@ impl AppBuilder {
320320 }
321321
322322 pub fn build(self) -> anyhow::Result<Application> {
323+ if let Some(path) = &self.args.working_directory {
324+ bail!("Changing the working directory to {path:?} is not yet supported for integration tests");
325+ }
326+
327+ if let Some((path, _)) = self.args.files.first().filter(|p| p.0.is_dir()) {
328+ bail!("Having the directory {path:?} in args.files[0] is not yet supported for integration tests");
329+ }
330+
323331 let mut app = Application::new(self.args, self.config, self.syn_conf)?;
324332
325333 if let Some((text, selection)) = self.input {
@@ -350,7 +358,7 @@ pub fn assert_file_has_content(file: &mut File, content: &str) -> anyhow::Result
350358
351359 let mut file_content = String::new();
352360 file.read_to_string(&mut file_content)?;
353− assert_eq!(content, file_content);
361+ assert_eq!(file_content, content);
354362
355363 Ok(())
356364}
helix-term/tests/test/languages/go.rsnew file+41
@@ -0,0 +1,41 @@
1+use super::*;
2+
3+#[tokio::test(flavor = "multi_thread")]
4+async fn auto_indent() -> anyhow::Result<()> {
5+ let app = || AppBuilder::new().with_file("foo.go", None);
6+
7+ let enter_tests = [
8+ (
9+ helpers::platform_line(indoc! {r##"
10+ type Test struct {#[}|]#
11+ "##}),
12+ "i<ret>",
13+ helpers::platform_line(indoc! {"\
14+ type Test struct {
15+ \t#[|\n]#
16+ }
17+ "}),
18+ ),
19+ (
20+ helpers::platform_line(indoc! {"\
21+ func main() {
22+ \tswitch nil {#[}|]#
23+ }
24+ "}),
25+ "i<ret>",
26+ helpers::platform_line(indoc! {"\
27+ func main() {
28+ \tswitch nil {
29+ \t\t#[|\n]#
30+ \t}
31+ }
32+ "}),
33+ ),
34+ ];
35+
36+ for test in enter_tests {
37+ test_with_config(app(), test).await?;
38+ }
39+
40+ Ok(())
41+}
helix-term/tests/test/languages/mod.rsnew file+4
@@ -0,0 +1,4 @@
1+use super::*;
2+
3+mod go;
4+mod yaml;
helix-term/tests/test/languages/yaml.rsnew file+819
@@ -0,0 +1,819 @@
1+use super::*;
2+
3+#[tokio::test(flavor = "multi_thread")]
4+async fn auto_indent() -> anyhow::Result<()> {
5+ let app = || AppBuilder::new().with_file("foo.yaml", None);
6+
7+ let below_tests = [
8+ (
9+ helpers::platform_line(indoc! {r##"
10+ #[t|]#op:
11+ baz: foo
12+ bazi:
13+ more: yes
14+ why: because
15+ quux:
16+ - 1
17+ - 2
18+ bax: foox
19+ fook:
20+ "##}),
21+ "o",
22+ helpers::platform_line(indoc! {"\
23+ top:
24+ #[\n|]#
25+ baz: foo
26+ bazi:
27+ more: yes
28+ why: because
29+ quux:
30+ - 1
31+ - 2
32+ bax: foox
33+ fook:
34+ "}),
35+ ),
36+ (
37+ helpers::platform_line(indoc! {r##"
38+ top:
39+ b#[a|]#z: foo
40+ bazi:
41+ more: yes
42+ why: because
43+ quux:
44+ - 1
45+ - 2
46+ bax: foox
47+ fook:
48+ "##}),
49+ "o",
50+ helpers::platform_line(indoc! {"\
51+ top:
52+ baz: foo
53+ #[\n|]#
54+ bazi:
55+ more: yes
56+ why: because
57+ quux:
58+ - 1
59+ - 2
60+ bax: foox
61+ fook:
62+ "}),
63+ ),
64+ (
65+ helpers::platform_line(indoc! {r##"
66+ top:
67+ baz: foo
68+ bazi#[:|]#
69+ more: yes
70+ why: because
71+ quux:
72+ - 1
73+ - 2
74+ bax: foox
75+ fook:
76+ "##}),
77+ "o",
78+ helpers::platform_line(indoc! {"\
79+ top:
80+ baz: foo
81+ bazi:
82+ #[\n|]#
83+ more: yes
84+ why: because
85+ quux:
86+ - 1
87+ - 2
88+ bax: foox
89+ fook:
90+ "}),
91+ ),
92+ (
93+ helpers::platform_line(indoc! {r##"
94+ top:
95+ baz: foo
96+ bazi:
97+ more: #[yes|]#
98+ why: because
99+ quux:
100+ - 1
101+ - 2
102+ bax: foox
103+ fook:
104+ "##}),
105+ "o",
106+ helpers::platform_line(indoc! {"\
107+ top:
108+ baz: foo
109+ bazi:
110+ more: yes
111+ #[\n|]#
112+ why: because
113+ quux:
114+ - 1
115+ - 2
116+ bax: foox
117+ fook:
118+ "}),
119+ ),
120+ (
121+ helpers::platform_line(indoc! {r##"
122+ top:
123+ baz: foo
124+ bazi:
125+ more: yes
126+ why: becaus#[e|]#
127+ quux:
128+ - 1
129+ - 2
130+ bax: foox
131+ fook:
132+ "##}),
133+ "o",
134+ helpers::platform_line(indoc! {"\
135+ top:
136+ baz: foo
137+ bazi:
138+ more: yes
139+ why: because
140+ #[\n|]#
141+ quux:
142+ - 1
143+ - 2
144+ bax: foox
145+ fook:
146+ "}),
147+ ),
148+ (
149+ helpers::platform_line(indoc! {"\
150+ top:
151+ baz: foo
152+ bazi:
153+ more: yes
154+ why: because
155+ quux:#[\n|]#
156+ - 1
157+ - 2
158+ bax: foox
159+ fook:
160+ "}),
161+ "o",
162+ helpers::platform_line(indoc! {"\
163+ top:
164+ baz: foo
165+ bazi:
166+ more: yes
167+ why: because
168+ quux:
169+ #[\n|]#
170+ - 1
171+ - 2
172+ bax: foox
173+ fook:
174+ "}),
175+ ),
176+ (
177+ helpers::platform_line(indoc! {"\
178+ top:
179+ baz: foo
180+ bazi:
181+ more: yes
182+ why: because
183+ quux:
184+ - 1#[\n|]#
185+ - 2
186+ bax: foox
187+ fook:
188+ "}),
189+ "o",
190+ helpers::platform_line(indoc! {"\
191+ top:
192+ baz: foo
193+ bazi:
194+ more: yes
195+ why: because
196+ quux:
197+ - 1
198+ #[\n|]#
199+ - 2
200+ bax: foox
201+ fook:
202+ "}),
203+ ),
204+ (
205+ helpers::platform_line(indoc! {"\
206+ top:
207+ baz: foo
208+ bazi:
209+ more: yes
210+ why: because
211+ quux:
212+ - 1
213+ - 2
214+ bax: foox
215+ fook:#[\n|]#
216+ "}),
217+ "o",
218+ helpers::platform_line(indoc! {"\
219+ top:
220+ baz: foo
221+ bazi:
222+ more: yes
223+ why: because
224+ quux:
225+ - 1
226+ - 2
227+ bax: foox
228+ fook:
229+ #[\n|]#
230+ "}),
231+ ),
232+ (
233+ helpers::platform_line(indoc! {"\
234+ top:
235+ baz: foo
236+ bax: |
237+ some
238+ multi
239+ line
240+ string#[\n|]#
241+ fook:
242+ "}),
243+ "o",
244+ helpers::platform_line(indoc! {"\
245+ top:
246+ baz: foo
247+ bax: |
248+ some
249+ multi
250+ line
251+ string
252+ #[\n|]#
253+ fook:
254+ "}),
255+ ),
256+ (
257+ helpers::platform_line(indoc! {"\
258+ top:
259+ baz: foo
260+ bax: >
261+ some
262+ multi
263+ line#[\n|]#
264+ string
265+ fook:
266+ "}),
267+ "o",
268+ helpers::platform_line(indoc! {"\
269+ top:
270+ baz: foo
271+ bax: >
272+ some
273+ multi
274+ line
275+ #[\n|]#
276+ string
277+ fook:
278+ "}),
279+ ),
280+ (
281+ helpers::platform_line(indoc! {"\
282+ top:
283+ baz: foo
284+ bax: >#[\n|]#
285+ fook:
286+ "}),
287+ "o",
288+ helpers::platform_line(indoc! {"\
289+ top:
290+ baz: foo
291+ bax: >
292+ #[\n|]#
293+ fook:
294+ "}),
295+ ),
296+ (
297+ helpers::platform_line(indoc! {"\
298+ - top:#[\n|]#
299+ baz: foo
300+ bax: foox
301+ fook:
302+ "}),
303+ "o",
304+ helpers::platform_line(indoc! {"\
305+ - top:
306+ #[\n|]#
307+ baz: foo
308+ bax: foox
309+ fook:
310+ "}),
311+ ),
312+ (
313+ helpers::platform_line(indoc! {"\
314+ - top:
315+ baz: foo#[\n|]#
316+ bax: foox
317+ fook:
318+ "}),
319+ "o",
320+ helpers::platform_line(indoc! {"\
321+ - top:
322+ baz: foo
323+ #[\n|]#
324+ bax: foox
325+ fook:
326+ "}),
327+ ),
328+ (
329+ helpers::platform_line(indoc! {"\
330+ - top:
331+ baz: foo
332+ bax: foox#[\n|]#
333+ fook:
334+ "}),
335+ "o",
336+ helpers::platform_line(indoc! {"\
337+ - top:
338+ baz: foo
339+ bax: foox
340+ #[\n|]#
341+ fook:
342+ "}),
343+ ),
344+ (
345+ helpers::platform_line(indoc! {"\
346+ top:
347+ baz:
348+ - one: two#[\n|]#
349+ three: four
350+ - top:
351+ baz: foo
352+ bax: foox
353+ "}),
354+ "o",
355+ helpers::platform_line(indoc! {"\
356+ top:
357+ baz:
358+ - one: two
359+ #[\n|]#
360+ three: four
361+ - top:
362+ baz: foo
363+ bax: foox
364+ "}),
365+ ),
366+ // yaml map without a key
367+ (
368+ helpers::platform_line(indoc! {"\
369+ top:#[\n|]#
370+ "}),
371+ "o",
372+ helpers::platform_line(indoc! {"\
373+ top:
374+ #[\n|]#
375+ "}),
376+ ),
377+ (
378+ helpers::platform_line(indoc! {"\
379+ top#[:|]#
380+ bottom: withvalue
381+ "}),
382+ "o",
383+ helpers::platform_line(indoc! {"\
384+ top:
385+ #[\n|]#
386+ bottom: withvalue
387+ "}),
388+ ),
389+ (
390+ helpers::platform_line(indoc! {"\
391+ bottom: withvalue
392+ top#[:|]#
393+ "}),
394+ "o",
395+ helpers::platform_line(indoc! {"\
396+ bottom: withvalue
397+ top:
398+ #[\n|]#
399+ "}),
400+ ),
401+ ];
402+
403+ for test in below_tests {
404+ test_with_config(app(), test).await?;
405+ }
406+
407+ let above_tests = [
408+ (
409+ helpers::platform_line(indoc! {r##"
410+ #[t|]#op:
411+ baz: foo
412+ bazi:
413+ more: yes
414+ why: because
415+ quux:
416+ - 1
417+ - 2
418+ bax: foox
419+ fook:
420+ "##}),
421+ "O",
422+ helpers::platform_line(indoc! {"\
423+ #[\n|]#
424+ top:
425+ baz: foo
426+ bazi:
427+ more: yes
428+ why: because
429+ quux:
430+ - 1
431+ - 2
432+ bax: foox
433+ fook:
434+ "}),
435+ ),
436+ (
437+ helpers::platform_line(indoc! {r##"
438+ top:
439+ b#[a|]#z: foo
440+ bazi:
441+ more: yes
442+ why: because
443+ quux:
444+ - 1
445+ - 2
446+ bax: foox
447+ fook:
448+ "##}),
449+ "O",
450+ helpers::platform_line(indoc! {"\
451+ top:
452+ #[\n|]#
453+ baz: foo
454+ bazi:
455+ more: yes
456+ why: because
457+ quux:
458+ - 1
459+ - 2
460+ bax: foox
461+ fook:
462+ "}),
463+ ),
464+ (
465+ helpers::platform_line(indoc! {r##"
466+ top:
467+ baz: foo
468+ bazi#[:|]#
469+ more: yes
470+ why: because
471+ quux:
472+ - 1
473+ - 2
474+ bax: foox
475+ fook:
476+ "##}),
477+ "O",
478+ helpers::platform_line(indoc! {"\
479+ top:
480+ baz: foo
481+ #[\n|]#
482+ bazi:
483+ more: yes
484+ why: because
485+ quux:
486+ - 1
487+ - 2
488+ bax: foox
489+ fook:
490+ "}),
491+ ),
492+ (
493+ helpers::platform_line(indoc! {r##"
494+ top:
495+ baz: foo
496+ bazi:
497+ more: #[yes|]#
498+ why: because
499+ quux:
500+ - 1
501+ - 2
502+ bax: foox
503+ fook:
504+ "##}),
505+ "O",
506+ helpers::platform_line(indoc! {"\
507+ top:
508+ baz: foo
509+ bazi:
510+ #[\n|]#
511+ more: yes
512+ why: because
513+ quux:
514+ - 1
515+ - 2
516+ bax: foox
517+ fook:
518+ "}),
519+ ),
520+ (
521+ helpers::platform_line(indoc! {r##"
522+ top:
523+ baz: foo
524+ bazi:
525+ more: yes
526+ why: becaus#[e|]#
527+ quux:
528+ - 1
529+ - 2
530+ bax: foox
531+ fook:
532+ "##}),
533+ "O",
534+ helpers::platform_line(indoc! {"\
535+ top:
536+ baz: foo
537+ bazi:
538+ more: yes
539+ #[\n|]#
540+ why: because
541+ quux:
542+ - 1
543+ - 2
544+ bax: foox
545+ fook:
546+ "}),
547+ ),
548+ (
549+ helpers::platform_line(indoc! {"\
550+ top:
551+ baz: foo
552+ bazi:
553+ more: yes
554+ why: because
555+ quux:#[\n|]#
556+ - 1
557+ - 2
558+ bax: foox
559+ fook:
560+ "}),
561+ "O",
562+ helpers::platform_line(indoc! {"\
563+ top:
564+ baz: foo
565+ bazi:
566+ more: yes
567+ why: because
568+ #[\n|]#
569+ quux:
570+ - 1
571+ - 2
572+ bax: foox
573+ fook:
574+ "}),
575+ ),
576+ (
577+ helpers::platform_line(indoc! {"\
578+ top:
579+ baz: foo
580+ bazi:
581+ more: yes
582+ why: because
583+ quux:
584+ - 1#[\n|]#
585+ - 2
586+ bax: foox
587+ fook:
588+ "}),
589+ "O",
590+ helpers::platform_line(indoc! {"\
591+ top:
592+ baz: foo
593+ bazi:
594+ more: yes
595+ why: because
596+ quux:
597+ #[\n|]#
598+ - 1
599+ - 2
600+ bax: foox
601+ fook:
602+ "}),
603+ ),
604+ (
605+ helpers::platform_line(indoc! {"\
606+ top:
607+ baz: foo
608+ bazi:
609+ more: yes
610+ why: because
611+ quux:
612+ - 1
613+ - 2
614+ bax: foox
615+ fook:#[\n|]#
616+ "}),
617+ "O",
618+ helpers::platform_line(indoc! {"\
619+ top:
620+ baz: foo
621+ bazi:
622+ more: yes
623+ why: because
624+ quux:
625+ - 1
626+ - 2
627+ bax: foox
628+ #[\n|]#
629+ fook:
630+ "}),
631+ ),
632+ (
633+ helpers::platform_line(indoc! {"\
634+ top:
635+ baz: foo
636+ bax: |
637+ some
638+ multi
639+ line
640+ string#[\n|]#
641+ fook:
642+ "}),
643+ "O",
644+ helpers::platform_line(indoc! {"\
645+ top:
646+ baz: foo
647+ bax: |
648+ some
649+ multi
650+ line
651+ #[\n|]#
652+ string
653+ fook:
654+ "}),
655+ ),
656+ (
657+ helpers::platform_line(indoc! {"\
658+ top:
659+ baz: foo
660+ bax: >
661+ some#[\n|]#
662+ multi
663+ line
664+ string
665+ fook:
666+ "}),
667+ "O",
668+ helpers::platform_line(indoc! {"\
669+ top:
670+ baz: foo
671+ bax: >
672+ #[\n|]#
673+ some
674+ multi
675+ line
676+ string
677+ fook:
678+ "}),
679+ ),
680+ (
681+ helpers::platform_line(indoc! {"\
682+ top:
683+ baz: foo
684+ bax: >
685+ fook:#[\n|]#
686+ "}),
687+ "O",
688+ helpers::platform_line(indoc! {"\
689+ top:
690+ baz: foo
691+ bax: >
692+ #[\n|]#
693+ fook:
694+ "}),
695+ ),
696+ (
697+ helpers::platform_line(indoc! {"\
698+ - top:
699+ baz: foo#[\n|]#
700+ bax: foox
701+ fook:
702+ "}),
703+ "O",
704+ helpers::platform_line(indoc! {"\
705+ - top:
706+ #[\n|]#
707+ baz: foo
708+ bax: foox
709+ fook:
710+ "}),
711+ ),
712+ (
713+ helpers::platform_line(indoc! {"\
714+ - top:
715+ baz: foo
716+ bax: foox
717+ fook:#[\n|]#
718+ "}),
719+ "O",
720+ helpers::platform_line(indoc! {"\
721+ - top:
722+ baz: foo
723+ bax: foox
724+ #[\n|]#
725+ fook:
726+ "}),
727+ ),
728+ (
729+ helpers::platform_line(indoc! {"\
730+ top:
731+ baz:
732+ - one: two#[\n|]#
733+ three: four
734+ - top:
735+ baz: foo
736+ bax: foox
737+ "}),
738+ "O",
739+ helpers::platform_line(indoc! {"\
740+ top:
741+ baz:
742+ #[\n|]#
743+ - one: two
744+ three: four
745+ - top:
746+ baz: foo
747+ bax: foox
748+ "}),
749+ ),
750+ // yaml map without a key
751+ (
752+ helpers::platform_line(indoc! {"\
753+ top:#[\n|]#
754+ "}),
755+ "O",
756+ helpers::platform_line(indoc! {"\
757+ #[\n|]#
758+ top:
759+ "}),
760+ ),
761+ (
762+ helpers::platform_line(indoc! {"\
763+ bottom: withvalue
764+ top#[:|]#
765+ "}),
766+ "O",
767+ helpers::platform_line(indoc! {"\
768+ bottom: withvalue
769+ #[\n|]#
770+ top:
771+ "}),
772+ ),
773+ (
774+ helpers::platform_line(indoc! {"\
775+ top:
776+ bottom:#[ |]#withvalue
777+ "}),
778+ "O",
779+ helpers::platform_line(indoc! {"\
780+ top:
781+ #[\n|]#
782+ bottom: withvalue
783+ "}),
784+ ),
785+ ];
786+
787+ for test in above_tests {
788+ test_with_config(app(), test).await?;
789+ }
790+
791+ let enter_tests = [
792+ (
793+ helpers::platform_line(indoc! {r##"
794+ foo: #[b|]#ar
795+ "##}),
796+ "i<ret>",
797+ helpers::platform_line(indoc! {"\
798+ foo:
799+ #[|b]#ar
800+ "}),
801+ ),
802+ (
803+ helpers::platform_line(indoc! {"\
804+ foo:#[\n|]#
805+ "}),
806+ "i<ret>",
807+ helpers::platform_line(indoc! {"\
808+ foo:
809+ #[|\n]#
810+ "}),
811+ ),
812+ ];
813+
814+ for test in enter_tests {
815+ test_with_config(app(), test).await?;
816+ }
817+
818+ Ok(())
819+}
helix-term/tests/test/movement.rs+39
@@ -513,3 +513,42 @@ async fn select_mode_tree_sitter_prev_function_goes_backwards_to_object() -> any
513513
514514 Ok(())
515515}
516+
517+#[tokio::test(flavor = "multi_thread")]
518+async fn find_char_line_ending() -> anyhow::Result<()> {
519+ test((
520+ helpers::platform_line(indoc! {
521+ "\
522+ one
523+ #[|t]#wo
524+ three"
525+ }),
526+ "T<ret>gll2f<ret>",
527+ helpers::platform_line(indoc! {
528+ "\
529+ one
530+ two#[
531+ |]#three"
532+ }),
533+ ))
534+ .await?;
535+
536+ test((
537+ helpers::platform_line(indoc! {
538+ "\
539+ #[|o]#ne
540+ two
541+ three"
542+ }),
543+ "f<ret>2t<ret>ghT<ret>F<ret>",
544+ helpers::platform_line(indoc! {
545+ "\
546+ one#[|
547+ t]#wo
548+ three"
549+ }),
550+ ))
551+ .await?;
552+
553+ Ok(())
554+}
helix-term/tests/test/picker.rsdeleted−80
@@ -1,80 +0,0 @@
1−use std::fs;
2−
3−use helix_core::{path::get_canonicalized_path, Range};
4−use helix_loader::{current_working_dir, set_current_working_dir};
5−use helix_view::{current_ref, editor::Action};
6−use tempfile::{Builder, TempDir};
7−
8−use super::*;
9−
10−#[tokio::test(flavor = "multi_thread")]
11−async fn test_picker_alt_ret() -> anyhow::Result<()> {
12− // Create two files, open the first and run a global search for a word
13− // from the second file. Press <alt-ret> to have helix open the second file in the
14− // new buffer, but not change focus. Then check whether the word is highlighted
15− // correctly and the view of the first file has not changed.
16− let tmp_dir = TempDir::new()?;
17− set_current_working_dir(tmp_dir.path().into())?;
18−
19− let mut app = AppBuilder::new().build()?;
20−
21− log::debug!(
22− "set current working directory to {:?}",
23− current_working_dir()
24− );
25−
26− // Add prefix so helix doesn't hide these files in a picker
27− let files = [
28− Builder::new().prefix("1").tempfile_in(&tmp_dir)?,
29− Builder::new().prefix("2").tempfile_in(&tmp_dir)?,
30− ];
31− let paths = files
32− .iter()
33− .map(|f| get_canonicalized_path(f.path()).unwrap())
34− .collect::<Vec<_>>();
35−
36− fs::write(&paths[0], "1\n2\n3\n4")?;
37− fs::write(&paths[1], "first\nsecond")?;
38−
39− log::debug!(
40− "created and wrote two temporary files: {:?} & {:?}",
41− paths[0],
42− paths[1]
43− );
44−
45− // Manually open to save the offset, otherwise we won't be able to change the state in the Fn trait
46− app.editor.open(files[0].path(), Action::Replace)?;
47− let view_offset = current_ref!(app.editor).0.offset;
48−
49− test_key_sequences(
50− &mut app,
51− vec![
52− (Some("<space>/"), None),
53− (Some("second<ret>"), None),
54− (
55− Some("<A-ret><esc>"),
56− Some(&|app| {
57− let (view, doc) = current_ref!(app.editor);
58− assert_eq!(doc.path().unwrap(), &paths[0]);
59− let select_ranges = doc.selection(view.id).ranges();
60− assert_eq!(select_ranges[0], Range::new(0, 1));
61− assert_eq!(view.offset, view_offset);
62− }),
63− ),
64− (
65− Some(":buffer<minus>next<ret>"),
66− Some(&|app| {
67− let (view, doc) = current_ref!(app.editor);
68− assert_eq!(doc.path().unwrap(), &paths[1]);
69− let select_ranges = doc.selection(view.id).ranges();
70− assert_eq!(select_ranges.len(), 1);
71− assert_eq!(select_ranges[0], Range::new(6, 12));
72− }),
73− ),
74− ],
75− false,
76− )
77− .await?;
78−
79− Ok(())
80−}
helix-term/tests/test/splits.rs+3−3
@@ -62,9 +62,9 @@ async fn test_split_write_quit_all() -> anyhow::Result<()> {
6262 )
6363 .await?;
6464
65− helpers::assert_file_has_content(file1.as_file_mut(), "hello1")?;
66− helpers::assert_file_has_content(file2.as_file_mut(), "hello2")?;
67− helpers::assert_file_has_content(file3.as_file_mut(), "hello3")?;
65+ helpers::assert_file_has_content(file1.as_file_mut(), &platform_line("hello1"))?;
66+ helpers::assert_file_has_content(file2.as_file_mut(), &platform_line("hello2"))?;
67+ helpers::assert_file_has_content(file3.as_file_mut(), &platform_line("hello3"))?;
6868
6969 Ok(())
7070}
helix-tui/Cargo.toml+15−15
@@ -1,28 +1,28 @@
11[package]
22name = "helix-tui"
3−version = "0.6.0"
4−authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−description = """
6−A library to build rich terminal user interfaces or dashboards
7−"""
8−edition = "2021"
9−license = "MPL-2.0"
10−categories = ["editor"]
11−repository = "https://github.com/helix-editor/helix"
12−homepage = "https://helix-editor.com"
3+description = """A library to build rich terminal user interfaces or dashboards"""
134include = ["src/**/*", "README.md"]
5+version.workspace = true
6+authors.workspace = true
7+edition.workspace = true
8+license.workspace = true
9+rust-version.workspace = true
10+categories.workspace = true
11+repository.workspace = true
12+homepage.workspace = true
1413
1514[features]
1615default = ["crossterm"]
1716
1817[dependencies]
19−bitflags = "2.3"
18+helix-view = { path = "../helix-view", features = ["term"] }
19+helix-core = { path = "../helix-core" }
20+
21+bitflags = "2.4"
2022cassowary = "0.3"
2123unicode-segmentation = "1.10"
22−crossterm = { version = "0.26", optional = true }
24+crossterm = { version = "0.27", optional = true }
2325termini = "1.0"
2426serde = { version = "1", "optional" = true, features = ["derive"]}
25−once_cell = "1.18"
27+once_cell = "1.19"
2628log = "~0.4"
27−helix-view = { version = "0.6", path = "../helix-view", features = ["term"] }
28−helix-core = { version = "0.6", path = "../helix-core" }
helix-tui/src/backend/crossterm.rs+51−33
@@ -32,10 +32,21 @@ fn vte_version() -> Option<usize> {
3232}
3333
3434/// Describes terminal capabilities like extended underline, truecolor, etc.
35−#[derive(Copy, Clone, Debug, Default)]
35+#[derive(Clone, Debug)]
3636struct Capabilities {
3737 /// Support for undercurled, underdashed, etc.
3838 has_extended_underlines: bool,
39+ /// Support for resetting the cursor style back to normal.
40+ reset_cursor_command: String,
41+}
42+
43+impl Default for Capabilities {
44+ fn default() -> Self {
45+ Self {
46+ has_extended_underlines: false,
47+ reset_cursor_command: "\x1B[0 q".to_string(),
48+ }
49+ }
3950}
4051
4152impl Capabilities {
@@ -54,6 +65,10 @@ impl Capabilities {
5465 || t.extended_cap("Su").is_some()
5566 || vte_version() >= Some(5102)
5667 || matches!(term_program().as_deref(), Some("WezTerm")),
68+ reset_cursor_command: t
69+ .utf8_string_cap(termini::StringCapability::CursorNormal)
70+ .unwrap_or("\x1B[0 q")
71+ .to_string(),
5772 },
5873 }
5974 }
@@ -154,7 +169,8 @@ where
154169
155170 fn restore(&mut self, config: Config) -> io::Result<()> {
156171 // reset cursor shape
157− write!(self.buffer, "\x1B[0 q")?;
172+ self.buffer
173+ .write_all(self.capabilities.reset_cursor_command.as_bytes())?;
158174 if config.enable_mouse_capture {
159175 execute!(self.buffer, DisableMouseCapture)?;
160176 }
@@ -201,7 +217,7 @@ where
201217 for (x, y, cell) in content {
202218 // Move the cursor if the previous location was not (x - 1, y)
203219 if !matches!(last_pos, Some(p) if x == p.0 + 1 && y == p.1) {
204− map_error(queue!(self.buffer, MoveTo(x, y)))?;
220+ queue!(self.buffer, MoveTo(x, y))?;
205221 }
206222 last_pos = Some((x, y));
207223 if cell.modifier != modifier {
@@ -214,12 +230,12 @@ where
214230 }
215231 if cell.fg != fg {
216232 let color = CColor::from(cell.fg);
217− map_error(queue!(self.buffer, SetForegroundColor(color)))?;
233+ queue!(self.buffer, SetForegroundColor(color))?;
218234 fg = cell.fg;
219235 }
220236 if cell.bg != bg {
221237 let color = CColor::from(cell.bg);
222− map_error(queue!(self.buffer, SetBackgroundColor(color)))?;
238+ queue!(self.buffer, SetBackgroundColor(color))?;
223239 bg = cell.bg;
224240 }
225241
@@ -227,7 +243,7 @@ where
227243 if self.capabilities.has_extended_underlines {
228244 if cell.underline_color != underline_color {
229245 let color = CColor::from(cell.underline_color);
230− map_error(queue!(self.buffer, SetUnderlineColor(color)))?;
246+ queue!(self.buffer, SetUnderlineColor(color))?;
231247 underline_color = cell.underline_color;
232248 }
233249 } else {
@@ -239,24 +255,24 @@ where
239255
240256 if new_underline_style != underline_style {
241257 let attr = CAttribute::from(new_underline_style);
242− map_error(queue!(self.buffer, SetAttribute(attr)))?;
258+ queue!(self.buffer, SetAttribute(attr))?;
243259 underline_style = new_underline_style;
244260 }
245261
246− map_error(queue!(self.buffer, Print(&cell.symbol)))?;
262+ queue!(self.buffer, Print(&cell.symbol))?;
247263 }
248264
249− map_error(queue!(
265+ queue!(
250266 self.buffer,
251267 SetUnderlineColor(CColor::Reset),
252268 SetForegroundColor(CColor::Reset),
253269 SetBackgroundColor(CColor::Reset),
254270 SetAttribute(CAttribute::Reset)
255− ))
271+ )
256272 }
257273
258274 fn hide_cursor(&mut self) -> io::Result<()> {
259− map_error(execute!(self.buffer, Hide))
275+ execute!(self.buffer, Hide)
260276 }
261277
262278 fn show_cursor(&mut self, kind: CursorKind) -> io::Result<()> {
@@ -266,7 +282,7 @@ where
266282 CursorKind::Underline => SetCursorStyle::SteadyUnderScore,
267283 CursorKind::Hidden => unreachable!(),
268284 };
269− map_error(execute!(self.buffer, Show, shape))
285+ execute!(self.buffer, Show, shape)
270286 }
271287
272288 fn get_cursor(&mut self) -> io::Result<(u16, u16)> {
@@ -275,11 +291,11 @@ where
275291 }
276292
277293 fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
278− map_error(execute!(self.buffer, MoveTo(x, y)))
294+ execute!(self.buffer, MoveTo(x, y))
279295 }
280296
281297 fn clear(&mut self) -> io::Result<()> {
282− map_error(execute!(self.buffer, Clear(ClearType::All)))
298+ execute!(self.buffer, Clear(ClearType::All))
283299 }
284300
285301 fn size(&self) -> io::Result<Rect> {
@@ -294,10 +310,6 @@ where
294310 }
295311}
296312
297−fn map_error(error: crossterm::Result<()>) -> io::Result<()> {
298− error.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))
299−}
300−
301313#[derive(Debug)]
302314struct ModifierDiff {
303315 pub from: Modifier,
@@ -312,48 +324,54 @@ impl ModifierDiff {
312324 //use crossterm::Attribute;
313325 let removed = self.from - self.to;
314326 if removed.contains(Modifier::REVERSED) {
315− map_error(queue!(w, SetAttribute(CAttribute::NoReverse)))?;
327+ queue!(w, SetAttribute(CAttribute::NoReverse))?;
316328 }
317329 if removed.contains(Modifier::BOLD) {
318− map_error(queue!(w, SetAttribute(CAttribute::NormalIntensity)))?;
330+ queue!(w, SetAttribute(CAttribute::NormalIntensity))?;
319331 if self.to.contains(Modifier::DIM) {
320− map_error(queue!(w, SetAttribute(CAttribute::Dim)))?;
332+ queue!(w, SetAttribute(CAttribute::Dim))?;
321333 }
322334 }
323335 if removed.contains(Modifier::ITALIC) {
324− map_error(queue!(w, SetAttribute(CAttribute::NoItalic)))?;
336+ queue!(w, SetAttribute(CAttribute::NoItalic))?;
325337 }
326338 if removed.contains(Modifier::DIM) {
327− map_error(queue!(w, SetAttribute(CAttribute::NormalIntensity)))?;
339+ queue!(w, SetAttribute(CAttribute::NormalIntensity))?;
328340 }
329341 if removed.contains(Modifier::CROSSED_OUT) {
330− map_error(queue!(w, SetAttribute(CAttribute::NotCrossedOut)))?;
342+ queue!(w, SetAttribute(CAttribute::NotCrossedOut))?;
331343 }
332344 if removed.contains(Modifier::SLOW_BLINK) || removed.contains(Modifier::RAPID_BLINK) {
333− map_error(queue!(w, SetAttribute(CAttribute::NoBlink)))?;
345+ queue!(w, SetAttribute(CAttribute::NoBlink))?;
346+ }
347+ if removed.contains(Modifier::HIDDEN) {
348+ queue!(w, SetAttribute(CAttribute::NoHidden))?;
334349 }
335350
336351 let added = self.to - self.from;
337352 if added.contains(Modifier::REVERSED) {
338− map_error(queue!(w, SetAttribute(CAttribute::Reverse)))?;
353+ queue!(w, SetAttribute(CAttribute::Reverse))?;
339354 }
340355 if added.contains(Modifier::BOLD) {
341− map_error(queue!(w, SetAttribute(CAttribute::Bold)))?;
356+ queue!(w, SetAttribute(CAttribute::Bold))?;
342357 }
343358 if added.contains(Modifier::ITALIC) {
344− map_error(queue!(w, SetAttribute(CAttribute::Italic)))?;
359+ queue!(w, SetAttribute(CAttribute::Italic))?;
345360 }
346361 if added.contains(Modifier::DIM) {
347− map_error(queue!(w, SetAttribute(CAttribute::Dim)))?;
362+ queue!(w, SetAttribute(CAttribute::Dim))?;
348363 }
349364 if added.contains(Modifier::CROSSED_OUT) {
350− map_error(queue!(w, SetAttribute(CAttribute::CrossedOut)))?;
365+ queue!(w, SetAttribute(CAttribute::CrossedOut))?;
351366 }
352367 if added.contains(Modifier::SLOW_BLINK) {
353− map_error(queue!(w, SetAttribute(CAttribute::SlowBlink)))?;
368+ queue!(w, SetAttribute(CAttribute::SlowBlink))?;
354369 }
355370 if added.contains(Modifier::RAPID_BLINK) {
356− map_error(queue!(w, SetAttribute(CAttribute::RapidBlink)))?;
371+ queue!(w, SetAttribute(CAttribute::RapidBlink))?;
372+ }
373+ if added.contains(Modifier::HIDDEN) {
374+ queue!(w, SetAttribute(CAttribute::Hidden))?;
357375 }
358376
359377 Ok(())
@@ -407,7 +425,7 @@ impl Command for SetUnderlineColor {
407425 }
408426
409427 #[cfg(windows)]
410− fn execute_winapi(&self) -> crossterm::Result<()> {
428+ fn execute_winapi(&self) -> io::Result<()> {
411429 Err(std::io::Error::new(
412430 std::io::ErrorKind::Other,
413431 "SetUnderlineColor not supported by winapi.",
helix-tui/src/buffer.rs+2−2
@@ -213,7 +213,7 @@ impl Buffer {
213213 && y < self.area.bottom()
214214 }
215215
216− /// Returns the index in the Vec<Cell> for the given global (x, y) coordinates.
216+ /// Returns the index in the `Vec<Cell>` for the given global (x, y) coordinates.
217217 ///
218218 /// Global coordinates are offset by the Buffer's area offset (`x`/`y`).
219219 ///
@@ -242,7 +242,7 @@ impl Buffer {
242242 ((y - self.area.y) as usize) * (self.area.width as usize) + ((x - self.area.x) as usize)
243243 }
244244
245− /// Returns the index in the Vec<Cell> for the given global (x, y) coordinates,
245+ /// Returns the index in the `Vec<Cell>` for the given global (x, y) coordinates,
246246 /// or `None` if the coordinates are outside the buffer's area.
247247 fn index_of_opt(&self, x: u16, y: u16) -> Option<usize> {
248248 if self.in_bounds(x, y) {
helix-tui/src/terminal.rs−14
@@ -65,20 +65,6 @@ where
6565 viewport: Viewport,
6666}
6767
68−impl<B> Drop for Terminal<B>
69−where
70− B: Backend,
71−{
72− fn drop(&mut self) {
73− // Attempt to restore the cursor state
74− if self.cursor_kind == CursorKind::Hidden {
75− if let Err(err) = self.show_cursor(CursorKind::Block) {
76− eprintln!("Failed to show the cursor: {}", err);
77− }
78− }
79− }
80−}
81−
8268impl<B> Terminal<B>
8369where
8470 B: Backend,
helix-vcs/Cargo.toml+12−10
@@ -1,23 +1,25 @@
11[package]
22name = "helix-vcs"
3−version = "0.6.0"
4−authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2021"
6−license = "MPL-2.0"
7−categories = ["editor"]
8−repository = "https://github.com/helix-editor/helix"
9−homepage = "https://helix-editor.com"
3+version.workspace = true
4+authors.workspace = true
5+edition.workspace = true
6+license.workspace = true
7+rust-version.workspace = true
8+categories.workspace = true
9+repository.workspace = true
10+homepage.workspace = true
1011
1112# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1213
1314[dependencies]
14−helix-core = { version = "0.6", path = "../helix-core" }
15+helix-core = { path = "../helix-core" }
16+helix-event = { path = "../helix-event" }
1517
1618tokio = { version = "1", features = ["rt", "rt-multi-thread", "time", "sync", "parking_lot", "macros"] }
1719parking_lot = "0.12"
1820arc-swap = { version = "1.6.0" }
1921
20−gix = { version = "0.48.0", default-features = false , optional = true }
22+gix = { version = "0.57.0", default-features = false , optional = true }
2123imara-diff = "0.1.5"
2224anyhow = "1"
2325
@@ -27,4 +29,4 @@ log = "0.4"
2729git = ["gix"]
2830
2931[dev-dependencies]
30−tempfile = "3.7"
32+tempfile = "3.8"
helix-vcs/src/diff.rs+6−19
@@ -2,10 +2,10 @@ use std::ops::Range;
22use std::sync::Arc;
33
44use helix_core::Rope;
5+use helix_event::RenderLockGuard;
56use imara_diff::Algorithm;
67use parking_lot::{Mutex, MutexGuard};
78use tokio::sync::mpsc::{unbounded_channel, UnboundedSender};
8−use tokio::sync::{Notify, OwnedRwLockReadGuard, RwLock};
99use tokio::task::JoinHandle;
1010use tokio::time::Instant;
1111
@@ -14,11 +14,9 @@ use crate::diff::worker::DiffWorker;
1414mod line_cache;
1515mod worker;
1616
17−type RedrawHandle = (Arc<Notify>, Arc<RwLock<()>>);
18−
1917/// A rendering lock passed to the differ the prevents redraws from occurring
2018struct RenderLock {
21− pub lock: OwnedRwLockReadGuard<()>,
19+ pub lock: RenderLockGuard,
2220 pub timeout: Option<Instant>,
2321}
2422
@@ -38,28 +36,22 @@ struct DiffInner {
3836#[derive(Clone, Debug)]
3937pub struct DiffHandle {
4038 channel: UnboundedSender<Event>,
41− render_lock: Arc<RwLock<()>>,
4239 diff: Arc<Mutex<DiffInner>>,
4340 inverted: bool,
4441}
4542
4643impl DiffHandle {
47− pub fn new(diff_base: Rope, doc: Rope, redraw_handle: RedrawHandle) -> DiffHandle {
48− DiffHandle::new_with_handle(diff_base, doc, redraw_handle).0
44+ pub fn new(diff_base: Rope, doc: Rope) -> DiffHandle {
45+ DiffHandle::new_with_handle(diff_base, doc).0
4946 }
5047
51− fn new_with_handle(
52− diff_base: Rope,
53− doc: Rope,
54− redraw_handle: RedrawHandle,
55− ) -> (DiffHandle, JoinHandle<()>) {
48+ fn new_with_handle(diff_base: Rope, doc: Rope) -> (DiffHandle, JoinHandle<()>) {
5649 let (sender, receiver) = unbounded_channel();
5750 let diff: Arc<Mutex<DiffInner>> = Arc::default();
5851 let worker = DiffWorker {
5952 channel: receiver,
6053 diff: diff.clone(),
6154 new_hunks: Vec::default(),
62− redraw_notify: redraw_handle.0,
6355 diff_finished_notify: Arc::default(),
6456 };
6557 let handle = tokio::spawn(worker.run(diff_base, doc));
@@ -67,7 +59,6 @@ impl DiffHandle {
6759 channel: sender,
6860 diff,
6961 inverted: false,
70− render_lock: redraw_handle.1,
7162 };
7263 (differ, handle)
7364 }
@@ -87,11 +78,7 @@ impl DiffHandle {
8778 /// This function is only intended to be called from within the rendering loop
8879 /// if called from elsewhere it may fail to acquire the render lock and panic
8980 pub fn update_document(&self, doc: Rope, block: bool) -> bool {
90− // unwrap is ok here because the rendering lock is
91− // only exclusively locked during redraw.
92− // This function is only intended to be called
93− // from the core rendering loop where no redraw can happen in parallel
94− let lock = self.render_lock.clone().try_read_owned().unwrap();
81+ let lock = helix_event::lock_frame();
9582 let timeout = if block {
9683 None
9784 } else {
helix-vcs/src/diff/worker.rs+3−9
@@ -23,7 +23,6 @@ pub(super) struct DiffWorker {
2323 pub channel: UnboundedReceiver<Event>,
2424 pub diff: Arc<Mutex<DiffInner>>,
2525 pub new_hunks: Vec<Hunk>,
26− pub redraw_notify: Arc<Notify>,
2726 pub diff_finished_notify: Arc<Notify>,
2827}
2928
@@ -32,11 +31,7 @@ impl DiffWorker {
3231 let mut accumulator = EventAccumulator::new();
3332 accumulator.handle_event(event).await;
3433 accumulator
35− .accumulate_debounced_events(
36− &mut self.channel,
37− self.redraw_notify.clone(),
38− self.diff_finished_notify.clone(),
39− )
34+ .accumulate_debounced_events(&mut self.channel, self.diff_finished_notify.clone())
4035 .await;
4136 (accumulator.doc, accumulator.diff_base)
4237 }
@@ -137,7 +132,6 @@ impl<'a> EventAccumulator {
137132 async fn accumulate_debounced_events(
138133 &mut self,
139134 channel: &mut UnboundedReceiver<Event>,
140− redraw_notify: Arc<Notify>,
141135 diff_finished_notify: Arc<Notify>,
142136 ) {
143137 let async_debounce = Duration::from_millis(DIFF_DEBOUNCE_TIME_ASYNC);
@@ -164,7 +158,7 @@ impl<'a> EventAccumulator {
164158 None => {
165159 tokio::spawn(async move {
166160 diff_finished_notify.notified().await;
167− redraw_notify.notify_one();
161+ helix_event::request_redraw();
168162 });
169163 }
170164 // diff is performed inside the rendering loop
@@ -190,7 +184,7 @@ impl<'a> EventAccumulator {
190184 // and wait until the diff occurs to trigger an async redraw
191185 log::info!("Diff computation timed out, update of diffs might appear delayed");
192186 diff_finished_notify.notified().await;
193− redraw_notify.notify_one();
187+ helix_event::request_redraw()
194188 });
195189 }
196190 // a blocking diff is performed inside the rendering loop
helix-vcs/src/diff/worker/test.rs+1−5
@@ -5,11 +5,7 @@ use crate::diff::{DiffHandle, Hunk};
55
66impl DiffHandle {
77 fn new_test(diff_base: &str, doc: &str) -> (DiffHandle, JoinHandle<()>) {
8− DiffHandle::new_with_handle(
9− Rope::from_str(diff_base),
10− Rope::from_str(doc),
11− Default::default(),
12− )
8+ DiffHandle::new_with_handle(Rope::from_str(diff_base), Rope::from_str(doc))
139 }
1410 async fn into_diff(self, handle: JoinHandle<()>) -> Vec<Hunk> {
1511 let diff = self.diff;
helix-vcs/src/git.rs+5−5
@@ -3,7 +3,7 @@ use arc_swap::ArcSwap;
33use std::path::Path;
44use std::sync::Arc;
55
6−use gix::objs::tree::EntryMode;
6+use gix::objs::tree::EntryKind;
77use gix::sec::trust::DefaultForLevel;
88use gix::{Commit, ObjectId, Repository, ThreadSafeRepository};
99
@@ -126,14 +126,14 @@ fn find_file_in_commit(repo: &Repository, commit: &Commit, file: &Path) -> Resul
126126 let rel_path = file.strip_prefix(repo_dir)?;
127127 let tree = commit.tree()?;
128128 let tree_entry = tree
129− .lookup_entry_by_path(rel_path)?
129+ .lookup_entry_by_path(rel_path, &mut Vec::new())?
130130 .context("file is untracked")?;
131− match tree_entry.mode() {
131+ match tree_entry.mode().kind() {
132132 // not a file, everything is new, do not show diff
133− mode @ (EntryMode::Tree | EntryMode::Commit | EntryMode::Link) => {
133+ mode @ (EntryKind::Tree | EntryKind::Commit | EntryKind::Link) => {
134134 bail!("entry at {} is not a file but a {mode:?}", file.display())
135135 }
136136 // found a file
137− EntryMode::Blob | EntryMode::BlobExecutable => Ok(tree_entry.object_id()),
137+ EntryKind::Blob | EntryKind::BlobExecutable => Ok(tree_entry.object_id()),
138138 }
139139}
helix-view/Cargo.toml+21−18
@@ -1,31 +1,34 @@
11[package]
22name = "helix-view"
3−version = "0.6.0"
4−authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2021"
6−license = "MPL-2.0"
73description = "UI abstractions for use in backends"
8−categories = ["editor"]
9−repository = "https://github.com/helix-editor/helix"
10−homepage = "https://helix-editor.com"
4+version.workspace = true
5+authors.workspace = true
6+edition.workspace = true
7+license.workspace = true
8+rust-version.workspace = true
9+categories.workspace = true
10+repository.workspace = true
11+homepage.workspace = true
1112
1213[features]
1314default = []
1415term = ["crossterm"]
1516
1617[dependencies]
17−bitflags = "2.3"
18+helix-core = { path = "../helix-core" }
19+helix-event = { path = "../helix-event" }
20+helix-loader = { path = "../helix-loader" }
21+helix-lsp = { path = "../helix-lsp" }
22+helix-dap = { path = "../helix-dap" }
23+helix-vcs = { path = "../helix-vcs" }
24+
25+bitflags = "2.4"
1826anyhow = "1"
19−helix-core = { version = "0.6", path = "../helix-core" }
20−helix-loader = { version = "0.6", path = "../helix-loader" }
21−helix-lsp = { version = "0.6", path = "../helix-lsp" }
22−helix-dap = { version = "0.6", path = "../helix-dap" }
23−crossterm = { version = "0.26", optional = true }
24−helix-vcs = { version = "0.6", path = "../helix-vcs" }
27+crossterm = { version = "0.27", optional = true }
2528
2629# Conversion traits
27−once_cell = "1.18"
28−url = "2"
30+once_cell = "1.19"
31+url = "2.5.0"
2932
3033arc-swap = { version = "1.6.0" }
3134
@@ -42,12 +45,12 @@ serde_json = "1.0"
4245toml = "0.7"
4346log = "~0.4"
4447
45−which = "4.4"
48+which = "5.0.0"
4649parking_lot = "0.12.1"
4750
4851
4952[target.'cfg(windows)'.dependencies]
50−clipboard-win = { version = "4.5", features = ["std"] }
53+clipboard-win = { version = "5.0", features = ["std"] }
5154
5255[target.'cfg(unix)'.dependencies]
5356libc = "0.2"
helix-view/src/clipboard.rs+7−2
@@ -73,9 +73,14 @@ pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
7373
7474#[cfg(target_os = "macos")]
7575pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
76− use crate::env::binary_exists;
76+ use crate::env::{binary_exists, env_var_is_set};
7777
78− if binary_exists("pbcopy") && binary_exists("pbpaste") {
78+ if env_var_is_set("TMUX") && binary_exists("tmux") {
79+ command_provider! {
80+ paste => "tmux", "save-buffer", "-";
81+ copy => "tmux", "load-buffer", "-w", "-";
82+ }
83+ } else if binary_exists("pbcopy") && binary_exists("pbpaste") {
7984 command_provider! {
8085 paste => "pbpaste";
8186 copy => "pbcopy";
helix-view/src/document.rs+72−40
@@ -33,7 +33,7 @@ use helix_core::{
3333 ChangeSet, Diagnostic, LineEnding, Range, Rope, RopeBuilder, Selection, Syntax, Transaction,
3434};
3535
36−use crate::editor::{Config, RedrawHandle};
36+use crate::editor::Config;
3737use crate::{DocumentId, Editor, Theme, View, ViewId};
3838
3939/// 8kB of buffer space for encoding and decoding `Rope`s.
@@ -708,7 +708,7 @@ impl Document {
708708 let mut doc = Self::from(rope, Some((encoding, has_bom)), config);
709709
710710 // set the path and try detecting the language
711− doc.set_path(Some(path))?;
711+ doc.set_path(Some(path));
712712 if let Some(loader) = config_loader {
713713 doc.detect_language(loader);
714714 }
@@ -733,16 +733,16 @@ impl Document {
733733 // We can't use anyhow::Result here since the output of the future has to be
734734 // clonable to be used as shared future. So use a custom error type.
735735 pub fn format(&self) -> Option<BoxFuture<'static, Result<Transaction, FormatterError>>> {
736− if let Some(formatter) = self
736+ if let Some((fmt_cmd, fmt_args)) = self
737737 .language_config()
738− .and_then(|c| c.formatter.clone())
739− .filter(|formatter| which::which(&formatter.command).is_ok())
738+ .and_then(|c| c.formatter.as_ref())
739+ .and_then(|formatter| Some((which::which(&formatter.command).ok()?, &formatter.args)))
740740 {
741741 use std::process::Stdio;
742742 let text = self.text().clone();
743− let mut process = tokio::process::Command::new(&formatter.command);
743+ let mut process = tokio::process::Command::new(&fmt_cmd);
744744 process
745− .args(&formatter.args)
745+ .args(fmt_args)
746746 .stdin(Stdio::piped())
747747 .stdout(Stdio::piped())
748748 .stderr(Stdio::piped());
@@ -751,7 +751,7 @@ impl Document {
751751 let mut process = process
752752 .spawn()
753753 .map_err(|e| FormatterError::SpawningFailed {
754− command: formatter.command.clone(),
754+ command: fmt_cmd.to_string_lossy().into(),
755755 error: e.kind(),
756756 })?;
757757 {
@@ -853,7 +853,7 @@ impl Document {
853853 let text = self.text().clone();
854854
855855 let path = match path {
856− Some(path) => helix_core::path::get_canonicalized_path(&path)?,
856+ Some(path) => helix_core::path::get_canonicalized_path(&path),
857857 None => {
858858 if self.path.is_none() {
859859 bail!("Can't save with no path set!");
@@ -995,7 +995,6 @@ impl Document {
995995 &mut self,
996996 view: &mut View,
997997 provider_registry: &DiffProviderRegistry,
998− redraw_handle: RedrawHandle,
999998 ) -> Result<(), Error> {
1000999 let encoding = self.encoding;
10011000 let path = self
@@ -1023,7 +1022,7 @@ impl Document {
10231022 self.detect_indent_and_line_ending();
10241023
10251024 match provider_registry.get_diff_base(&path) {
1026− Some(diff_base) => self.set_diff_base(diff_base, redraw_handle),
1025+ Some(diff_base) => self.set_diff_base(diff_base),
10271026 None => self.diff_handle = None,
10281027 }
10291028
@@ -1047,18 +1046,14 @@ impl Document {
10471046 self.encoding
10481047 }
10491048
1050− pub fn set_path(&mut self, path: Option<&Path>) -> Result<(), std::io::Error> {
1051− let path = path
1052− .map(helix_core::path::get_canonicalized_path)
1053− .transpose()?;
1049+ pub fn set_path(&mut self, path: Option<&Path>) {
1050+ let path = path.map(helix_core::path::get_canonicalized_path);
10541051
10551052 // if parent doesn't exist we still want to open the document
10561053 // and error out when document is saved
10571054 self.path = path;
10581055
10591056 self.detect_readonly();
1060−
1061− Ok(())
10621057 }
10631058
10641059 /// Set the programming language for the file and load associated data (e.g. highlighting)
@@ -1211,30 +1206,47 @@ impl Document {
12111206 transaction.changes(),
12121207 );
12131208 if res.is_err() {
1214− log::error!("TS parser failed, disabeling TS for the current buffer: {res:?}");
1209+ log::error!("TS parser failed, disabling TS for the current buffer: {res:?}");
12151210 self.syntax = None;
12161211 }
12171212 }
12181213
12191214 let changes = transaction.changes();
12201215
1221− changes.update_positions(
1222− self.diagnostics
1223− .iter_mut()
1224− .map(|diagnostic| (&mut diagnostic.range.start, Assoc::After)),
1225− );
1226− changes.update_positions(
1227− self.diagnostics
1228− .iter_mut()
1229− .map(|diagnostic| (&mut diagnostic.range.end, Assoc::After)),
1230− );
1231− // map state.diagnostics over changes::map_pos too
1232− for diagnostic in &mut self.diagnostics {
1216+ // map diagnostics over changes too
1217+ changes.update_positions(self.diagnostics.iter_mut().map(|diagnostic| {
1218+ let assoc = if diagnostic.starts_at_word {
1219+ Assoc::BeforeWord
1220+ } else {
1221+ Assoc::After
1222+ };
1223+ (&mut diagnostic.range.start, assoc)
1224+ }));
1225+ changes.update_positions(self.diagnostics.iter_mut().map(|diagnostic| {
1226+ let assoc = if diagnostic.ends_at_word {
1227+ Assoc::AfterWord
1228+ } else {
1229+ Assoc::Before
1230+ };
1231+ (&mut diagnostic.range.end, assoc)
1232+ }));
1233+ self.diagnostics.retain_mut(|diagnostic| {
1234+ if diagnostic.range.start > diagnostic.range.end
1235+ || (!diagnostic.zero_width && diagnostic.range.start == diagnostic.range.end)
1236+ {
1237+ return false;
1238+ }
12331239 diagnostic.line = self.text.char_to_line(diagnostic.range.start);
1234− }
1240+ true
1241+ });
12351242
1236− self.diagnostics
1237− .sort_unstable_by_key(|diagnostic| diagnostic.range);
1243+ self.diagnostics.sort_unstable_by_key(|diagnostic| {
1244+ (
1245+ diagnostic.range,
1246+ diagnostic.severity,
1247+ diagnostic.language_server_id,
1248+ )
1249+ });
12381250
12391251 // Update the inlay hint annotations' positions, helping ensure they are displayed in the proper place
12401252 let apply_inlay_hint_changes = |annotations: &mut Rc<[InlineAnnotation]>| {
@@ -1587,13 +1599,13 @@ impl Document {
15871599 }
15881600
15891601 /// Intialize/updates the differ for this document with a new base.
1590− pub fn set_diff_base(&mut self, diff_base: Vec<u8>, redraw_handle: RedrawHandle) {
1602+ pub fn set_diff_base(&mut self, diff_base: Vec<u8>) {
15911603 if let Ok((diff_base, ..)) = from_reader(&mut diff_base.as_slice(), Some(self.encoding)) {
15921604 if let Some(differ) = &self.diff_handle {
15931605 differ.update_diff_base(diff_base);
15941606 return;
15951607 }
1596− self.diff_handle = Some(DiffHandle::new(diff_base, self.text.clone(), redraw_handle))
1608+ self.diff_handle = Some(DiffHandle::new(diff_base, self.text.clone()))
15971609 } else {
15981610 self.diff_handle = None;
15991611 }
@@ -1711,13 +1723,33 @@ impl Document {
17111723
17121724 pub fn replace_diagnostics(
17131725 &mut self,
1714− mut diagnostics: Vec<Diagnostic>,
1726+ diagnostics: impl IntoIterator<Item = Diagnostic>,
1727+ unchanged_sources: &[String],
17151728 language_server_id: usize,
17161729 ) {
1717− self.clear_diagnostics(language_server_id);
1718− self.diagnostics.append(&mut diagnostics);
1719− self.diagnostics
1720− .sort_unstable_by_key(|diagnostic| diagnostic.range);
1730+ if unchanged_sources.is_empty() {
1731+ self.clear_diagnostics(language_server_id);
1732+ } else {
1733+ self.diagnostics.retain(|d| {
1734+ if d.language_server_id != language_server_id {
1735+ return true;
1736+ }
1737+
1738+ if let Some(source) = &d.source {
1739+ unchanged_sources.contains(source)
1740+ } else {
1741+ false
1742+ }
1743+ });
1744+ }
1745+ self.diagnostics.extend(diagnostics);
1746+ self.diagnostics.sort_unstable_by_key(|diagnostic| {
1747+ (
1748+ diagnostic.range,
1749+ diagnostic.severity,
1750+ diagnostic.language_server_id,
1751+ )
1752+ });
17211753 }
17221754
17231755 pub fn clear_diagnostics(&mut self, language_server_id: usize) {
helix-view/src/editor.rs+103−71
@@ -32,7 +32,7 @@ use std::{
3232use tokio::{
3333 sync::{
3434 mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender},
35− oneshot, Notify, RwLock,
35+ oneshot,
3636 },
3737 time::{sleep, Duration, Instant, Sleep},
3838};
@@ -42,10 +42,9 @@ use anyhow::{anyhow, bail, Error};
4242pub use helix_core::diagnostic::Severity;
4343use helix_core::{
4444 auto_pairs::AutoPairs,
45− syntax::{self, AutoPairConfig, SoftWrap},
46− Change, LineEnding, NATIVE_LINE_ENDING,
45+ syntax::{self, AutoPairConfig, IndentationHeuristic, SoftWrap},
46+ Change, LineEnding, Position, Selection, NATIVE_LINE_ENDING,
4747};
48−use helix_core::{Position, Selection};
4948use helix_dap as dap;
5049use helix_lsp::lsp;
5150
@@ -244,7 +243,7 @@ pub struct Config {
244243 /// Set a global text_width
245244 pub text_width: usize,
246245 /// Time in milliseconds since last keypress before idle timers trigger.
247− /// Used for autocompletion, set to 0 for instant. Defaults to 400ms.
246+ /// Used for autocompletion, set to 0 for instant. Defaults to 250ms.
248247 #[serde(
249248 serialize_with = "serialize_duration_millis",
250249 deserialize_with = "deserialize_duration_millis"
@@ -287,8 +286,15 @@ pub struct Config {
287286 pub workspace_lsp_roots: Vec<PathBuf>,
288287 /// Which line ending to choose for new documents. Defaults to `native`. i.e. `crlf` on Windows, otherwise `lf`.
289288 pub default_line_ending: LineEndingConfig,
289+ /// Whether to automatically insert a trailing line-ending on write if missing. Defaults to `true`.
290+ pub insert_final_newline: bool,
290291 /// Enables smart tab
291292 pub smart_tab: Option<SmartTabConfig>,
293+ /// Draw border around popups.
294+ pub popup_border: PopupBorderConfig,
295+ /// Which indent heuristic to use when a new line is inserted
296+ #[serde(default)]
297+ pub indent_heuristic: IndentationHeuristic,
292298}
293299
294300#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, PartialOrd, Ord)]
@@ -465,10 +471,10 @@ pub enum StatusLineElement {
465471 /// The LSP activity spinner
466472 Spinner,
467473
468− /// The base file name, including a dirty flag if it's unsaved
474+ /// The file basename (the leaf of the open file's path)
469475 FileBaseName,
470476
471− /// The relative file path, including a dirty flag if it's unsaved
477+ /// The relative file path
472478 FileName,
473479
474480 // The file modification indicator
@@ -725,7 +731,7 @@ pub struct WhitespaceCharacters {
725731impl Default for WhitespaceCharacters {
726732 fn default() -> Self {
727733 Self {
728− space: '·', // U+00B7
734+ space: '·', // U+00B7
729735 nbsp: '⍽', // U+237D
730736 tab: '→', // U+2192
731737 newline: '⏎', // U+23CE
@@ -753,12 +759,13 @@ impl Default for IndentGuidesConfig {
753759}
754760
755761/// Line ending configuration.
756−#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
762+#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
757763#[serde(rename_all = "lowercase")]
758764pub enum LineEndingConfig {
759765 /// The platform's native line ending.
760766 ///
761767 /// `crlf` on Windows, otherwise `lf`.
768+ #[default]
762769 Native,
763770 /// Line feed.
764771 LF,
@@ -775,12 +782,6 @@ pub enum LineEndingConfig {
775782 Nel,
776783}
777784
778−impl Default for LineEndingConfig {
779− fn default() -> Self {
780− LineEndingConfig::Native
781− }
782−}
783−
784785impl From<LineEndingConfig> for LineEnding {
785786 fn from(line_ending: LineEndingConfig) -> Self {
786787 match line_ending {
@@ -797,6 +798,15 @@ impl From<LineEndingConfig> for LineEnding {
797798 }
798799}
799800
801+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
802+#[serde(rename_all = "kebab-case")]
803+pub enum PopupBorderConfig {
804+ None,
805+ All,
806+ Popup,
807+ Menu,
808+}
809+
800810impl Default for Config {
801811 fn default() -> Self {
802812 Self {
@@ -817,7 +827,7 @@ impl Default for Config {
817827 auto_completion: true,
818828 auto_format: true,
819829 auto_save: false,
820− idle_timeout: Duration::from_millis(400),
830+ idle_timeout: Duration::from_millis(250),
821831 preview_completion_insert: true,
822832 completion_trigger_len: 2,
823833 auto_info: true,
@@ -842,7 +852,10 @@ impl Default for Config {
842852 completion_replace: false,
843853 workspace_lsp_roots: Vec::new(),
844854 default_line_ending: LineEndingConfig::default(),
855+ insert_final_newline: true,
845856 smart_tab: Some(SmartTabConfig::default()),
857+ popup_border: PopupBorderConfig::None,
858+ indent_heuristic: IndentationHeuristic::default(),
846859 }
847860 }
848861}
@@ -918,16 +931,13 @@ pub struct Editor {
918931 pub auto_pairs: Option<AutoPairs>,
919932
920933 pub idle_timer: Pin<Box<Sleep>>,
934+ redraw_timer: Pin<Box<Sleep>>,
921935 last_motion: Option<Motion>,
922936 pub last_completion: Option<CompleteAction>,
923937
924938 pub exit_code: i32,
925939
926940 pub config_events: (UnboundedSender<ConfigEvent>, UnboundedReceiver<ConfigEvent>),
927− /// Allows asynchronous tasks to control the rendering
928− /// The `Notify` allows asynchronous tasks to request the editor to perform a redraw
929− /// The `RwLock` blocks the editor from performing the render until an exclusive lock can be acquired
930− pub redraw_handle: RedrawHandle,
931941 pub needs_redraw: bool,
932942 /// Cached position of the cursor calculated during rendering.
933943 /// The content of `cursor_cache` is returned by `Editor::cursor` if
@@ -954,8 +964,6 @@ pub struct Editor {
954964
955965pub type Motion = Box<dyn Fn(&mut Editor)>;
956966
957−pub type RedrawHandle = (Arc<Notify>, Arc<RwLock<()>>);
958−
959967#[derive(Debug)]
960968pub enum EditorEvent {
961969 DocumentSaved(DocumentSavedEventResult),
@@ -963,6 +971,7 @@ pub enum EditorEvent {
963971 LanguageServerMessage((usize, Call)),
964972 DebuggerEvent(dap::Payload),
965973 IdleTimer,
974+ Redraw,
966975}
967976
968977#[derive(Debug, Clone)]
@@ -1053,19 +1062,29 @@ impl Editor {
10531062 status_msg: None,
10541063 autoinfo: None,
10551064 idle_timer: Box::pin(sleep(conf.idle_timeout)),
1065+ redraw_timer: Box::pin(sleep(Duration::MAX)),
10561066 last_motion: None,
10571067 last_completion: None,
10581068 config,
10591069 auto_pairs,
10601070 exit_code: 0,
10611071 config_events: unbounded_channel(),
1062− redraw_handle: Default::default(),
10631072 needs_redraw: false,
10641073 cursor_cache: Cell::new(None),
10651074 completion_request_handle: None,
10661075 }
10671076 }
10681077
1078+ pub fn popup_border(&self) -> bool {
1079+ self.config().popup_border == PopupBorderConfig::All
1080+ || self.config().popup_border == PopupBorderConfig::Popup
1081+ }
1082+
1083+ pub fn menu_border(&self) -> bool {
1084+ self.config().popup_border == PopupBorderConfig::All
1085+ || self.config().popup_border == PopupBorderConfig::Menu
1086+ }
1087+
10691088 pub fn apply_motion<F: Fn(&mut Self) + 'static>(&mut self, motion: F) {
10701089 motion(self);
10711090 self.last_motion = Some(Box::new(motion));
@@ -1189,71 +1208,80 @@ impl Editor {
11891208 }
11901209
11911210 /// Refreshes the language server for a given document
1192− pub fn refresh_language_servers(&mut self, doc_id: DocumentId) -> Option<()> {
1211+ pub fn refresh_language_servers(&mut self, doc_id: DocumentId) {
11931212 self.launch_language_servers(doc_id)
11941213 }
11951214
11961215 /// Launch a language server for a given document
1197− fn launch_language_servers(&mut self, doc_id: DocumentId) -> Option<()> {
1216+ fn launch_language_servers(&mut self, doc_id: DocumentId) {
11981217 if !self.config().lsp.enable {
1199− return None;
1218+ return;
12001219 }
12011220 // if doc doesn't have a URL it's a scratch buffer, ignore it
1202− let doc = self.documents.get_mut(&doc_id)?;
1203− let doc_url = doc.url()?;
1221+ let Some(doc) = self.documents.get_mut(&doc_id) else {
1222+ return;
1223+ };
1224+ let Some(doc_url) = doc.url() else {
1225+ return;
1226+ };
12041227 let (lang, path) = (doc.language.clone(), doc.path().cloned());
12051228 let config = doc.config.load();
12061229 let root_dirs = &config.workspace_lsp_roots;
12071230
1208− // try to find language servers based on the language name
1209− let language_servers = lang.as_ref().and_then(|language| {
1231+ // store only successfully started language servers
1232+ let language_servers = lang.as_ref().map_or_else(HashMap::default, |language| {
12101233 self.language_servers
12111234 .get(language, path.as_ref(), root_dirs, config.lsp.snippets)
1212− .map_err(|e| {
1213− log::error!(
1214− "Failed to initialize the language servers for `{}` {{ {} }}",
1215− language.scope(),
1216− e
1217− )
1235+ .filter_map(|(lang, client)| match client {
1236+ Ok(client) => Some((lang, client)),
1237+ Err(err) => {
1238+ log::error!(
1239+ "Failed to initialize the language servers for `{}` - `{}` {{ {} }}",
1240+ language.scope(),
1241+ lang,
1242+ err
1243+ );
1244+ None
1245+ }
12181246 })
1219− .ok()
1247+ .collect::<HashMap<_, _>>()
12201248 });
12211249
1222− if let Some(language_servers) = language_servers {
1223− let language_id = doc.language_id().map(ToOwned::to_owned).unwrap_or_default();
1224−
1225− // only spawn new language servers if the servers aren't the same
1226−
1227− let doc_language_servers_not_in_registry =
1228− doc.language_servers.iter().filter(|(name, doc_ls)| {
1229− language_servers
1230− .get(*name)
1231− .map_or(true, |ls| ls.id() != doc_ls.id())
1232− });
1250+ if language_servers.is_empty() {
1251+ return;
1252+ }
12331253
1234− for (_, language_server) in doc_language_servers_not_in_registry {
1235− tokio::spawn(language_server.text_document_did_close(doc.identifier()));
1236− }
1254+ let language_id = doc.language_id().map(ToOwned::to_owned).unwrap_or_default();
12371255
1238− let language_servers_not_in_doc = language_servers.iter().filter(|(name, ls)| {
1239− doc.language_servers
1256+ // only spawn new language servers if the servers aren't the same
1257+ let doc_language_servers_not_in_registry =
1258+ doc.language_servers.iter().filter(|(name, doc_ls)| {
1259+ language_servers
12401260 .get(*name)
1241− .map_or(true, |doc_ls| ls.id() != doc_ls.id())
1261+ .map_or(true, |ls| ls.id() != doc_ls.id())
12421262 });
12431263
1244− for (_, language_server) in language_servers_not_in_doc {
1245− // TODO: this now races with on_init code if the init happens too quickly
1246− tokio::spawn(language_server.text_document_did_open(
1247− doc_url.clone(),
1248− doc.version(),
1249− doc.text(),
1250− language_id.clone(),
1251− ));
1252− }
1264+ for (_, language_server) in doc_language_servers_not_in_registry {
1265+ tokio::spawn(language_server.text_document_did_close(doc.identifier()));
1266+ }
12531267
1254− doc.language_servers = language_servers;
1268+ let language_servers_not_in_doc = language_servers.iter().filter(|(name, ls)| {
1269+ doc.language_servers
1270+ .get(*name)
1271+ .map_or(true, |doc_ls| ls.id() != doc_ls.id())
1272+ });
1273+
1274+ for (_, language_server) in language_servers_not_in_doc {
1275+ // TODO: this now races with on_init code if the init happens too quickly
1276+ tokio::spawn(language_server.text_document_did_open(
1277+ doc_url.clone(),
1278+ doc.version(),
1279+ doc.text(),
1280+ language_id.clone(),
1281+ ));
12551282 }
1256− Some(())
1283+
1284+ doc.language_servers = language_servers;
12571285 }
12581286
12591287 fn _refresh(&mut self) {
@@ -1436,7 +1464,7 @@ impl Editor {
14361464
14371465 // ??? possible use for integration tests
14381466 pub fn open(&mut self, path: &Path, action: Action) -> Result<DocumentId, Error> {
1439− let path = helix_core::path::get_canonicalized_path(path)?;
1467+ let path = helix_core::path::get_canonicalized_path(path);
14401468 let id = self.document_by_path(&path).map(|doc| doc.id);
14411469
14421470 let id = if let Some(id) = id {
@@ -1450,12 +1478,12 @@ impl Editor {
14501478 )?;
14511479
14521480 if let Some(diff_base) = self.diff_providers.get_diff_base(&path) {
1453− doc.set_diff_base(diff_base, self.redraw_handle.clone());
1481+ doc.set_diff_base(diff_base);
14541482 }
14551483 doc.set_version_control_head(self.diff_providers.get_current_head_name(&path));
14561484
14571485 let id = self.new_document(doc);
1458− let _ = self.launch_language_servers(id);
1486+ self.launch_language_servers(id);
14591487
14601488 id
14611489 };
@@ -1749,16 +1777,20 @@ impl Editor {
17491777 return EditorEvent::DebuggerEvent(event)
17501778 }
17511779
1752− _ = self.redraw_handle.0.notified() => {
1780+ _ = helix_event::redraw_requested() => {
17531781 if !self.needs_redraw{
17541782 self.needs_redraw = true;
17551783 let timeout = Instant::now() + Duration::from_millis(33);
1756− if timeout < self.idle_timer.deadline(){
1757− self.idle_timer.as_mut().reset(timeout)
1784+ if timeout < self.idle_timer.deadline() && timeout < self.redraw_timer.deadline(){
1785+ self.redraw_timer.as_mut().reset(timeout)
17581786 }
17591787 }
17601788 }
17611789
1790+ _ = &mut self.redraw_timer => {
1791+ self.redraw_timer.as_mut().reset(Instant::now() + Duration::from_secs(86400 * 365 * 30));
1792+ return EditorEvent::Redraw
1793+ }
17621794 _ = &mut self.idle_timer => {
17631795 return EditorEvent::IdleTimer
17641796 }
helix-view/src/gutter.rs+4−5
@@ -9,8 +9,7 @@ use crate::{
99};
1010
1111fn count_digits(n: usize) -> usize {
12− // TODO: use checked_log10 when MSRV reaches 1.67
13− std::iter::successors(Some(n), |&n| (n >= 10).then_some(n / 10)).count()
12+ (usize::checked_ilog10(n).unwrap_or(0) + 1) as usize
1413}
1514
1615pub type GutterFn<'doc> = Box<dyn FnMut(usize, bool, bool, &mut String) -> Option<Style> + 'doc>;
@@ -94,9 +93,9 @@ pub fn diff<'doc>(
9493 theme: &Theme,
9594 _is_focused: bool,
9695) -> GutterFn<'doc> {
97− let added = theme.get("diff.plus");
98− let deleted = theme.get("diff.minus");
99− let modified = theme.get("diff.delta");
96+ let added = theme.get("diff.plus.gutter");
97+ let deleted = theme.get("diff.minus.gutter");
98+ let modified = theme.get("diff.delta.gutter");
10099 if let Some(diff_handle) = doc.diff_handle() {
101100 let hunks = diff_handle.load();
102101 let mut hunk_i = 0;
helix-view/src/handlers/dap.rs+1−3
@@ -369,9 +369,7 @@ impl Editor {
369369 {
370370 Ok(process) => process,
371371 Err(err) => {
372− // TODO replace the pretty print {:?} with a regular format {}
373− // when the MSRV is raised to 1.60.0
374− self.set_error(format!("Error starting external terminal: {:?}", err));
372+ self.set_error(format!("Error starting external terminal: {}", err));
375373 return true;
376374 }
377375 };
helix-view/src/input.rs+65−1
@@ -43,6 +43,10 @@ pub enum MouseEventKind {
4343 ScrollDown,
4444 /// Scrolled mouse wheel upwards (away from the user).
4545 ScrollUp,
46+ /// Scrolled mouse wheel leftwards.
47+ ScrollLeft,
48+ /// Scrolled mouse wheel rightwards.
49+ ScrollRight,
4650}
4751
4852/// Represents a mouse button.
@@ -458,6 +462,8 @@ impl From<crossterm::event::MouseEventKind> for MouseEventKind {
458462 crossterm::event::MouseEventKind::Moved => Self::Moved,
459463 crossterm::event::MouseEventKind::ScrollDown => Self::ScrollDown,
460464 crossterm::event::MouseEventKind::ScrollUp => Self::ScrollUp,
465+ crossterm::event::MouseEventKind::ScrollLeft => Self::ScrollLeft,
466+ crossterm::event::MouseEventKind::ScrollRight => Self::ScrollRight,
461467 }
462468 }
463469}
@@ -543,7 +549,7 @@ pub fn parse_macro(keys_str: &str) -> anyhow::Result<Vec<KeyEvent>> {
543549 if c == ">" {
544550 keys_res = Err(anyhow!("Unmatched '>'"));
545551 } else if c != "<" {
546− keys.push(c);
552+ keys.push(if c == "-" { keys::MINUS } else { c });
547553 i += end_i;
548554 } else {
549555 match s.find('>').context("'>' expected") {
@@ -807,6 +813,64 @@ mod test {
807813 },
808814 ])
809815 );
816+
817+ assert_eq!(
818+ parse_macro(":w aa-bb.txt<ret>").ok(),
819+ Some(vec![
820+ KeyEvent {
821+ code: KeyCode::Char(':'),
822+ modifiers: KeyModifiers::NONE,
823+ },
824+ KeyEvent {
825+ code: KeyCode::Char('w'),
826+ modifiers: KeyModifiers::NONE,
827+ },
828+ KeyEvent {
829+ code: KeyCode::Char(' '),
830+ modifiers: KeyModifiers::NONE,
831+ },
832+ KeyEvent {
833+ code: KeyCode::Char('a'),
834+ modifiers: KeyModifiers::NONE,
835+ },
836+ KeyEvent {
837+ code: KeyCode::Char('a'),
838+ modifiers: KeyModifiers::NONE,
839+ },
840+ KeyEvent {
841+ code: KeyCode::Char('-'),
842+ modifiers: KeyModifiers::NONE,
843+ },
844+ KeyEvent {
845+ code: KeyCode::Char('b'),
846+ modifiers: KeyModifiers::NONE,
847+ },
848+ KeyEvent {
849+ code: KeyCode::Char('b'),
850+ modifiers: KeyModifiers::NONE,
851+ },
852+ KeyEvent {
853+ code: KeyCode::Char('.'),
854+ modifiers: KeyModifiers::NONE,
855+ },
856+ KeyEvent {
857+ code: KeyCode::Char('t'),
858+ modifiers: KeyModifiers::NONE,
859+ },
860+ KeyEvent {
861+ code: KeyCode::Char('x'),
862+ modifiers: KeyModifiers::NONE,
863+ },
864+ KeyEvent {
865+ code: KeyCode::Char('t'),
866+ modifiers: KeyModifiers::NONE,
867+ },
868+ KeyEvent {
869+ code: KeyCode::Enter,
870+ modifiers: KeyModifiers::NONE,
871+ },
872+ ])
873+ );
810874 }
811875
812876 #[test]
helix-view/src/register.rs+12−10
@@ -29,6 +29,7 @@ pub struct Registers {
2929 /// efficiently prepend new values in `Registers::push`.
3030 inner: HashMap<char, Vec<String>>,
3131 clipboard_provider: Box<dyn ClipboardProvider>,
32+ pub last_search_register: char,
3233}
3334
3435impl Default for Registers {
@@ -36,6 +37,7 @@ impl Default for Registers {
3637 Self {
3738 inner: Default::default(),
3839 clipboard_provider: get_clipboard_provider(),
40+ last_search_register: '/',
3941 }
4042 }
4143}
@@ -73,8 +75,8 @@ impl Registers {
7375 self.clipboard_provider.as_ref(),
7476 self.inner.get(&name),
7577 match name {
76− '*' => ClipboardType::Clipboard,
77− '+' => ClipboardType::Selection,
78+ '+' => ClipboardType::Clipboard,
79+ '*' => ClipboardType::Selection,
7880 _ => unreachable!(),
7981 },
8082 )),
@@ -93,8 +95,8 @@ impl Registers {
9395 self.clipboard_provider.set_contents(
9496 values.join(NATIVE_LINE_ENDING.as_str()),
9597 match name {
96− '*' => ClipboardType::Clipboard,
97− '+' => ClipboardType::Selection,
98+ '+' => ClipboardType::Clipboard,
99+ '*' => ClipboardType::Selection,
98100 _ => unreachable!(),
99101 },
100102 )?;
@@ -116,8 +118,8 @@ impl Registers {
116118 '#' | '.' | '%' => Err(anyhow::anyhow!("Register {name} does not support pushing")),
117119 '*' | '+' => {
118120 let clipboard_type = match name {
119− '*' => ClipboardType::Clipboard,
120− '+' => ClipboardType::Selection,
121+ '+' => ClipboardType::Clipboard,
122+ '*' => ClipboardType::Selection,
121123 _ => unreachable!(),
122124 };
123125 let contents = self.clipboard_provider.get_contents(clipboard_type)?;
@@ -170,8 +172,8 @@ impl Registers {
170172 ('#', "<selection indices>"),
171173 ('.', "<selection contents>"),
172174 ('%', "<document path>"),
173− ('*', "<system clipboard>"),
174− ('+', "<primary clipboard>"),
175+ ('+', "<system clipboard>"),
176+ ('*', "<primary clipboard>"),
175177 ]
176178 .iter()
177179 .copied(),
@@ -188,8 +190,8 @@ impl Registers {
188190 match name {
189191 '*' | '+' => {
190192 self.clear_clipboard(match name {
191− '*' => ClipboardType::Clipboard,
192− '+' => ClipboardType::Selection,
193+ '+' => ClipboardType::Clipboard,
194+ '*' => ClipboardType::Selection,
193195 _ => unreachable!(),
194196 });
195197 self.inner.remove(&name);
helix-view/src/theme.rs+6
@@ -297,6 +297,11 @@ impl Theme {
297297 self.highlights[index]
298298 }
299299
300+ #[inline]
301+ pub fn scope(&self, index: usize) -> &str {
302+ &self.scopes[index]
303+ }
304+
300305 pub fn name(&self) -> &str {
301306 &self.name
302307 }
@@ -359,6 +364,7 @@ impl Default for ThemePalette {
359364 fn default() -> Self {
360365 Self {
361366 palette: hashmap! {
367+ "default".to_string() => Color::Reset,
362368 "black".to_string() => Color::Black,
363369 "red".to_string() => Color::Red,
364370 "green".to_string() => Color::Green,
languages.toml+464−194
@@ -3,6 +3,7 @@
33
44[language-server]
55
6+als = { command = "als" }
67awk-language-server = { command = "awk-language-server" }
78bash-language-server = { command = "bash-language-server", args = ["start"] }
89bass = { command = "bass", args = ["--lsp"] }
@@ -15,6 +16,7 @@ clojure-lsp = { command = "clojure-lsp" }
1516cmake-language-server = { command = "cmake-language-server" }
1617crystalline = { command = "crystalline", args = ["--stdio"] }
1718cs = { command = "cs", args = ["launch", "--contrib", "smithy-language-server", "--", "0"] }
19+csharp-ls = { command = "csharp-ls" }
1820cuelsp = { command = "cuelsp" }
1921dart = { command = "dart", args = ["language-server", "--client-id=helix"] }
2022dhall-lsp-server = { command = "dhall-lsp-server" }
@@ -29,6 +31,7 @@ forth-lsp = { command = "forth-lsp" }
2931fortls = { command = "fortls", args = ["--lowercase_intrinsics"] }
3032fsharp-ls = { command = "fsautocomplete", config = { AutomaticWorkspaceInit = true } }
3133gleam = { command = "gleam", args = ["lsp"] }
34+graphql-language-service = { command = "graphql-lsp", args = ["server", "-m", "stream"] }
3235haskell-language-server = { command = "haskell-language-server-wrapper", args = ["--lsp"] }
3336idris2-lsp = { command = "idris2-lsp" }
3437intelephense = { command = "intelephense", args = ["--stdio"] }
@@ -37,6 +40,7 @@ jsonnet-language-server = { command = "jsonnet-language-server", args= ["-t", "-
3740julia = { command = "julia", timeout = 60, args = [ "--startup-file=no", "--history-file=no", "--quiet", "-e", "using LanguageServer; runserver()", ] }
3841kotlin-language-server = { command = "kotlin-language-server" }
3942lean = { command = "lean", args = [ "--server" ] }
43+ltex-ls = { command = "ltex-ls" }
4044markdoc-ls = { command = "markdoc-ls", args = ["--stdio"] }
4145marksman = { command = "marksman", args = ["server"] }
4246metals = { command = "metals", config = { "isHttpEnabled" = true } }
@@ -44,6 +48,7 @@ mint = { command = "mint", args = ["ls"] }
4448nil = { command = "nil" }
4549nimlangserver = { command = "nimlangserver" }
4650nls = { command = "nls" }
51+nu-lsp = { command = "nu", args = [ "--lsp" ] }
4752ocamllsp = { command = "ocamllsp" }
4853ols = { command = "ols", args = [] }
4954omnisharp = { command = "OmniSharp", args = [ "--languageserver" ] }
@@ -54,6 +59,8 @@ perlnavigator = { command = "perlnavigator", args= ["--stdio"] }
5459prisma-language-server = { command = "prisma-language-server", args = ["--stdio"] }
5560purescript-language-server = { command = "purescript-language-server", args = ["--stdio"] }
5661pylsp = { command = "pylsp" }
62+pyright = { command = "pyright-langserver", args = ["--stdio"], config = {} }
63+pylyzer = { command = "pylyzer", args = ["--server"] }
5764qmlls = { command = "qmlls" }
5865r = { command = "R", args = ["--no-echo", "-e", "languageserver::run()"] }
5966racket = { command = "racket", args = ["-l", "racket-langserver"] }
@@ -67,24 +74,30 @@ solc = { command = "solc", args = ["--lsp"] }
6774sourcekit-lsp = { command = "sourcekit-lsp" }
6875svlangserver = { command = "svlangserver", args = [] }
6976swipl = { command = "swipl", args = [ "-g", "use_module(library(lsp_server))", "-g", "lsp_server:main", "-t", "halt", "--", "stdio" ] }
77+tailwindcss-ls = { command = "tailwindcss-language-server", args = ["--stdio"] }
7078taplo = { command = "taplo", args = ["lsp", "stdio"] }
79+templ = { command = "templ", args = ["lsp"] }
7180terraform-ls = { command = "terraform-ls", args = ["serve"] }
7281texlab = { command = "texlab" }
7382vala-language-server = { command = "vala-language-server" }
7483vhdl_ls = { command = "vhdl_ls", args = [] }
7584vlang-language-server = { command = "v-analyzer" }
76−vscode-css-language-server = { command = "vscode-css-language-server", args = ["--stdio"], config = { "provideFormatter" = true }}
85+vscode-css-language-server = { command = "vscode-css-language-server", args = ["--stdio"], config = { provideFormatter = true, css = { validate = { enable = true } } } }
7786vscode-html-language-server = { command = "vscode-html-language-server", args = ["--stdio"], config = { provideFormatter = true } }
78−vscode-json-language-server = { command = "vscode-json-language-server", args = ["--stdio"], config = { provideFormatter = true } }
87+vscode-json-language-server = { command = "vscode-json-language-server", args = ["--stdio"], config = { provideFormatter = true, json = { validate = { enable = true } } } }
7988vuels = { command = "vue-language-server", args = ["--stdio"], config = { typescript = { tsdk = "node_modules/typescript/lib/" } } }
8089wgsl_analyzer = { command = "wgsl_analyzer" }
8190yaml-language-server = { command = "yaml-language-server", args = ["--stdio"] }
8291zls = { command = "zls" }
8392blueprint-compiler = { command = "blueprint-compiler", args = ["lsp"] }
93+typst-lsp = { command = "typst-lsp" }
8494
95+[language-server.ansible-language-server]
96+command = "ansible-language-server"
97+args = ["--stdio"]
8598
8699[language-server.lua-language-server]
87−command = "lua-language-server"
100+command = "lua-language-server"
88101
89102[language-server.lua-language-server.config.Lua.hint]
90103enable = true
@@ -106,6 +119,12 @@ functionTypeParameters = true
106119parameterNames = true
107120rangeVariableTypes = true
108121
122+[language-server.golangci-lint-lsp]
123+command = "golangci-lint-langserver"
124+
125+[language-server.golangci-lint-lsp.config]
126+command = ["golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"]
127+
109128
110129[language-server.rust-analyzer]
111130command = "rust-analyzer"
@@ -172,6 +191,7 @@ auto-format = true
172191comment-token = "//"
173192language-servers = [ "rust-analyzer" ]
174193indent = { tab-width = 4, unit = " " }
194+persistent-diagnostic-sources = ["rustc", "clippy"]
175195
176196[language.auto-pairs]
177197'(' = ')'
@@ -232,7 +252,6 @@ name = "toml"
232252scope = "source.toml"
233253injection-regex = "toml"
234254file-types = ["toml", "poetry.lock", "Cargo.lock"]
235−roots = []
236255comment-token = "#"
237256language-servers = [ "taplo" ]
238257indent = { tab-width = 2, unit = " " }
@@ -246,7 +265,6 @@ name = "awk"
246265scope = "source.awk"
247266injection-regex = "awk"
248267file-types = ["awk", "gawk", "nawk", "mawk"]
249−roots = []
250268comment-token = "#"
251269language-servers = [ "awk-language-server" ]
252270indent = { tab-width = 2, unit = " " }
@@ -261,7 +279,6 @@ scope = "source.proto"
261279injection-regex = "protobuf"
262280file-types = ["proto"]
263281language-servers = [ "bufls", "pbkit" ]
264−roots = []
265282comment-token = "//"
266283indent = { tab-width = 2, unit = " " }
267284
@@ -290,7 +307,6 @@ scope = "source.fish"
290307injection-regex = "fish"
291308file-types = ["fish"]
292309shebangs = ["fish"]
293−roots = []
294310comment-token = "#"
295311indent = { tab-width = 4, unit = " " }
296312
@@ -304,7 +320,6 @@ scope = "source.mint"
304320injection-regex = "mint"
305321file-types = ["mint"]
306322shebangs = []
307−roots = []
308323comment-token = "//"
309324language-servers = [ "mint" ]
310325indent = { tab-width = 2, unit = " " }
@@ -313,8 +328,28 @@ indent = { tab-width = 2, unit = " " }
313328name = "json"
314329scope = "source.json"
315330injection-regex = "json"
316−file-types = ["json", "jsonc", "arb", "ipynb", "geojson", "gltf"]
317−roots = []
331+file-types = [
332+ "json",
333+ "jsonc",
334+ "arb",
335+ "ipynb",
336+ "geojson",
337+ "gltf",
338+ "webmanifest",
339+ "flake.lock",
340+ ".babelrc",
341+ ".bowerrc",
342+ ".jscrc",
343+ "js.map",
344+ "ts.map",
345+ "css.map",
346+ ".jslintrc",
347+ "jsonld",
348+ ".vuerc",
349+ "composer.lock",
350+ ".watchmanconfig",
351+ "avsc"
352+]
318353language-servers = [ "vscode-json-language-server" ]
319354auto-format = true
320355indent = { tab-width = 2, unit = " " }
@@ -323,12 +358,26 @@ indent = { tab-width = 2, unit = " " }
323358name = "json"
324359source = { git = "https://github.com/tree-sitter/tree-sitter-json", rev = "73076754005a460947cafe8e03a8cf5fa4fa2938" }
325360
361+
362+[[language]]
363+name = "json5"
364+scope = "source.json5"
365+injection-regex = "json5"
366+file-types = ["json5"]
367+language-servers = []
368+comment-token = "//"
369+indent = { tab-width = 4, unit = " " }
370+# https://json5.org
371+
372+[[grammar]]
373+name = "json5"
374+source = { git = "https://github.com/Joakker/tree-sitter-json5", rev = "c23f7a9b1ee7d45f516496b1e0e4be067264fa0d" }
375+
326376[[language]]
327377name = "c"
328378scope = "source.c"
329379injection-regex = "c"
330380file-types = ["c"] # TODO: ["h"]
331−roots = []
332381comment-token = "//"
333382language-servers = [ "clangd" ]
334383indent = { tab-width = 2, unit = " " }
@@ -364,8 +413,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-c", rev = "7175a6dd
364413name = "cpp"
365414scope = "source.cpp"
366415injection-regex = "cpp"
367−file-types = ["cc", "hh", "c++", "cpp", "hpp", "h", "ipp", "tpp", "cxx", "hxx", "ixx", "txx", "ino", "C", "H", "cu", "cuh", "cppm"]
368−roots = []
416+file-types = ["cc", "hh", "c++", "cpp", "hpp", "h", "ipp", "tpp", "cxx", "hxx", "ixx", "txx", "ino", "C", "H", "cu", "cuh", "cppm", "h++", "ii", "inl", { suffix = ".hpp.in" }, { suffix = ".h.in" }]
369417comment-token = "//"
370418language-servers = [ "clangd" ]
371419indent = { tab-width = 2, unit = " " }
@@ -411,7 +459,7 @@ language-servers = [ "crystalline" ]
411459name = "c-sharp"
412460scope = "source.csharp"
413461injection-regex = "c-?sharp"
414−file-types = ["cs"]
462+file-types = ["cs", "csx", "cake"]
415463roots = ["sln", "csproj"]
416464comment-token = "//"
417465indent = { tab-width = 4, unit = "\t" }
@@ -448,7 +496,7 @@ file-types = ["go"]
448496roots = ["go.work", "go.mod"]
449497auto-format = true
450498comment-token = "//"
451−language-servers = [ "gopls" ]
499+language-servers = [ "gopls", "golangci-lint-lsp" ]
452500# TODO: gopls needs utf-8 offsets?
453501indent = { tab-width = 4, unit = "\t" }
454502
@@ -498,7 +546,6 @@ name = "gomod"
498546scope = "source.gomod"
499547injection-regex = "gomod"
500548file-types = ["go.mod"]
501−roots = []
502549auto-format = true
503550comment-token = "//"
504551language-servers = [ "gopls" ]
@@ -513,7 +560,6 @@ name = "gotmpl"
513560scope = "source.gotmpl"
514561injection-regex = "gotmpl"
515562file-types = ["gotmpl"]
516−roots = []
517563comment-token = "//"
518564language-servers = [ "gopls" ]
519565indent = { tab-width = 2, unit = " " }
@@ -527,7 +573,6 @@ name = "gowork"
527573scope = "source.gowork"
528574injection-regex = "gowork"
529575file-types = ["go.work"]
530−roots = []
531576auto-format = true
532577comment-token = "//"
533578language-servers = [ "gopls" ]
@@ -542,9 +587,8 @@ name = "javascript"
542587scope = "source.js"
543588injection-regex = "(js|javascript)"
544589language-id = "javascript"
545−file-types = ["js", "mjs", "cjs"]
590+file-types = ["js", "mjs", "cjs", "rules", "es6", "pac", "jakefile"]
546591shebangs = ["node"]
547−roots = []
548592comment-token = "//"
549593language-servers = [ "typescript-language-server" ]
550594indent = { tab-width = 2, unit = " " }
@@ -571,7 +615,6 @@ scope = "source.jsx"
571615injection-regex = "jsx"
572616language-id = "javascriptreact"
573617file-types = ["jsx"]
574−roots = []
575618comment-token = "//"
576619language-servers = [ "typescript-language-server" ]
577620indent = { tab-width = 2, unit = " " }
@@ -583,8 +626,7 @@ scope = "source.ts"
583626injection-regex = "(ts|typescript)"
584627file-types = ["ts", "mts", "cts"]
585628language-id = "typescript"
586−shebangs = []
587−roots = []
629+shebangs = ["deno", "ts-node"]
588630language-servers = [ "typescript-language-server" ]
589631indent = { tab-width = 2, unit = " " }
590632
@@ -598,7 +640,6 @@ scope = "source.tsx"
598640injection-regex = "(tsx)" # |typescript
599641language-id = "typescriptreact"
600642file-types = ["tsx"]
601−roots = []
602643language-servers = [ "typescript-language-server" ]
603644indent = { tab-width = 2, unit = " " }
604645
@@ -611,7 +652,6 @@ name = "css"
611652scope = "source.css"
612653injection-regex = "css"
613654file-types = ["css", "scss"]
614−roots = []
615655language-servers = [ "vscode-css-language-server" ]
616656auto-format = true
617657indent = { tab-width = 2, unit = " " }
@@ -625,7 +665,6 @@ name = "scss"
625665scope = "source.scss"
626666injection-regex = "scss"
627667file-types = ["scss"]
628−roots = []
629668language-servers = [ "vscode-css-language-server" ]
630669auto-format = true
631670indent = { tab-width = 2, unit = " " }
@@ -638,8 +677,7 @@ source = { git = "https://github.com/serenadeai/tree-sitter-scss", rev = "c478c6
638677name = "html"
639678scope = "text.html.basic"
640679injection-regex = "html"
641−file-types = ["html"]
642−roots = []
680+file-types = ["html", "htm", "shtml", "xhtml", "xht", "jsp", "asp", "aspx", "jshtm", "volt", "rhtml"]
643681language-servers = [ "vscode-html-language-server" ]
644682auto-format = true
645683indent = { tab-width = 2, unit = " " }
@@ -652,9 +690,9 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-html", rev = "29f53
652690name = "python"
653691scope = "source.python"
654692injection-regex = "python"
655−file-types = ["py","pyi","py3","pyw","ptl",".pythonstartup",".pythonrc","SConstruct"]
693+file-types = ["py","pyi","py3","pyw","ptl",".pythonstartup",".pythonrc","SConstruct", "rpy", "cpy", "ipy", "pyt", "SConscript"]
656694shebangs = ["python"]
657−roots = []
695+roots = ["pyproject.toml", "setup.py", "poetry.lock", "pyrightconfig.json"]
658696comment-token = "#"
659697language-servers = [ "pylsp" ]
660698# TODO: pyls needs utf-8 offsets
@@ -662,7 +700,7 @@ indent = { tab-width = 4, unit = " " }
662700
663701[[grammar]]
664702name = "python"
665−source = { git = "https://github.com/tree-sitter/tree-sitter-python", rev = "de221eccf9a221f5b85474a553474a69b4b5784d" }
703+source = { git = "https://github.com/tree-sitter/tree-sitter-python", rev = "4bfdd9033a2225cc95032ce77066b7aeca9e2efc" }
666704
667705[[language]]
668706name = "nickel"
@@ -670,7 +708,6 @@ scope = "source.nickel"
670708injection-regex = "nickel"
671709file-types = ["ncl"]
672710shebangs = []
673−roots = []
674711comment-token = "#"
675712language-servers = [ "nls" ]
676713indent = { tab-width = 2, unit = " " }
@@ -691,7 +728,6 @@ scope = "source.nix"
691728injection-regex = "nix"
692729file-types = ["nix"]
693730shebangs = []
694−roots = []
695731comment-token = "#"
696732language-servers = [ "nil" ]
697733indent = { tab-width = 2, unit = " " }
@@ -704,9 +740,43 @@ source = { git = "https://github.com/nix-community/tree-sitter-nix", rev = "1b69
704740name = "ruby"
705741scope = "source.ruby"
706742injection-regex = "ruby"
707−file-types = ["rb", "rake", "rakefile", "irb", "gemfile", "gemspec", "Rakefile", "Gemfile", "rabl", "jbuilder", "jb", "Podfile", "podspec", "Vagrantfile", "Brewfile"]
743+file-types = [
744+ "rb",
745+ "rake",
746+ "rakefile",
747+ "irb",
748+ "gemfile",
749+ "gemspec",
750+ "Rakefile",
751+ "Gemfile",
752+ "rabl",
753+ "jbuilder",
754+ "jb",
755+ "Podfile",
756+ "podspec",
757+ "Vagrantfile",
758+ "Brewfile",
759+ "rjs",
760+ "rbi",
761+ "Guardfile",
762+ "Capfile",
763+ "Cheffile",
764+ "Hobofile",
765+ "Appraisals",
766+ "Rantfile",
767+ "Berksfile",
768+ "Berksfile.lock",
769+ "Thorfile",
770+ "Puppetfile",
771+ "Fastfile",
772+ "Appfile",
773+ "Deliverfile",
774+ "Matchfile",
775+ "Scanfile",
776+ "Snapfile",
777+ "Gymfile"
778+]
708779shebangs = ["ruby"]
709−roots = []
710780comment-token = "#"
711781language-servers = [ "solargraph" ]
712782indent = { tab-width = 2, unit = " " }
@@ -719,9 +789,48 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-ruby", rev = "206c7
719789name = "bash"
720790scope = "source.bash"
721791injection-regex = "(shell|bash|zsh|sh)"
722−file-types = ["sh", "bash", "zsh", ".bash_login", ".bash_logout", ".bash_profile", ".bashrc", ".profile", ".zshenv", ".zlogin", ".zlogout", ".zprofile", ".zshrc", ".zimrc", "APKBUILD", "PKGBUILD", "eclass", "ebuild", "bazelrc", ".bash_aliases", "Renviron", ".Renviron"]
792+file-types = [
793+ "sh",
794+ "bash",
795+ "zsh",
796+ ".bash_login",
797+ ".bash_logout",
798+ ".bash_profile",
799+ ".bashrc",
800+ ".profile",
801+ ".zshenv",
802+ "zshenv",
803+ ".zlogin",
804+ "zlogin",
805+ ".zlogout",
806+ "zlogout",
807+ ".zprofile",
808+ "zprofile",
809+ ".zshrc",
810+ "zshrc",
811+ ".zimrc",
812+ "APKBUILD",
813+ "PKGBUILD",
814+ "eclass",
815+ "ebuild",
816+ "bazelrc",
817+ ".bash_aliases",
818+ "Renviron",
819+ ".Renviron",
820+ ".xprofile",
821+ ".xsession",
822+ ".xsessionrc",
823+ "zsh-theme",
824+ "ksh",
825+ "cshrc",
826+ "tcshrc",
827+ ".yashrc",
828+ ".yash_profile",
829+ ".hushlogin",
830+ "bashrc_Apple_Terminal",
831+ "zshrc_Apple_Terminal"
832+]
723833shebangs = ["sh", "bash", "dash", "zsh"]
724−roots = []
725834comment-token = "#"
726835language-servers = [ "bash-language-server" ]
727836indent = { tab-width = 2, unit = " " }
@@ -734,7 +843,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "275ef
734843name = "php"
735844scope = "source.php"
736845injection-regex = "php"
737−file-types = ["php", "inc"]
846+file-types = ["php", "inc", "php4", "php5", "phtml", "ctp"]
738847shebangs = ["php"]
739848roots = ["composer.json", "index.php"]
740849language-servers = [ "intelephense" ]
@@ -749,7 +858,6 @@ name = "twig"
749858scope = "source.twig"
750859injection-regex = "twig"
751860file-types = ["twig"]
752−roots = []
753861indent = { tab-width = 2, unit = " " }
754862
755863[[grammar]]
@@ -760,8 +868,7 @@ source = { git = "https://github.com/gbprod/tree-sitter-twig", rev = "807b293fec
760868name = "latex"
761869scope = "source.tex"
762870injection-regex = "tex"
763−file-types = ["tex", "sty", "cls", "Rd"]
764−roots = []
871+file-types = ["tex", "sty", "cls", "Rd", "bbx", "cbx"]
765872comment-token = "%"
766873language-servers = [ "texlab" ]
767874indent = { tab-width = 4, unit = "\t" }
@@ -775,7 +882,6 @@ name = "bibtex"
775882scope = "source.bib"
776883injection-regex = "bib"
777884file-types = ["bib"]
778−roots = []
779885comment-token = "%"
780886language-servers = [ "texlab" ]
781887indent = { tab-width = 4, unit = "\t" }
@@ -812,11 +918,23 @@ indent = { tab-width = 2, unit = " " }
812918name = "lean"
813919source = { git = "https://github.com/Julian/tree-sitter-lean", rev = "d98426109258b266e1e92358c5f11716d2e8f638" }
814920
921+
922+[[language]]
923+name = "lpf"
924+comment-token = "#"
925+scope = "source.lpf"
926+file-types = ["lpf"]
927+
928+[[grammar]]
929+name = "lpf"
930+source = { git = "https://gitlab.com/TheZoq2/tree-sitter-lpf", rev = "db7372e60c722ca7f12ab359e57e6bf7611ab126" }
931+
815932[[language]]
816933name = "julia"
817934scope = "source.julia"
818935injection-regex = "julia"
819936file-types = ["jl"]
937+shebangs = ["julia"]
820938roots = ["Manifest.toml", "Project.toml"]
821939comment-token = "#"
822940language-servers = [ "julia" ]
@@ -830,7 +948,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "8fb3
830948name = "java"
831949scope = "source.java"
832950injection-regex = "java"
833−file-types = ["java"]
951+file-types = ["java", "jav"]
834952roots = ["pom.xml", "build.gradle", "build.gradle.kts"]
835953language-servers = [ "jdtls" ]
836954indent = { tab-width = 2, unit = " " }
@@ -839,12 +957,24 @@ indent = { tab-width = 2, unit = " " }
839957name = "java"
840958source = { git = "https://github.com/tree-sitter/tree-sitter-java", rev = "09d650def6cdf7f479f4b78f595e9ef5b58ce31e" }
841959
960+[[language]]
961+name = "smali"
962+scope = "source.smali"
963+injection-regex = "smali"
964+file-types = ["smali"]
965+comment-token = "#"
966+roots = []
967+indent = { tab-width = 4, unit = " " }
968+
969+[[grammar]]
970+name = "smali"
971+source = { git = "https://github.com/amaanq/tree-sitter-smali", rev = "5ae51e15c4d1ac93cba6127caf3d1f0a072c140c" }
972+
842973[[language]]
843974name = "ledger"
844975scope = "source.ledger"
845976injection-regex = "ledger"
846977file-types = ["ldg", "ledger", "journal"]
847−roots = []
848978comment-token = ";"
849979indent = { tab-width = 4, unit = " " }
850980
@@ -857,21 +987,19 @@ name = "beancount"
857987scope = "source.beancount"
858988injection-regex = "beancount"
859989file-types = ["beancount", "bean"]
860−roots = []
861990comment-token = ";"
862991indent = { tab-width = 2, unit = " " }
863992
864993[[grammar]]
865994name = "beancount"
866−source = { git = "https://github.com/polarmutex/tree-sitter-beancount", rev = "4cbd1f09cd07c1f1fabf867c2cf354f9da53cc4c" }
995+source = { git = "https://github.com/polarmutex/tree-sitter-beancount", rev = "f3741a3a68ade59ec894ed84a64673494d2ba8f3" }
867996
868997[[language]]
869998name = "ocaml"
870999scope = "source.ocaml"
8711000injection-regex = "ocaml"
8721001file-types = ["ml"]
873−shebangs = []
874−roots = []
1002+shebangs = ["ocaml", "ocamlrun", "ocamlscript"]
8751003comment-token = "(**)"
8761004language-servers = [ "ocamllsp" ]
8771005indent = { tab-width = 2, unit = " " }
@@ -881,7 +1009,6 @@ indent = { tab-width = 2, unit = " " }
8811009'{' = '}'
8821010'[' = ']'
8831011'"' = '"'
884−'`' = '`'
8851012
8861013[[grammar]]
8871014name = "ocaml"
@@ -892,7 +1019,6 @@ name = "ocaml-interface"
8921019scope = "source.ocaml.interface"
8931020file-types = ["mli"]
8941021shebangs = []
895−roots = []
8961022comment-token = "(**)"
8971023language-servers = [ "ocamllsp" ]
8981024indent = { tab-width = 2, unit = " " }
@@ -902,7 +1028,6 @@ indent = { tab-width = 2, unit = " " }
9021028'{' = '}'
9031029'[' = ']'
9041030'"' = '"'
905−'`' = '`'
9061031
9071032[[grammar]]
9081033name = "ocaml-interface"
@@ -928,7 +1053,6 @@ name = "svelte"
9281053scope = "source.svelte"
9291054injection-regex = "svelte"
9301055file-types = ["svelte"]
931−roots = []
9321056indent = { tab-width = 2, unit = " " }
9331057language-servers = [ "svelteserver" ]
9341058
@@ -953,10 +1077,9 @@ source = { git = "https://github.com/ikatyang/tree-sitter-vue", rev = "91fe27547
9531077name = "yaml"
9541078scope = "source.yaml"
9551079file-types = ["yml", "yaml"]
956−roots = []
9571080comment-token = "#"
9581081indent = { tab-width = 2, unit = " " }
959−language-servers = [ "yaml-language-server" ]
1082+language-servers = [ "yaml-language-server", "ansible-language-server" ]
9601083injection-regex = "yml|yaml"
9611084
9621085[[grammar]]
@@ -975,13 +1098,12 @@ indent = { tab-width = 2, unit = " " }
9751098
9761099[[grammar]]
9771100name = "haskell"
978−source = { git = "https://github.com/tree-sitter/tree-sitter-haskell", rev = "98fc7f59049aeb713ab9b72a8ff25dcaaef81087" }
1101+source = { git = "https://github.com/tree-sitter/tree-sitter-haskell", rev = "d7ac98f49e3ed7e17541256fe3881a967d7ffdd3" }
9791102
9801103[[language]]
9811104name = "haskell-persistent"
9821105scope = "source.persistentmodels"
9831106file-types = ["persistentmodels"]
984−roots = []
9851107comment-token = "--"
9861108indent = { tab-width = 2, unit = " " }
9871109
@@ -1000,7 +1122,10 @@ language-servers = [ "purescript-language-server" ]
10001122indent = { tab-width = 2, unit = " " }
10011123auto-format = true
10021124formatter = { command = "purs-tidy", args = ["format"] }
1003−grammar = "haskell"
1125+
1126+[[grammar]]
1127+name = "purescript"
1128+source = { git = "https://github.com/postsolar/tree-sitter-purescript", rev = "5ef5592674ea42de75fc2792972e4ea0b6e3da6c" }
10041129
10051130[[language]]
10061131name = "zig"
@@ -1044,7 +1169,6 @@ source = { git = "https://github.com/maxxnino/tree-sitter-zig", rev = "0d08703e4
10441169[[language]]
10451170name = "prolog"
10461171scope = "source.prolog"
1047−roots = []
10481172file-types = ["pl", "prolog"]
10491173shebangs = ["swipl"]
10501174comment-token = "%"
@@ -1054,7 +1178,6 @@ language-servers = [ "swipl" ]
10541178name = "tsq"
10551179scope = "source.tsq"
10561180file-types = ["tsq"]
1057−roots = []
10581181comment-token = ";"
10591182injection-regex = "tsq"
10601183indent = { tab-width = 2, unit = " " }
@@ -1067,7 +1190,6 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-tsq", rev = "48b5
10671190name = "cmake"
10681191scope = "source.cmake"
10691192file-types = ["cmake", "CMakeLists.txt"]
1070−roots = []
10711193comment-token = "#"
10721194indent = { tab-width = 2, unit = " " }
10731195language-servers = [ "cmake-language-server" ]
@@ -1080,9 +1202,9 @@ source = { git = "https://github.com/uyha/tree-sitter-cmake", rev = "6e51463ef30
10801202[[language]]
10811203name = "make"
10821204scope = "source.make"
1083−file-types = ["Makefile", "makefile", "make", "mk"]
1205+file-types = ["Makefile", "makefile", "make", "mk", "mak", "GNUmakefile", "OCamlMakefile"]
1206+shebangs = ["make", "gmake"]
10841207injection-regex = "(make|makefile|Makefile|mk)"
1085−roots = []
10861208comment-token = "#"
10871209indent = { tab-width = 4, unit = "\t" }
10881210
@@ -1094,7 +1216,6 @@ source = { git = "https://github.com/alemuller/tree-sitter-make", rev = "a4b9187
10941216name = "glsl"
10951217scope = "source.glsl"
10961218file-types = ["glsl", "vert", "tesc", "tese", "geom", "frag", "comp" ]
1097−roots = []
10981219comment-token = "//"
10991220indent = { tab-width = 4, unit = " " }
11001221injection-regex = "glsl"
@@ -1106,31 +1227,39 @@ source = { git = "https://github.com/theHamsta/tree-sitter-glsl", rev = "88408ff
11061227[[language]]
11071228name = "perl"
11081229scope = "source.perl"
1109−file-types = ["pl", "pm", "t"]
1230+file-types = ["pl", "pm", "t", "psgi", "raku", "rakumod", "rakutest", "rakudoc", "nqp", "p6", "pl6", "pm6"]
11101231shebangs = ["perl"]
1111−roots = []
11121232comment-token = "#"
11131233language-servers = [ "perlnavigator" ]
11141234indent = { tab-width = 2, unit = " " }
11151235
11161236[[grammar]]
11171237name = "perl"
1118−source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "ed21ecbcc128a6688770ebafd3ef68a1c9bc1ea9" }
1238+source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "e99bb5283805db4cb86c964722d709df21b0ac16" }
1239+
1240+[[language]]
1241+name = "pod"
1242+scope = "source.pod"
1243+injection-regex = "pod"
1244+file-types = ["pod"]
1245+
1246+[[grammar]]
1247+name = "pod"
1248+source = { git = "https://github.com/tree-sitter-perl/tree-sitter-pod", rev = "d466b84009a63986834498073ec05d58d727d55f" }
11191249
11201250[[language]]
11211251name = "racket"
11221252scope = "source.racket"
1123−roots = []
11241253file-types = ["rkt", "rktd", "rktl", "scrbl"]
11251254shebangs = ["racket"]
11261255comment-token = ";"
1256+indent = { tab-width = 2, unit = " " }
11271257language-servers = [ "racket" ]
11281258grammar = "scheme"
11291259
11301260[[language]]
11311261name = "common-lisp"
11321262scope = "source.lisp"
1133−roots = []
11341263file-types = ["lisp", "asd", "cl", "l", "lsp", "ny", "podsl", "sexp"]
11351264shebangs = ["lisp", "sbcl", "ccl", "clisp", "ecl"]
11361265comment-token = ";"
@@ -1147,19 +1276,17 @@ grammar = "scheme"
11471276[[language]]
11481277name = "comment"
11491278scope = "scope.comment"
1150−roots = []
11511279file-types = []
11521280injection-regex = "comment"
11531281
11541282[[grammar]]
11551283name = "comment"
1156−source = { git = "https://github.com/stsewd/tree-sitter-comment", rev = "5dd3c62f1bbe378b220fe16b317b85247898639e" }
1284+source = { git = "https://github.com/stsewd/tree-sitter-comment", rev = "a37ca370310ac6f89b6e0ebf2b86b2219780494e" }
11571285
11581286[[language]]
11591287name = "wgsl"
11601288scope = "source.wgsl"
11611289file-types = ["wgsl"]
1162−roots = []
11631290comment-token = "//"
11641291language-servers = [ "wgsl_analyzer" ]
11651292indent = { tab-width = 4, unit = " " }
@@ -1171,7 +1298,6 @@ source = { git = "https://github.com/szebniok/tree-sitter-wgsl", rev = "272e89ef
11711298[[language]]
11721299name = "llvm"
11731300scope = "source.llvm"
1174−roots = []
11751301file-types = ["ll"]
11761302comment-token = ";"
11771303indent = { tab-width = 2, unit = " " }
@@ -1179,12 +1305,11 @@ injection-regex = "llvm"
11791305
11801306[[grammar]]
11811307name = "llvm"
1182−source = { git = "https://github.com/benwilliamgraham/tree-sitter-llvm", rev = "3b213925b9c4f42c1acfe2e10bfbb438d9c6834d" }
1308+source = { git = "https://github.com/benwilliamgraham/tree-sitter-llvm", rev = "e9948edc41e9e5869af99dddb2b5ff5cc5581af6" }
11831309
11841310[[language]]
11851311name = "llvm-mir"
11861312scope = "source.llvm_mir"
1187−roots = []
11881313file-types = []
11891314comment-token = ";"
11901315indent = { tab-width = 2, unit = " " }
@@ -1200,7 +1325,6 @@ name = "llvm-mir-yaml"
12001325#
12011326# grammar = "yaml"
12021327scope = "source.yaml"
1203−roots = []
12041328file-types = ["mir"]
12051329comment-token = "#"
12061330indent = { tab-width = 2, unit = " " }
@@ -1208,7 +1332,6 @@ indent = { tab-width = 2, unit = " " }
12081332[[language]]
12091333name = "tablegen"
12101334scope = "source.tablegen"
1211−roots = []
12121335file-types = ["td"]
12131336comment-token = "//"
12141337indent = { tab-width = 2, unit = " " }
@@ -1222,26 +1345,25 @@ source = { git = "https://github.com/Flakebi/tree-sitter-tablegen", rev = "568dd
12221345name = "markdown"
12231346scope = "source.md"
12241347injection-regex = "md|markdown"
1225−file-types = ["md", "markdown", "PULLREQ_EDITMSG"]
1348+file-types = ["md", "markdown", "PULLREQ_EDITMSG", "mkd", "mdwn", "mdown", "markdn", "mdtxt", "mdtext", "workbook"]
12261349roots = [".marksman.toml"]
12271350language-servers = [ "marksman" ]
12281351indent = { tab-width = 2, unit = " " }
12291352
12301353[[grammar]]
12311354name = "markdown"
1232−source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "fa6bfd51727e4bef99f7eec5f43947f73d64ea7d", subpath = "tree-sitter-markdown" }
1355+source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "aaf76797aa8ecd9a5e78e0ec3681941de6c945ee", subpath = "tree-sitter-markdown" }
12331356
12341357[[language]]
12351358name = "markdown.inline"
12361359scope = "source.markdown.inline"
12371360injection-regex = "markdown\\.inline"
12381361file-types = []
1239−roots = []
12401362grammar = "markdown_inline"
12411363
12421364[[grammar]]
12431365name = "markdown_inline"
1244−source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "fa6bfd51727e4bef99f7eec5f43947f73d64ea7d", subpath = "tree-sitter-markdown-inline" }
1366+source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "aaf76797aa8ecd9a5e78e0ec3681941de6c945ee", subpath = "tree-sitter-markdown-inline" }
12451367
12461368[[language]]
12471369name = "dart"
@@ -1287,7 +1409,6 @@ source = { git = "https://github.com/camdencheek/tree-sitter-dockerfile", rev =
12871409[[language]]
12881410name = "git-commit"
12891411scope = "git.commitmsg"
1290−roots = []
12911412file-types = ["COMMIT_EDITMSG"]
12921413comment-token = "#"
12931414indent = { tab-width = 2, unit = " " }
@@ -1301,8 +1422,7 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-git-commit", rev
13011422[[language]]
13021423name = "diff"
13031424scope = "source.diff"
1304−roots = []
1305−file-types = ["diff", "patch"]
1425+file-types = ["diff", "patch", "rej"]
13061426injection-regex = "diff"
13071427comment-token = "#"
13081428indent = { tab-width = 2, unit = " " }
@@ -1314,7 +1434,6 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-diff", rev = "fd7
13141434[[language]]
13151435name = "git-rebase"
13161436scope = "source.gitrebase"
1317−roots = []
13181437file-types = ["git-rebase-todo"]
13191438injection-regex = "git-rebase"
13201439comment-token = "#"
@@ -1329,7 +1448,6 @@ name = "regex"
13291448scope = "source.regex"
13301449injection-regex = "regex"
13311450file-types = ["regex", ".Rbuildignore"]
1332−roots = []
13331451
13341452[[grammar]]
13351453name = "regex"
@@ -1338,7 +1456,6 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-regex", rev = "e1cf
13381456[[language]]
13391457name = "git-config"
13401458scope = "source.gitconfig"
1341−roots = []
13421459file-types = [".gitmodules", ".gitconfig", { suffix = ".git/config" }, { suffix = ".config/git/config" }]
13431460injection-regex = "git-config"
13441461comment-token = "#"
@@ -1351,7 +1468,6 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-git-config", rev
13511468[[language]]
13521469name = "git-attributes"
13531470scope = "source.gitattributes"
1354−roots = []
13551471file-types = [".gitattributes"]
13561472injection-regex = "git-attributes"
13571473comment-token = "#"
@@ -1364,8 +1480,7 @@ source = { git = "https://github.com/mtoohey31/tree-sitter-gitattributes", rev =
13641480[[language]]
13651481name = "git-ignore"
13661482scope = "source.gitignore"
1367−roots = []
1368−file-types = [".gitignore", ".gitignore_global"]
1483+file-types = [".gitignore", ".gitignore_global", ".ignore", ".prettierignore", ".eslintignore", ".npmignore", "CODEOWNERS"]
13691484injection-regex = "git-ignore"
13701485comment-token = "#"
13711486grammar = "gitignore"
@@ -1379,7 +1494,7 @@ name = "graphql"
13791494scope = "source.graphql"
13801495injection-regex = "graphql"
13811496file-types = ["gql", "graphql", "graphqls"]
1382−roots = []
1497+language-servers = [ "graphql-language-service" ]
13831498indent = { tab-width = 2, unit = " " }
13841499
13851500[[grammar]]
@@ -1406,7 +1521,6 @@ name = "iex"
14061521scope = "source.iex"
14071522injection-regex = "iex"
14081523file-types = ["iex"]
1409−roots = []
14101524
14111525[[grammar]]
14121526name = "iex"
@@ -1425,7 +1539,7 @@ indent = { tab-width = 2, unit = " " }
14251539
14261540[[grammar]]
14271541name = "rescript"
1428−source = { git = "https://github.com/jaredramirez/tree-sitter-rescript", rev = "65609807c628477f3b94052e7ef895885ac51c3c" }
1542+source = { git = "https://github.com/jaredramirez/tree-sitter-rescript", rev = "467dcf99f68c47823d7b378779a6b282d7ef9782" }
14291543
14301544[[language]]
14311545name = "erlang"
@@ -1469,7 +1583,6 @@ scope = "source.hcl"
14691583injection-regex = "(hcl|tf|nomad)"
14701584language-id = "terraform"
14711585file-types = ["hcl", "tf", "nomad"]
1472−roots = []
14731586comment-token = "#"
14741587indent = { tab-width = 2, unit = " " }
14751588language-servers = [ "terraform-ls" ]
@@ -1484,7 +1597,6 @@ name = "tfvars"
14841597scope = "source.tfvars"
14851598language-id = "terraform-vars"
14861599file-types = ["tfvars"]
1487−roots = []
14881600comment-token = "#"
14891601indent = { tab-width = 2, unit = " " }
14901602language-servers = [ "terraform-ls" ]
@@ -1496,7 +1608,6 @@ name = "org"
14961608scope = "source.org"
14971609injection-regex = "org"
14981610file-types = ["org"]
1499−roots = []
15001611indent = { tab-width = 2, unit = " " }
15011612
15021613[[grammar]]
@@ -1508,7 +1619,6 @@ name = "solidity"
15081619scope = "source.sol"
15091620injection-regex = "(sol|solidity)"
15101621file-types = ["sol"]
1511−roots = []
15121622comment-token = "//"
15131623indent = { tab-width = 4, unit = " " }
15141624language-servers = [ "solc" ]
@@ -1526,20 +1636,23 @@ roots = ["gleam.toml"]
15261636comment-token = "//"
15271637indent = { tab-width = 2, unit = " " }
15281638language-servers = [ "gleam" ]
1639+auto-format = true
15291640
15301641[[grammar]]
15311642name = "gleam"
1532−source = { git = "https://github.com/gleam-lang/tree-sitter-gleam", rev = "ae79782c00656945db69641378e688cdb78d52c1" }
1643+source = { git = "https://github.com/gleam-lang/tree-sitter-gleam", rev = "b2afa4fd6bb41a7bf912b034c653c90af7ae5122" }
15331644
15341645[[language]]
15351646name = "ron"
15361647scope = "source.ron"
15371648injection-regex = "ron"
15381649file-types = ["ron"]
1539−roots = []
15401650comment-token = "//"
15411651indent = { tab-width = 4, unit = " " }
1542−grammar = "rust"
1652+
1653+[[grammar]]
1654+name = "ron"
1655+source = { git = "https://github.com/zee-editor/tree-sitter-ron", rev = "7762d709a0f7c1f9e269d0125a2e8a7a69006146" }
15431656
15441657[[language]]
15451658name = "robot"
@@ -1547,21 +1660,19 @@ scope = "source.robot"
15471660injection-regex = "robot"
15481661file-types = ["robot", "resource"]
15491662comment-token = "#"
1550−roots = []
15511663indent = { tab-width = 4, unit = " " }
15521664language-servers = [ "robotframework_ls" ]
15531665
15541666[[grammar]]
15551667name = "robot"
1556−source = { git = "https://github.com/Hubro/tree-sitter-robot", rev = "f1142bfaa6acfce95e25d2c6d18d218f4f533927" }
1668+source = { git = "https://github.com/Hubro/tree-sitter-robot", rev = "322e4cc65754d2b3fdef4f2f8a71e0762e3d13af" }
15571669
15581670[[language]]
15591671name = "r"
15601672scope = "source.r"
15611673injection-regex = "(r|R)"
1562−file-types = ["r", "R", ".Rprofile", "Rprofile.site"]
1674+file-types = ["r", "R", ".Rprofile", "Rprofile.site", ".RHistory"]
15631675shebangs = ["r", "R"]
1564−roots = []
15651676comment-token = "#"
15661677indent = { tab-width = 2, unit = " " }
15671678language-servers = [ "r" ]
@@ -1573,9 +1684,9 @@ source = { git = "https://github.com/r-lib/tree-sitter-r", rev = "cc04302e1bff76
15731684[[language]]
15741685name = "rmarkdown"
15751686scope = "source.rmd"
1687+language-id = "rmd"
15761688injection-regex = "(r|R)md"
15771689file-types = ["rmd", "Rmd"]
1578−roots = []
15791690indent = { tab-width = 2, unit = " " }
15801691grammar = "markdown"
15811692language-servers = [ "r" ]
@@ -1599,7 +1710,6 @@ name = "erb"
15991710scope = "text.html.erb"
16001711injection-regex = "erb"
16011712file-types = ["erb"]
1602−roots = []
16031713indent = { tab-width = 2, unit = " " }
16041714grammar = "embedded-template"
16051715
@@ -1608,7 +1718,6 @@ name = "ejs"
16081718scope = "text.html.ejs"
16091719injection-regex = "ejs"
16101720file-types = ["ejs"]
1611−roots = []
16121721indent = { tab-width = 2, unit = " " }
16131722grammar = "embedded-template"
16141723
@@ -1644,15 +1753,14 @@ source = { git = "https://github.com/phoenixframework/tree-sitter-heex", rev = "
16441753[[language]]
16451754name = "sql"
16461755scope = "source.sql"
1647−file-types = ["sql"]
1648−roots = []
1756+file-types = ["sql", "dsql"]
16491757comment-token = "--"
16501758indent = { tab-width = 4, unit = " " }
16511759injection-regex = "sql"
16521760
16531761[[grammar]]
16541762name = "sql"
1655−source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "7cbac0472e5b8f8486ce64ffbcf1982d5cd5fc8d" }
1763+source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "25be0b8f17e9189ad9e1b875869d025c5aec1286" }
16561764
16571765[[language]]
16581766name = "gdscript"
@@ -1691,20 +1799,19 @@ scope = "source.nu"
16911799injection-regex = "nu"
16921800file-types = ["nu"]
16931801shebangs = ["nu"]
1694−roots = []
16951802comment-token = "#"
16961803indent = { tab-width = 2, unit = " " }
1804+language-servers = [ "nu-lsp" ]
16971805
16981806[[grammar]]
16991807name = "nu"
1700−source = { git = "https://github.com/LhKipp/tree-sitter-nu", rev = "eb95bdac3abd73ef47e53f19c63e74a31405ebd2" }
1808+source = { git = "https://github.com/nushell/tree-sitter-nu", rev = "98c11c491e3405c75affa1cf004097692da3dda2" }
17011809
17021810[[language]]
17031811name = "vala"
17041812scope = "source.vala"
17051813injection-regex = "vala"
17061814file-types = ["vala", "vapi"]
1707−roots = []
17081815comment-token = "//"
17091816indent = { tab-width = 2, unit = " " }
17101817language-servers = [ "vala-language-server" ]
@@ -1718,7 +1825,6 @@ name = "hare"
17181825scope = "source.hare"
17191826injection-regex = "hare"
17201827file-types = ["ha"]
1721−roots = []
17221828comment-token = "//"
17231829indent = { tab-width = 8, unit = "\t" }
17241830
@@ -1731,7 +1837,6 @@ name = "devicetree"
17311837scope = "source.devicetree"
17321838injection-regex = "(dtsi?|devicetree|fdt)"
17331839file-types = ["dts", "dtsi"]
1734−roots = []
17351840comment-token = "//"
17361841indent = { tab-width = 4, unit = "\t" }
17371842
@@ -1744,7 +1849,6 @@ name = "cairo"
17441849scope = "source.cairo"
17451850injection-regex = "cairo"
17461851file-types = ["cairo"]
1747−roots = []
17481852comment-token = "//"
17491853indent = { tab-width = 4, unit = " " }
17501854# auto-format = true
@@ -1756,7 +1860,6 @@ name = "cpon"
17561860scope = "scope.cpon"
17571861injection-regex = "cpon"
17581862file-types = ["cpon", "cp"]
1759−roots = []
17601863auto-format = true
17611864comment-token = "//"
17621865indent = { tab-width = 2, unit = " " }
@@ -1783,8 +1886,7 @@ source = { git = "https://github.com/ap29600/tree-sitter-odin", rev = "b219207e4
17831886name = "meson"
17841887scope = "source.meson"
17851888injection-regex = "meson"
1786−file-types = ["meson.build"]
1787−roots = []
1889+file-types = ["meson.build", "meson_options.txt"]
17881890comment-token = "#"
17891891indent = { tab-width = 2, unit = " " }
17901892
@@ -1796,7 +1898,6 @@ source = { git = "https://github.com/staysail/tree-sitter-meson", rev = "32a83e8
17961898name = "sshclientconfig"
17971899scope = "source.sshclientconfig"
17981900file-types = [{ suffix = ".ssh/config" }, { suffix = "/etc/ssh/ssh_config" }]
1799−roots = []
18001901comment-token = "#"
18011902
18021903[[grammar]]
@@ -1808,7 +1909,7 @@ name = "scheme"
18081909scope = "source.scheme"
18091910injection-regex = "scheme"
18101911file-types = ["ss", "scm"]
1811−roots = []
1912+shebangs = ["scheme", "guile", "chicken"]
18121913comment-token = ";"
18131914indent = { tab-width = 2, unit = " " }
18141915
@@ -1835,7 +1936,6 @@ source = {git = "https://github.com/v-analyzer/v-analyzer", subpath = "tree_sitt
18351936name = "verilog"
18361937scope = "source.verilog"
18371938file-types = ["v", "vh", "sv", "svh"]
1838−roots = []
18391939comment-token = "//"
18401940language-servers = [ "svlangserver" ]
18411941indent = { tab-width = 2, unit = " " }
@@ -1850,7 +1950,6 @@ name = "edoc"
18501950scope = "source.edoc"
18511951file-types = ["edoc", "edoc.in"]
18521952injection-regex = "edoc"
1853−roots = []
18541953indent = { tab-width = 4, unit = " " }
18551954
18561955[[grammar]]
@@ -1862,7 +1961,6 @@ name = "jsdoc"
18621961scope = "source.jsdoc"
18631962injection-regex = "jsdoc"
18641963file-types = ["jsdoc"]
1865−roots = []
18661964indent = { tab-width = 2, unit = " " }
18671965
18681966[[grammar]]
@@ -1874,7 +1972,6 @@ name = "openscad"
18741972scope = "source.openscad"
18751973injection-regex = "openscad"
18761974file-types = ["scad"]
1877−roots = []
18781975comment-token = "//"
18791976language-servers = [ "openscad-lsp" ]
18801977indent = { tab-width = 2, unit = "\t" }
@@ -1915,8 +2012,7 @@ source = { git = "https://github.com/sogaiu/tree-sitter-clojure", rev = "e57c569
19152012name = "starlark"
19162013scope = "source.starlark"
19172014injection-regex = "(starlark|bzl|bazel)"
1918−file-types = ["bzl", "bazel", "BUILD"]
1919−roots = []
2015+file-types = ["bzl", "bazel", "BUILD", "star"]
19202016comment-token = "#"
19212017indent = { tab-width = 4, unit = " " }
19222018grammar = "python"
@@ -1925,7 +2021,6 @@ grammar = "python"
19252021name = "elvish"
19262022scope = "source.elvish"
19272023file-types = ["elv"]
1928−roots = []
19292024comment-token = "#"
19302025indent = { tab-width = 2, unit = " " }
19312026language-servers = [ "elvish" ]
@@ -1941,7 +2036,6 @@ scope = "source.idr"
19412036injection-regex = "idr"
19422037file-types = ["idr"]
19432038shebangs = []
1944−roots = []
19452039comment-token = "--"
19462040indent = { tab-width = 2, unit = " " }
19472041language-servers = [ "idris2-lsp" ]
@@ -1965,20 +2059,18 @@ name = "ungrammar"
19652059scope = "source.ungrammar"
19662060injection-regex = "ungrammar"
19672061file-types = ["ungram", "ungrammar"]
1968−roots = []
19692062comment-token = "//"
19702063indent = { tab-width = 2, unit = " " }
19712064
19722065[[grammar]]
19732066name = "ungrammar"
1974−source = { git = "https://github.com/Philipp-M/tree-sitter-ungrammar", rev = "0113de880a58ea14f2a75802e9b99fcc25003d9c" }
2067+source = { git = "https://github.com/Philipp-M/tree-sitter-ungrammar", rev = "a7e104629cff5a8b7367187610631e8f5eb7c6ea" }
19752068
19762069[[language]]
19772070name = "dot"
19782071scope = "source.dot"
19792072injection-regex = "dot"
19802073file-types = ["dot"]
1981−roots = []
19822074comment-token = "//"
19832075indent = { tab-width = 4, unit = " " }
19842076language-servers = [ "dot-language-server" ]
@@ -2008,21 +2100,19 @@ name = "slint"
20082100scope = "source.slint"
20092101injection-regex = "slint"
20102102file-types = ["slint"]
2011−roots = []
20122103comment-token = "//"
20132104indent = { tab-width = 4, unit = " " }
20142105language-servers = [ "slint-lsp" ]
20152106
20162107[[grammar]]
20172108name = "slint"
2018−source = { git = "https://github.com/jrmoulton/tree-sitter-slint", rev = "0d4dda94f96623302dfc234e06be62a5717f47da" }
2109+source = { git = "https://github.com/jrmoulton/tree-sitter-slint", rev = "00c8a2d3645766f68c0d0460086c0a994e5b0d85" }
20192110
20202111[[language]]
20212112name = "task"
20222113scope = "source.task"
20232114injection-regex = "task"
20242115file-types = ["task"]
2025−roots = []
20262116comment-token = "#"
20272117indent = { tab-width = 2, unit = " " }
20282118
@@ -2035,7 +2125,6 @@ name = "xit"
20352125scope = "source.xit"
20362126injection-regex = "xit"
20372127file-types = ["xit"]
2038−roots = []
20392128indent = { tab-width = 4, unit = " " }
20402129
20412130[[grammar]]
@@ -2053,14 +2142,13 @@ roots = ["edgedb.toml"]
20532142
20542143[[grammar]]
20552144name ="esdl"
2056−source = { git = "https://github.com/greym0uth/tree-sitter-esdl", rev = "b840c8a8028127e0a7c6e6c45141adade2bd75cf" }
2145+source = { git = "https://github.com/greym0uth/tree-sitter-esdl", rev = "df83acc8cacd0cfb139eecee0e718dc32c4f92e2" }
20572146
20582147[[language]]
20592148name = "pascal"
20602149scope = "source.pascal"
20612150injection-regex = "pascal"
20622151file-types = ["pas", "pp", "inc", "lpr", "lfm"]
2063−roots = []
20642152comment-token = "//"
20652153indent = { tab-width = 2, unit = " " }
20662154language-servers = [ "pasls" ]
@@ -2075,7 +2163,6 @@ scope = "source.sml"
20752163injection-regex = "sml"
20762164file-types = ["sml"]
20772165comment-token = "(*"
2078−roots = []
20792166
20802167[[grammar]]
20812168name = "sml"
@@ -2099,19 +2186,17 @@ name = "astro"
20992186scope = "source.astro"
21002187injection-regex = "astro"
21012188file-types = ["astro"]
2102−roots = []
21032189indent = { tab-width = 2, unit = " " }
21042190
21052191[[grammar]]
21062192name = "astro"
2107−source = { git = "https://github.com/virchau13/tree-sitter-astro", rev = "5f5c3e73c45967df9aa42f861fad2d77cd4e0900" }
2193+source = { git = "https://github.com/virchau13/tree-sitter-astro", rev = "947e93089e60c66e681eba22283f4037841451e7" }
21082194
21092195[[language]]
21102196name = "bass"
21112197scope = "source.bass"
21122198injection-regex = "bass"
21132199file-types = ["bass"]
2114−roots = []
21152200comment-token = ";"
21162201indent = { tab-width = 2, unit = " " }
21172202language-servers = [ "bass" ]
@@ -2125,7 +2210,6 @@ name = "wat"
21252210scope = "source.wat"
21262211comment-token = ";;"
21272212file-types = ["wat"]
2128−roots = []
21292213
21302214[[grammar]]
21312215name = "wat"
@@ -2136,7 +2220,6 @@ name = "wast"
21362220scope = "source.wast"
21372221comment-token = ";;"
21382222file-types = ["wast"]
2139−roots = []
21402223
21412224[[grammar]]
21422225name = "wast"
@@ -2146,7 +2229,6 @@ source = { git = "https://github.com/wasm-lsp/tree-sitter-wasm", rev = "2ca28a9f
21462229name = "d"
21472230scope = "source.d"
21482231file-types = [ "d", "dd" ]
2149−roots = []
21502232comment-token = "//"
21512233injection-regex = "d"
21522234indent = { tab-width = 4, unit = " "}
@@ -2155,13 +2237,12 @@ formatter = { command = "dfmt" }
21552237
21562238[[grammar]]
21572239name = "d"
2158−source = { git = "https://github.com/gdamore/tree-sitter-d", rev="601c4a1e8310fb2f3c43fa8a923d0d27497f3c04" }
2240+source = { git = "https://github.com/gdamore/tree-sitter-d", rev = "5566f8ce8fc24186fad06170bbb3c8d97c935d74" }
21592241
21602242[[language]]
21612243name = "vhs"
21622244scope = "source.vhs"
21632245file-types = ["tape"]
2164−roots = []
21652246comment-token = "#"
21662247indent = { tab-width = 2, unit = " " }
21672248grammar = "vhs"
@@ -2174,21 +2255,76 @@ source = { git = "https://github.com/charmbracelet/tree-sitter-vhs", rev = "c6d8
21742255name = "kdl"
21752256scope = "source.kdl"
21762257file-types = ["kdl"]
2177−roots = []
21782258comment-token = "//"
21792259injection-regex = "kdl"
21802260
21812261[[grammar]]
21822262name = "kdl"
2183−source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d15df6610484e1d4b5c987ecad52373" }
2263+source = { git = "https://github.com/amaanq/tree-sitter-kdl", rev = "3ca569b9f9af43593c24f9e7a21f02f43a13bb88" }
21842264
21852265[[language]]
21862266name = "xml"
21872267scope = "source.xml"
21882268injection-regex = "xml"
2189−file-types = ["xml", "mobileconfig", "plist", "xib", "storyboard", "svg", "xsd", "gml", "xaml", "gir"]
2269+file-types = [
2270+ "xml",
2271+ "mobileconfig",
2272+ "plist",
2273+ "xib",
2274+ "storyboard",
2275+ "svg",
2276+ "xsd",
2277+ "gml",
2278+ "xaml",
2279+ "gir",
2280+ "rss",
2281+ "atom",
2282+ "opml",
2283+ "policy",
2284+ "ascx",
2285+ "axml",
2286+ "axaml",
2287+ "bpmn",
2288+ "cpt",
2289+ "csl",
2290+ "csproj.user",
2291+ "dita",
2292+ "ditamap",
2293+ "dtml",
2294+ "fxml",
2295+ "iml",
2296+ "isml",
2297+ "jmx",
2298+ "launch",
2299+ "menu",
2300+ "mxml",
2301+ "nuspec",
2302+ "pt",
2303+ "publishsettings",
2304+ "pubxml",
2305+ "pubxml.user",
2306+ "rbxlx",
2307+ "rbxmx",
2308+ "rng",
2309+ "shproj",
2310+ "tld",
2311+ "tmx",
2312+ "vbproj.user",
2313+ "vcxproj",
2314+ "vcxproj.filters",
2315+ "wsdl",
2316+ "wxi",
2317+ "wxs",
2318+ "xbl",
2319+ "xlf",
2320+ "xliff",
2321+ "xpdl",
2322+ "xul",
2323+ "xoml",
2324+ "musicxml",
2325+ "glif"
2326+]
21902327indent = { tab-width = 2, unit = " " }
2191−roots = []
21922328
21932329[language.auto-pairs]
21942330'(' = ')'
@@ -2209,7 +2345,6 @@ scope = "source.dtd"
22092345injection-regex = "dtd"
22102346file-types = ["dtd", "ent"]
22112347indent = {tab-width = 2, unit = " "}
2212−roots = []
22132348
22142349[language.auto-pairs]
22152350'(' = ')'
@@ -2227,7 +2362,6 @@ name = "wit"
22272362scope = "source.wit"
22282363injection-regex = "wit"
22292364file-types = ["wit"]
2230−roots = []
22312365comment-token = "//"
22322366indent = { tab-width = 2, unit = " " }
22332367
@@ -2246,11 +2380,10 @@ source = { git = "https://github.com/hh9527/tree-sitter-wit", rev = "c917790ab9a
22462380[[language]]
22472381name = "env"
22482382scope = "source.env"
2249−file-types = [".env", ".env.local", ".env.development", ".env.production", ".env.dist", ".envrc"]
2383+file-types = [".env", ".env.local", ".env.development", ".env.production", ".env.dist", ".envrc", ".envrc.local", ".envrc.private"]
22502384injection-regex = "env"
22512385comment-token = "#"
22522386indent = { tab-width = 4, unit = "\t" }
2253−roots = []
22542387grammar = "bash"
22552388
22562389[[language]]
@@ -2274,12 +2407,15 @@ file-types = [
22742407 "container",
22752408 "volume",
22762409 "kube",
2277− "network"
2410+ "network",
2411+ ".editorconfig",
2412+ "properties",
2413+ "cfg",
2414+ "directory"
22782415]
22792416injection-regex = "ini"
22802417comment-token = "#"
22812418indent = { tab-width = 4, unit = "\t" }
2282−roots = []
22832419
22842420[[grammar]]
22852421name = "ini"
@@ -2289,7 +2425,6 @@ source = { git = "https://github.com/justinmk/tree-sitter-ini", rev = "4d247fb87
22892425name = "bicep"
22902426scope = "source.bicep"
22912427file-types = ["bicep"]
2292−roots = []
22932428auto-format = true
22942429comment-token = "//"
22952430indent = { tab-width = 2, unit = " "}
@@ -2303,7 +2438,6 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-bicep", rev = "d8
23032438name = "qml"
23042439scope = "source.qml"
23052440file-types = ["qml"]
2306−roots = []
23072441language-servers = [ "qmlls" ]
23082442indent = { tab-width = 4, unit = " " }
23092443grammar = "qmljs"
@@ -2317,7 +2451,6 @@ name = "mermaid"
23172451scope = "source.mermaid"
23182452injection-regex = "mermaid"
23192453file-types = ["mermaid"]
2320−roots = []
23212454comment-token = "%%"
23222455indent = { tab-width = 4, unit = " " }
23232456
@@ -2331,12 +2464,11 @@ scope = "source.m"
23312464file-types = ["m"]
23322465comment-token = "%"
23332466shebangs = ["octave-cli", "matlab"]
2334−roots = []
23352467indent = { tab-width = 2, unit = " " }
23362468
23372469[[grammar]]
23382470name = "matlab"
2339−source = { git = "https://github.com/acristoffers/tree-sitter-matlab", rev = "676117eafa64afedc8380a921a77cd9f2244bc6b" }
2471+source = { git = "https://github.com/acristoffers/tree-sitter-matlab", rev = "6071891a8c39600203eba20513666cf93b4d650a" }
23402472
23412473[[language]]
23422474name = "ponylang"
@@ -2356,7 +2488,6 @@ name = "dhall"
23562488scope = "source.dhall"
23572489injection-regex = "dhall"
23582490file-types = ["dhall"]
2359−roots = []
23602491comment-token = "--"
23612492indent = { tab-width = 2, unit = " " }
23622493language-servers = [ "dhall-lsp-server" ]
@@ -2371,7 +2502,6 @@ name = "sage"
23712502scope = "source.sage"
23722503file-types = ["sage"]
23732504injection-regex = "sage"
2374−roots = []
23752505comment-token = "#"
23762506indent = { tab-width = 4, unit = " " }
23772507grammar = "python"
@@ -2382,7 +2512,6 @@ scope = "source.msbuild"
23822512injection-regex = "msbuild"
23832513file-types = ["proj", "vbproj", "csproj", "fsproj", "targets", "props"]
23842514indent = { tab-width = 2, unit = " " }
2385−roots = []
23862515grammar = "xml"
23872516
23882517[language.auto-pairs]
@@ -2398,7 +2527,6 @@ name = "pem"
23982527scope = "source.pem"
23992528file-types = ["pem", "cert", "crt"]
24002529injection-regex = "pem"
2401−roots = []
24022530grammar = "pem"
24032531
24042532[[grammar]]
@@ -2409,7 +2537,6 @@ source = { git = "https://github.com/mtoohey31/tree-sitter-pem", rev = "be67a433
24092537name = "passwd"
24102538scope = "source.passwd"
24112539file-types = ["passwd"]
2412−roots = []
24132540
24142541[[grammar]]
24152542name = "passwd"
@@ -2419,7 +2546,6 @@ source = { git = "https://github.com/ath3/tree-sitter-passwd", rev = "20239395ea
24192546name = "hosts"
24202547scope = "source.hosts"
24212548file-types = ["hosts"]
2422−roots = []
24232549comment-token = "#"
24242550
24252551[[grammar]]
@@ -2431,20 +2557,18 @@ name = "uxntal"
24312557scope = "source.tal"
24322558injection-regex = "tal"
24332559file-types = ["tal"]
2434−roots = []
24352560auto-format = false
24362561comment-token = "("
24372562
24382563[[grammar]]
24392564name = "uxntal"
2440−source = { git = "https://github.com/Jummit/tree-sitter-uxntal", rev = "9297e95ef74380b0ad84c4fd98f91e9f6e4319e6" }
2565+source = { git = "https://github.com/Jummit/tree-sitter-uxntal", rev = "d68406066648cd6db4c6a2f11ec305af02079884" }
24412566
24422567[[language]]
24432568name = "yuck"
24442569scope = "source.yuck"
24452570injection-regex = "yuck"
24462571file-types = ["yuck"]
2447−roots = []
24482572comment-token = ";"
24492573indent = { tab-width = 2, unit = " " }
24502574
@@ -2457,7 +2581,6 @@ name = "prql"
24572581scope = "source.prql"
24582582injection-regex = "prql"
24592583file-types = ["prql"]
2460−roots = []
24612584comment-token = "#"
24622585indent = { tab-width = 4, unit = " " }
24632586
@@ -2469,7 +2592,6 @@ source = { git = "https://github.com/PRQL/tree-sitter-prql", rev = "09e158cd3650
24692592name = "po"
24702593scope = "source.po"
24712594file-types = ["po", "pot"]
2472−roots = []
24732595comment-token = "#"
24742596
24752597[[grammar]]
@@ -2479,9 +2601,8 @@ source = { git = "https://github.com/erasin/tree-sitter-po", rev = "417cee9abb20
24792601[[language]]
24802602name = "nasm"
24812603scope = "source.nasm"
2482−file-types = ["asm", "s", "S", "nasm"]
2604+file-types = ["asm", "S", "nasm"]
24832605injection-regex = "n?asm"
2484−roots = []
24852606comment-token = ";"
24862607indent = { tab-width = 8, unit = " " }
24872608
@@ -2489,12 +2610,23 @@ indent = { tab-width = 8, unit = " " }
24892610name = "nasm"
24902611source = { git = "https://github.com/naclsn/tree-sitter-nasm", rev = "a0db15db6fcfb1bf2cc8702500e55e558825c48b" }
24912612
2613+[[language]]
2614+name = "gas"
2615+scope = "source.gas"
2616+file-types = ["s"]
2617+injection-regex = "gas"
2618+comment-token = "#"
2619+indent = { tab-width = 8, unit = " " }
2620+
2621+[[grammar]]
2622+name = "gas"
2623+source = { git = "https://github.com/sirius94/tree-sitter-gas", rev = "60f443646b20edee3b7bf18f3a4fb91dc214259a" }
2624+
24922625[[language]]
24932626name = "rst"
24942627scope = "source.rst"
24952628comment-token = ".."
24962629file-types = ["rst"]
2497−roots = []
24982630
24992631[[grammar]]
25002632name = "rst"
@@ -2505,7 +2637,6 @@ name = "capnp"
25052637scope = "source.capnp"
25062638injection-regex = "capnp"
25072639file-types = ["capnp"]
2508−roots = []
25092640comment-token = "#"
25102641indent = { tab-width = 2, unit = " " }
25112642
@@ -2531,7 +2662,6 @@ source = { git = "https://github.com/indoorvivants/tree-sitter-smithy", rev = "c
25312662name = "vhdl"
25322663scope = "source.vhdl"
25332664file-types = ["vhd", "vhdl"]
2534−roots = []
25352665comment-token = "--"
25362666language-servers = [ "vhdl_ls" ]
25372667indent = { tab-width = 2, unit = " " }
@@ -2543,7 +2673,6 @@ source = { git = "https://github.com/teburd/tree-sitter-vhdl", rev = "c57313adee
25432673
25442674[[language]]
25452675name = "rego"
2546−roots = []
25472676scope = "source.rego"
25482677injection-regex = "rego"
25492678file-types = ["rego"]
@@ -2554,7 +2683,7 @@ grammar = "rego"
25542683
25552684[[grammar]]
25562685name = "rego"
2557−source = { git = "https://github.com/FallenAngel97/tree-sitter-rego", rev = "b2667c975f07b33be3ceb83bea5cfbad88095866" }
2686+source = { git = "https://github.com/FallenAngel97/tree-sitter-rego", rev = "9ac75e71b2d791e0aadeef68098319d86a2a14cf" }
25582687
25592688[[language]]
25602689name = "nim"
@@ -2562,7 +2691,6 @@ scope = "source.nim"
25622691injection-regex = "nim"
25632692file-types = ["nim", "nims", "nimble"]
25642693shebangs = []
2565−roots = []
25662694comment-token = "#"
25672695indent = { tab-width = 2, unit = " " }
25682696language-servers = [ "nimlangserver" ]
@@ -2586,13 +2714,13 @@ file-types = [ "cabal" ]
25862714roots = ["cabal.project", "Setup.hs"]
25872715indent = { tab-width = 2, unit = " " }
25882716comment-token = "--"
2717+language-servers = [ "haskell-language-server" ]
25892718
25902719[[language]]
25912720name = "hurl"
25922721scope = "source.hurl"
25932722injection-regex = "hurl"
25942723file-types = ["hurl"]
2595−roots = []
25962724comment-token = "#"
25972725indent = { tab-width = 2, unit = " " }
25982726
@@ -2603,7 +2731,6 @@ source = { git = "https://github.com/pfeiferj/tree-sitter-hurl", rev = "264c4206
26032731[[language]]
26042732name = "markdoc"
26052733scope = "text.markdoc"
2606−roots = []
26072734file-types = ["mdoc"]
26082735language-servers = [ "markdoc-ls" ]
26092736
@@ -2616,7 +2743,6 @@ name = "opencl"
26162743scope = "source.cl"
26172744injection-regex = "(cl|opencl)"
26182745file-types = ["cl"]
2619−roots = []
26202746comment-token = "//"
26212747language-servers = [ "clangd" ]
26222748
@@ -2629,7 +2755,6 @@ name = "just"
26292755scope = "source.just"
26302756file-types = ["justfile", "Justfile", ".justfile", ".Justfile"]
26312757injection-regex = "just"
2632−roots = []
26332758comment-token = "#"
26342759indent = { tab-width = 4, unit = "\t" }
26352760
@@ -2637,40 +2762,52 @@ indent = { tab-width = 4, unit = "\t" }
26372762name = "just"
26382763source = { git = "https://github.com/IndianBoy42/tree-sitter-just", rev = "8af0aab79854aaf25b620a52c39485849922f766" }
26392764
2765+[[language]]
2766+name = "gn"
2767+scope = "source.gn"
2768+injection-regex = "gn"
2769+file-types = ["gn", "gni"]
2770+roots = []
2771+comment-token = "#"
2772+indent = { tab-width = 2, unit = " " }
2773+formatter = { command = "gn", args = ["format", "--stdin"] }
2774+
2775+[[grammar]]
2776+name = "gn"
2777+source = { git = "https://github.com/willcassella/tree-sitter-gn", rev = "e18d6e36a79b20dafb58f19d407bd38b0e60260e" }
2778+
26402779[[language]]
26412780name = "blueprint"
26422781scope = "source.blueprint"
26432782injection-regex = "blueprint"
26442783file-types = ["blp"]
2645−roots = []
26462784comment-token = "//"
26472785language-servers = [ "blueprint-compiler" ]
26482786indent = { tab-width = 4, unit = " " }
26492787
26502788[[grammar]]
26512789name = "blueprint"
2652−source = { git = "https://gitlab.com/gabmus/tree-sitter-blueprint", rev = "7f1a5df44861291d6951b6b2146a9fef4c226e14" }
2790+source = { git = "https://gitlab.com/gabmus/tree-sitter-blueprint", rev = "863cea9f83ad5637300478e0559262f1e791684b" }
26532791
26542792[[language]]
26552793name = "forth"
26562794scope = "source.forth"
26572795injection-regex = "forth"
26582796file-types = ["fs", "forth", "fth", "4th"]
2659−roots = []
26602797comment-token = "\\"
26612798language-servers = [ "forth-lsp" ]
26622799indent = { tab-width = 3, unit = " " }
26632800
26642801[[grammar]]
26652802name = "forth"
2666−source = { git = "https://github.com/alexanderbrevig/tree-sitter-forth", rev = "304ed77beb113e37af38b20ff14e3c37bf350d10" }
2803+source = { git = "https://github.com/alexanderbrevig/tree-sitter-forth", rev = "90189238385cf636b9ee99ce548b9e5b5e569d48" }
26672804
26682805[[language]]
26692806name = "fsharp"
26702807scope = "source.fs"
26712808roots = ["sln", "fsproj"]
26722809injection-regex = "fsharp"
2673−file-types = ["fs", "fsx"]
2810+file-types = ["fs", "fsx", "fsi", "fsscript"]
26742811comment-token = "//"
26752812indent = { tab-width = 4, unit = " " }
26762813auto-format = true
@@ -2678,14 +2815,13 @@ language-servers = ["fsharp-ls"]
26782815
26792816[[grammar]]
26802817name = "fsharp"
2681−source = { git = "https://github.com/kaashyapan/tree-sitter-fsharp", rev = "1b5a315e003024db6181744f1d25b8f525732665" }
2818+source = { git = "https://github.com/kaashyapan/tree-sitter-fsharp", rev = "18da392fd9bd5e79f357abcce13f61f3a15e3951" }
26822819
26832820[[language]]
26842821name = "t32"
26852822scope = "source.t32"
26862823injection-regex = "t32"
26872824file-types = ["cmm", "t32"]
2688−roots = []
26892825comment-token = ";"
26902826indent = { tab-width = 2, unit = " " }
26912827
@@ -2698,10 +2834,49 @@ name = "webc"
26982834scope = "text.html.webc"
26992835injection-regex = "webc"
27002836file-types = ["webc"]
2701−roots = []
27022837indent = { tab-width = 2, unit = " " }
27032838grammar = "html"
27042839
2840+[[language]]
2841+name = "typst"
2842+scope = "source.typst"
2843+injection-regex = "typst"
2844+file-types = ["typst", "typ"]
2845+comment-token = "//"
2846+language-servers = ["typst-lsp"]
2847+indent = { tab-width = 2, unit = " " }
2848+
2849+[language.auto-pairs]
2850+'(' = ')'
2851+'{' = '}'
2852+'[' = ']'
2853+'$' = '$'
2854+'"' = '"'
2855+
2856+[[grammar]]
2857+name = "typst"
2858+source = { git = "https://github.com/uben0/tree-sitter-typst", rev = "e35aa22395fdde82bbc4b5700c324ce346dfc9e5" }
2859+
2860+[[language]]
2861+name = "nunjucks"
2862+scope = "text.html.nunjucks"
2863+injection-regex = "nunjucks"
2864+file-types = ["njk"]
2865+indent = { tab-width = 2, unit = " " }
2866+grammar = "jinja2"
2867+
2868+[[language]]
2869+name = "jinja"
2870+scope = "text.html.jinja"
2871+injection-regex = "jinja"
2872+file-types = ["jinja", "jinja2", "j2"]
2873+indent = { tab-width = 2, unit = " " }
2874+grammar = "jinja2"
2875+
2876+[[grammar]]
2877+name = "jinja2"
2878+source = { git = "https://github.com/varpeti/tree-sitter-jinja2", rev = "a533cd3c33aea6acb0f9bf9a56f35dcfe6a8eb53" }
2879+
27052880[[grammar]]
27062881name = "wren"
27072882source = { git = "https://git.sr.ht/~jummit/tree-sitter-wren", rev = "793d58266924e6efcc40e411663393e9d72bec87"}
@@ -2711,7 +2886,6 @@ name = "wren"
27112886scope = "source.wren"
27122887injection-regex = "wren"
27132888file-types = ["wren"]
2714−roots = []
27152889indent = { tab-width = 2, unit = " "}
27162890
27172891[[language]]
@@ -2720,7 +2894,6 @@ scope = "source.unison"
27202894injection-regex = "unison"
27212895file-types = ["u"]
27222896shebangs = []
2723−roots = []
27242897auto-format = false
27252898comment-token = "--"
27262899indent = { tab-width = 4, unit = " " }
@@ -2736,3 +2909,100 @@ indent = { tab-width = 4, unit = " " }
27362909name = "unison"
27372910source = { git = "https://github.com/kylegoetz/tree-sitter-unison", rev = "98c4e8bc5c9f5989814a720457cf36963cf4043d" }
27382911
2912+[[language]]
2913+name = "todotxt"
2914+scope = "text.todotxt"
2915+file-types = [{ suffix = ".todo.txt" }, "todotxt"]
2916+formatter = { command = "sort" }
2917+auto-format = true
2918+
2919+[[grammar]]
2920+name = "todotxt"
2921+source = { git = "https://github.com/arnarg/tree-sitter-todotxt", rev = "0207f6a4ab6aeafc4b091914d31d8235049a2578" }
2922+
2923+[[language]]
2924+name = "strace"
2925+scope = "source.strace"
2926+file-types = ["strace"]
2927+
2928+[[grammar]]
2929+name = "strace"
2930+source = { git = "https://github.com/sigmaSd/tree-sitter-strace", rev = "2b18fdf9a01e7ec292cc6006724942c81beb7fd5" }
2931+
2932+[[language]]
2933+name = "gemini"
2934+scope = "source.gmi"
2935+file-types = ["gmi"]
2936+
2937+[[grammar]]
2938+name = "gemini"
2939+source = { git = "https://git.sr.ht/~nbsp/tree-sitter-gemini", rev = "3cc5e4bdf572d5df4277fc2e54d6299bd59a54b3" }
2940+
2941+[[language]]
2942+name = "agda"
2943+scope = "source.agda"
2944+injection-regex = "agda"
2945+file-types = ["agda"]
2946+roots = []
2947+comment-token = "--"
2948+# language-servers = [ "als" ]
2949+# the agda language server is of questionable functionality.
2950+auto-format = false
2951+indent = { tab-width = 2, unit = " " }
2952+
2953+[language.auto-pairs]
2954+'"' = '"'
2955+"'" = "'"
2956+'{' = '}'
2957+'(' = ')'
2958+'[' = ']'
2959+
2960+# [language.debugger]
2961+# ?? can this be used for proof assistant support? explore
2962+
2963+[[grammar]]
2964+name = "agda"
2965+source = { git = "https://github.com/tree-sitter/tree-sitter-agda", rev = "c21c3a0f996363ed17b8ac99d827fe5a4821f217" }
2966+
2967+[[language]]
2968+name = "templ"
2969+scope = "source.templ"
2970+file-types = ["templ"]
2971+roots = ["go.work", "go.mod"]
2972+comment-token = "//"
2973+indent = { tab-width = 2, unit = " " }
2974+language-servers = [ "templ" ]
2975+
2976+[[grammar]]
2977+name = "templ"
2978+source = { git = "https://github.com/vrischmann/tree-sitter-templ", rev = "ea56ac0655243490a4929a988f4eaa91dfccc995" }
2979+
2980+[[language]]
2981+name = "dbml"
2982+scope = "source.dbml"
2983+injection-regex = "dbml"
2984+file-types = ["dbml"]
2985+comment-token = ";"
2986+indent = { tab-width = 2, unit = " " }
2987+
2988+[[grammar]]
2989+name = "dbml"
2990+source = { git = "https://github.com/dynamotn/tree-sitter-dbml", rev = "2e2fa5640268c33c3d3f27f7e676f631a9c68fd9" }
2991+
2992+[[language]]
2993+name = "log"
2994+scope = "source.log"
2995+file-types = ["log"]
2996+
2997+[[grammar]]
2998+name = "log"
2999+source = { git = "https://github.com/Tudyx/tree-sitter-log", rev = "62cfe307e942af3417171243b599cc7deac5eab9" }
3000+
3001+[[language]]
3002+name = "janet"
3003+scope = "source.janet"
3004+injection-regex = "janet"
3005+file-types = ["janet"]
3006+comment-token = "#"
3007+indent = { tab-width = 2, unit = " " }
3008+grammar = "clojure"
logo.svg+1−1
@@ -1 +1 @@
1−<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;" viewBox="663.38 37.57 575.35 903.75"> <g transform="matrix(1,0,0,1,-31352.7,-1817.25)"> <g transform="matrix(1,0,0,1,31062.7,-20.8972)"> <g transform="matrix(1,0,0,1,-130.173,0.00185558)"> <path d="M1083.58,1875.72L1635.06,2194.12C1649.8,2202.63 1658.88,2218.37 1658.88,2235.39C1658.88,2264.98 1658.88,2311.74 1658.88,2341.33C1658.88,2349.84 1656.61,2358.03 1652.5,2365.16C1652.5,2365.16 1214.7,2112.4 1107.2,2050.33C1092.58,2041.89 1083.58,2026.29 1083.58,2009.41C1083.58,1963.5 1083.58,1875.72 1083.58,1875.72Z" style="fill:#706bc8;"></path> </g> <g transform="matrix(1,0,0,1,-130.173,0.00185558)"> <path d="M1635.26,2604.84C1649.88,2613.28 1658.88,2628.87 1658.88,2645.75C1658.88,2691.67 1658.88,2779.44 1658.88,2779.44L1107.41,2461.05C1092.66,2452.53 1083.58,2436.8 1083.58,2419.78C1083.58,2390.19 1083.58,2343.42 1083.58,2313.84C1083.58,2305.32 1085.85,2297.13 1089.96,2290.01C1089.96,2290.01 1527.76,2542.77 1635.26,2604.84Z" style="fill:#55c5e4;"></path> </g> <g transform="matrix(1,0,0,1,216.062,984.098)"> <path d="M790.407,1432.56C785.214,1435.55 780.717,1439.9 777.509,1445.46C767.862,1462.16 773.473,1483.76 790.004,1493.59L789.998,1493.59L761.173,1476.95C746.427,1468.44 737.344,1452.71 737.344,1435.68C737.344,1406.09 737.344,1359.33 737.344,1329.74C737.344,1312.71 746.427,1296.98 761.173,1288.47L1259.59,1000.74L1259.83,1000.6C1264.92,997.617 1269.33,993.314 1272.48,987.844C1282.13,971.136 1276.52,949.544 1259.99,939.707L1260,939.707L1288.82,956.349C1303.57,964.862 1312.65,980.595 1312.65,997.622C1312.65,1027.21 1312.65,1073.97 1312.65,1103.56C1312.65,1120.59 1303.57,1136.32 1288.82,1144.83L1259.19,1161.94L1259.59,1161.68L790.407,1432.56Z" style="fill:#84ddea;"></path> </g> <g transform="matrix(1,0,0,1,216.062,984.098)"> <path d="M790.407,1686.24C785.214,1689.23 780.717,1693.58 777.509,1699.13C767.862,1715.84 773.473,1737.43 790.004,1747.27L789.998,1747.27L761.173,1730.63C746.427,1722.12 737.344,1706.38 737.344,1689.36C737.344,1659.77 737.344,1613.01 737.344,1583.42C737.344,1566.39 746.427,1550.66 761.173,1542.15L1259.59,1254.42L1259.83,1254.28C1264.92,1251.29 1269.33,1246.99 1272.48,1241.52C1282.13,1224.81 1276.52,1203.22 1259.99,1193.38L1260,1193.38L1288.82,1210.03C1303.57,1218.54 1312.65,1234.27 1312.65,1251.3C1312.65,1280.89 1312.65,1327.65 1312.65,1357.24C1312.65,1374.26 1303.57,1390 1288.82,1398.51L1259.19,1415.61L1259.59,1415.36L790.407,1686.24Z" style="fill:#997bc8;"></path></g></g></g> </svg>
1+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;" viewBox="663.38 37.57 575.35 903.75"><g transform="matrix(1,0,0,1,-31352.7,-1817.25)"><g transform="matrix(1,0,0,1,31062.7,-20.8972)"><g transform="matrix(1,0,0,1,-130.173,0.00185558)"><path style="fill:#706bc8;" d="M1083.58,1875.72L1635.06,2194.12C1649.8,2202.63 1658.88,2218.37 1658.88,2235.39C1658.88,2264.98 1658.88,2311.74 1658.88,2341.33C1658.88,2349.84 1656.61,2358.03 1652.5,2365.16C1652.5,2365.16 1214.7,2112.4 1107.2,2050.33C1092.58,2041.89 1083.58,2026.29 1083.58,2009.41C1083.58,1963.5 1083.58,1875.72 1083.58,1875.72Z"></path></g><g transform="matrix(1,0,0,1,-130.173,0.00185558)"><path style="fill:#55c5e4;" d="M1635.26,2604.84C1649.88,2613.28 1658.88,2628.87 1658.88,2645.75C1658.88,2691.67 1658.88,2779.44 1658.88,2779.44L1107.41,2461.05C1092.66,2452.53 1083.58,2436.8 1083.58,2419.78C1083.58,2390.19 1083.58,2343.42 1083.58,2313.84C1083.58,2305.32 1085.85,2297.13 1089.96,2290.01C1089.96,2290.01 1527.76,2542.77 1635.26,2604.84Z"></path></g><g transform="matrix(1,0,0,1,216.062,984.098)"><path style="fill:#84ddea;" d="M790.407,1432.56C785.214,1435.55 780.717,1439.9 777.509,1445.46C767.862,1462.16 773.473,1483.76 790.004,1493.59L789.998,1493.59L761.173,1476.95C746.427,1468.44 737.344,1452.71 737.344,1435.68C737.344,1406.09 737.344,1359.33 737.344,1329.74C737.344,1312.71 746.427,1296.98 761.173,1288.47L1259.59,1000.74L1259.83,1000.6C1264.92,997.617 1269.33,993.314 1272.48,987.844C1282.13,971.136 1276.52,949.544 1259.99,939.707L1260,939.707L1288.82,956.349C1303.57,964.862 1312.65,980.595 1312.65,997.622C1312.65,1027.21 1312.65,1073.97 1312.65,1103.56C1312.65,1120.59 1303.57,1136.32 1288.82,1144.83L1259.19,1161.94L1259.59,1161.68L790.407,1432.56Z"></path></g><g transform="matrix(1,0,0,1,216.062,984.098)"><path style="fill:#997bc8;" d="M790.407,1686.24C785.214,1689.23 780.717,1693.58 777.509,1699.13C767.862,1715.84 773.473,1737.43 790.004,1747.27L789.998,1747.27L761.173,1730.63C746.427,1722.12 737.344,1706.38 737.344,1689.36C737.344,1659.77 737.344,1613.01 737.344,1583.42C737.344,1566.39 746.427,1550.66 761.173,1542.15L1259.59,1254.42L1259.83,1254.28C1264.92,1251.29 1269.33,1246.99 1272.48,1241.52C1282.13,1224.81 1276.52,1203.22 1259.99,1193.38L1260,1193.38L1288.82,1210.03C1303.57,1218.54 1312.65,1234.27 1312.65,1251.3C1312.65,1280.89 1312.65,1327.65 1312.65,1357.24C1312.65,1374.26 1303.57,1390 1288.82,1398.51L1259.19,1415.61L1259.59,1415.36L790.407,1686.24Z"></path></g></g></g></svg>
runtime/queries/_typescript/highlights.scm+5−3
@@ -39,11 +39,11 @@
3939 (identifier) @variable.parameter))
4040
4141; (p?: t)
42−; (p?: t = 1) // Invalid but still posible to hihglight.
42+; (p?: t = 1) // Invalid but still possible to highlight.
4343(optional_parameter
4444 (identifier) @variable.parameter)
4545
46−; (...p?: t) // Invalid but still posible to hihglight.
46+; (...p?: t) // Invalid but still possible to highlight.
4747(optional_parameter
4848 (rest_pattern
4949 (identifier) @variable.parameter))
@@ -59,7 +59,7 @@
5959 (pair_pattern
6060 value: (identifier) @variable.parameter)))
6161
62−; ([ p ]?: t[]) // Invalid but still posible to hihglight.
62+; ([ p ]?: t[]) // Invalid but still possible to highlight.
6363(optional_parameter
6464 (array_pattern
6565 (identifier) @variable.parameter))
@@ -107,6 +107,8 @@
107107; Types
108108; -----
109109
110+(type_parameter
111+ name: (type_identifier) @type.parameter)
110112(type_identifier) @type
111113(predefined_type) @type.builtin
112114
runtime/queries/_typescript/locals.scm+17
@@ -1,6 +1,18 @@
1+; Scopes
2+;-------
3+
4+[
5+ (type_alias_declaration)
6+ (class_declaration)
7+ (interface_declaration)
8+] @local.scope
9+
110; Definitions
211;------------
312
13+(type_parameter
14+ name: (type_identifier) @local.definition)
15+
416; Javascript and Typescript Treesitter grammars deviate when defining the
517; tree structure for parameters, so we need to address them in each specific
618; language instead of ecma.
@@ -14,3 +26,8 @@
1426; (i?: t = 1) // Invalid but still posible to hihglight.
1527(optional_parameter
1628 (identifier) @local.definition)
29+
30+; References
31+;-----------
32+
33+(type_identifier) @local.reference
runtime/queries/agda/highlights.scmnew file+124
@@ -0,0 +1,124 @@
1+;; Punctuation
2+[ "." ";" ":"] @punctuation.delimiter
3+[ "(" ")" "{" "}" ] @punctuation.bracket
4+
5+;; Constants
6+(integer) @constant.numeric.integer
7+; (float) @constant.numeric.float
8+(literal) @string
9+
10+;; Pragmas and comments
11+(comment) @comment
12+(pragma) @attribute
13+(macro) @function.macro
14+
15+;; Imports
16+(module_name) @namespace
17+(import_directive (id) @namespace)
18+[(module) (import) (open)] @keyword.control.import
19+
20+;; Types
21+(typed_binding (expr) @type)
22+(record (expr) @type)
23+(data (expr) @type)
24+(signature (expr) @type)
25+(function (rhs (expr) @type))
26+; todo: these are too general. ideally, any nested (atom)
27+; https://github.com/tree-sitter/tree-sitter/issues/880
28+
29+;; Variables
30+(untyped_binding (atom) @variable)
31+(typed_binding (atom) @variable)
32+(field_name) @variable.other.member
33+
34+;; Functions
35+(function_name) @function
36+;(function (lhs
37+; . (atom) @function
38+; (atom) @variable.parameter))
39+; todo: currently fails to parse, upstream tree-sitter bug
40+
41+;; Data
42+[(data_name) (record_name)] @constructor
43+((atom) @constant.builtin.boolean
44+ (#any-of? @constant.builtin.boolean "true" "false" "True" "False"))
45+
46+"Set" @type.builtin
47+
48+; postulate
49+; type_signature
50+; pattern
51+; id
52+; bid
53+; typed_binding
54+; primitive
55+; private
56+; record_signature
57+; record_assignments
58+; field_assignment
59+; module_assignment
60+; renaming
61+; import_directive
62+; lambda
63+; let
64+; instance
65+; generalize
66+; record
67+; fields
68+; syntax
69+; hole_name
70+; data_signature
71+
72+;; Keywords
73+[
74+ "where"
75+ "data"
76+ "rewrite"
77+ "postulate"
78+ "public"
79+ "private"
80+ "tactic"
81+ "Prop"
82+ "quote"
83+ "renaming"
84+ "in"
85+ "hiding"
86+ "constructor"
87+ "abstract"
88+ "let"
89+ "field"
90+ "mutual"
91+ "infix"
92+ "infixl"
93+ "infixr"
94+ "record"
95+ "overlap"
96+ "instance"
97+ "do"
98+] @keyword
99+
100+[
101+ "="
102+] @operator
103+
104+; = | -> : ? \ .. ... λ ∀ →
105+; (_LAMBDA) (_FORALL) (_ARROW)
106+; "coinductive"
107+; "eta-equality"
108+; "field"
109+; "inductive"
110+; "interleaved"
111+; "macro"
112+; "no-eta-equality"
113+; "pattern"
114+; "primitive"
115+; "quoteTerm"
116+; "rewrite"
117+; "syntax"
118+; "unquote"
119+; "unquoteDecl"
120+; "unquoteDef"
121+; "using"
122+; "variable"
123+; "with"
124+
runtime/queries/bash/indents.scm+1
@@ -2,6 +2,7 @@
22 (function_definition)
33 (if_statement)
44 (for_statement)
5+ (while_statement)
56 (case_statement)
67 (pipeline)
78] @indent
runtime/queries/blueprint/highlights.scm+5
@@ -15,6 +15,11 @@
1515(decorator) @attribute
1616
1717(property_definition (property_name) @variable.other.member)
18+(property_definition
19+ (property_binding
20+ "bind" @keyword
21+ (property_name) @variable.other.member
22+ ["no-sync-create" "bidirectional" "inverted"]* @keyword))
1823
1924(object) @type
2025
runtime/queries/c/indents.scm+18−1
@@ -5,7 +5,6 @@
55 (enumerator_list)
66 (parameter_list)
77 (init_declarator)
8− (case_statement)
98 (expression_statement)
109] @indent
1110
@@ -13,6 +12,7 @@
1312 "case"
1413 "}"
1514 "]"
15+ ")"
1616] @outdent
1717
1818(if_statement
@@ -32,3 +32,20 @@
3232 (_) @indent
3333 (#not-kind-eq? @indent "compound_statement")
3434 (#set! "scope" "all"))
35+
36+(parameter_list
37+ . (parameter_declaration) @anchor
38+ (#set! "scope" "tail")) @align
39+(argument_list
40+ . (_) @anchor
41+ (#set! "scope" "tail")) @align
42+; These are a bit opinionated since some people just indent binary/ternary expressions spanning multiple lines.
43+; Since they are only triggered when a newline is inserted into an already complete binary/ternary expression,
44+; this should happen rarely, so it is not a big deal either way.
45+; Additionally, adding these queries has the advantage of preventing such continuation lines from being used
46+; as the baseline when the `hybrid` indent heuristic is used (which is desirable since their indentation is so inconsistent).
47+(binary_expression
48+ (#set! "scope" "tail")) @anchor @align
49+(conditional_expression
50+ "?" @anchor
51+ (#set! "scope" "tail")) @align
runtime/queries/comment/highlights.scm+8−8
@@ -7,31 +7,31 @@
77
88; Hint level tags
99((tag (name) @hint)
10− (#match? @hint "^(HINT|MARK)$"))
10+ (#match? @hint "^(HINT|MARK|PASSED|STUB|MOCK)$"))
1111
1212("text" @hint
13− (#match? @hint "^(HINT|MARK)$"))
13+ (#match? @hint "^(HINT|MARK|PASSED|STUB|MOCK)$"))
1414
1515; Info level tags
1616((tag (name) @info)
17− (#match? @info "^(INFO|NOTE|TODO)$"))
17+ (#match? @info "^(INFO|NOTE|TODO|PERF|OPTIMIZE|PERFORMANCE|QUESTION|ASK)$"))
1818
1919("text" @info
20− (#match? @info "^(INFO|NOTE|TODO)$"))
20+ (#match? @info "^(INFO|NOTE|TODO|PERF|OPTIMIZE|PERFORMANCE|QUESTION|ASK)$"))
2121
2222; Warning level tags
2323((tag (name) @warning)
24− (#match? @warning "^(HACK|WARN|WARNING)$"))
24+ (#match? @warning "^(HACK|WARN|WARNING|TEST|TEMP)$"))
2525
2626("text" @warning
27− (#match? @warning "^(HACK|WARN|WARNING)$"))
27+ (#match? @warning "^(HACK|WARN|WARNING|TEST|TEMP)$"))
2828
2929; Error level tags
3030((tag (name) @error)
31− (#match? @error "^(BUG|FIXME|ISSUE|XXX)$"))
31+ (#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG)$"))
3232
3333("text" @error
34− (#match? @error "^(BUG|FIXME|ISSUE|XXX)$"))
34+ (#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG)$"))
3535
3636(tag
3737 (name) @ui.text
runtime/queries/common-lisp/indents.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: scheme
runtime/queries/dart/highlights.scm+3−1
@@ -200,6 +200,7 @@
200200 "async"
201201 "async*"
202202 "await"
203+ "base"
203204 "class"
204205 "covariant"
205206 "deferred"
@@ -219,6 +220,7 @@
219220 "operator"
220221 "part"
221222 "required"
223+ "sealed"
222224 "set"
223225 "show"
224226 "static"
@@ -230,7 +232,7 @@
230232
231233; when used as an identifier:
232234((identifier) @variable.builtin
233− (#match? @variable.builtin "^(abstract|as|covariant|deferred|dynamic|export|external|factory|Function|get|implements|import|interface|library|operator|mixin|part|set|static|typedef)$"))
235+ (#match? @variable.builtin "^(abstract|as|base|covariant|deferred|dynamic|export|external|factory|Function|get|implements|import|interface|library|operator|mixin|part|sealed|set|static|typedef)$"))
234236
235237; Error
236238(ERROR) @error
runtime/queries/dbml/highlights.scmnew file+44
@@ -0,0 +1,44 @@
1+
2+; comments highlighting
3+(comment) @comment
4+
5+; keyword highlighting
6+(keyword_def) @keyword
7+(keyword_enum) @keyword
8+(keyword_ref) @keyword
9+
10+; identify blocks and definitions
11+(definition) @function
12+
13+; for identifiers
14+(identifier) @variable
15+(type) @keyword
16+
17+; Highlight special types for database/data types
18+("Project" ) @type
19+("Table" ) @type
20+("TableGroup" ) @type
21+("database_type" ) @variable
22+
23+; string and number constants
24+("'''") @constant.character.escape
25+(string) @string
26+(number) @constant.numeric
27+
28+; brackets
29+[
30+ "("
31+ ")"
32+ "{"
33+ "}"
34+ "["
35+ "]"
36+] @punctuation.bracket
37+
38+; brackets
39+[
40+ ":"
41+ "."
42+ ","
43+] @punctuation.delimiter
44+
runtime/queries/fsharp/locals.scmnew file+25
@@ -0,0 +1,25 @@
1+; Scopes
2+;-------
3+
4+[
5+ (ce_expression)
6+ (module_defn)
7+ (for_expression)
8+ (do_expression)
9+ (fun_expression)
10+ (function_expression)
11+ (try_expression)
12+ (match_expression)
13+ (elif_expression)
14+ (if_expression)
15+] @local.scope
16+
17+; Definitions
18+;------------
19+
20+(function_or_value_defn) @local.definition
21+
22+; References
23+;-----------
24+
25+(identifier) @local.reference
runtime/queries/gas/highlights.scmnew file+21
@@ -0,0 +1,21 @@
1+(comment) @comment
2+(number) @constant.numeric
3+(directive_name) @keyword.directive
4+(symbol) @variable
5+(label) @function
6+(label)
7+(instruction_prefix) @keyword
8+(instruction_name) @function.special
9+(register) @constant.builtin
10+(string) @string
11+(char) @constant.character
12+(type) @type
13+(constant "$" @constant)
14+(operand_modifier) @attribute
15+
16+(expression
17+ ["-" "+" "*" "/" "="] @operator)
18+
19+["(" ")"] @punctuation.bracket
20+
21+["," ":"] @punctuation.delimiter
runtime/queries/gas/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))
runtime/queries/gas/textobjects.scmnew file+2
@@ -0,0 +1,2 @@
1+(comment) @comment.inside
2+(comment)+ @comment.around
runtime/queries/gemini/highlights.scmnew file+26
@@ -0,0 +1,26 @@
1+(link) @punctuation.bracket
2+(link
3+ label: (text) @markup.link.label)
4+(link
5+ uri: (uri) @markup.link.url)
6+
7+[
8+ (start_pre)
9+ (pre)
10+ (end_pre)
11+] @markup.raw.block
12+(start_pre
13+ alt: (text) @label)
14+
15+(heading1
16+ (text) @markup.heading.1) @markup.heading.marker
17+(heading2
18+ (text) @markup.heading.2) @markup.heading.marker
19+(heading3
20+ (text) @markup.heading.3) @markup.heading.marker
21+
22+(ulist
23+ (indicator) @markup.list.unnumbered)
24+(quote
25+ (indicator) @markup.quote
26+ (text) @markup.italic)
runtime/queries/gleam/highlights.scm+16−5
@@ -21,6 +21,8 @@
2121
2222; Functions
2323(unqualified_import (identifier) @function)
24+(unqualified_import "type" (type_identifier) @type)
25+(unqualified_import (type_identifier) @constructor)
2426(function
2527 name: (identifier) @function)
2628(external_function
@@ -43,6 +45,13 @@
4345(tuple_access
4446 index: (integer) @variable.other.member)
4547
48+; Attributes
49+(attribute
50+ "@" @attribute
51+ name: (identifier) @attribute)
52+
53+(attribute_value (identifier) @constant)
54+
4655; Type names
4756(remote_type_identifier) @type
4857(type_identifier) @type
@@ -60,10 +69,6 @@
6069(identifier) @variable
6170(discard) @comment.unused
6271
63−; Operators
64−(binary_expression
65− operator: _ @operator)
66−
6772; Keywords
6873[
6974 (visibility_modifier) ; "pub"
@@ -72,6 +77,7 @@
7277 "assert"
7378 "case"
7479 "const"
80+ ; DEPRECATED: 'external' was removed in v0.30.
7581 "external"
7682 "fn"
7783 "if"
@@ -79,11 +85,16 @@
7985 "let"
8086 "panic"
8187 "todo"
82− "try"
8388 "type"
8489 "use"
8590] @keyword
8691
92+; Operators
93+(binary_expression
94+ operator: _ @operator)
95+(boolean_negation "!" @operator)
96+(integer_negation "-" @operator)
97+
8798; Punctuation
8899[
89100 "("
runtime/queries/gn/highlights.scmnew file+42
@@ -0,0 +1,42 @@
1+; Copyright (C) 2021 Will Cassella (github@willcassella.com)
2+;
3+; Licensed under the Apache License, Version 2.0 (the "License");
4+; you may not use this file except in compliance with the License.
5+; You may obtain a copy of the License at
6+;
7+; http://www.apache.org/licenses/LICENSE-2.0
8+;
9+; Unless required by applicable law or agreed to in writing, software
10+; distributed under the License is distributed on an "AS IS" BASIS,
11+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+; See the License for the specific language governing permissions and
13+; limitations under the License.
14+
15+(identifier) @variable.builtin
16+
17+(scope_access field: (_) @variable.other.member)
18+
19+(call target: (_) @function)
20+
21+[ "if" "else" ] @keyword.control.conditional
22+
23+[
24+ (assign_op)
25+ (arithmetic_binary_op)
26+ (comparison_binary_op)
27+ (equivalence_binary_op)
28+ (logical_and_binary_op)
29+ (logical_or_binary_op)
30+ (negation_unary_op)
31+] @operator
32+
33+[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
34+[ "." "," ] @punctuation.delimiter
35+
36+(string) @string
37+(string_escape) @constant.character.escape
38+(string_expansion [ "$" "${" "}" ] @constant.character.escape)
39+[ (integer) (hex) ] @constant.numeric
40+(boolean) @constant.builtin.boolean
41+
42+(comment) @comment
runtime/queries/gn/injections.scmnew file+15
@@ -0,0 +1,15 @@
1+; Copyright (C) 2021 Will Cassella (github@willcassella.com)
2+;
3+; Licensed under the Apache License, Version 2.0 (the "License");
4+; you may not use this file except in compliance with the License.
5+; You may obtain a copy of the License at
6+;
7+; http://www.apache.org/licenses/LICENSE-2.0
8+;
9+; Unless required by applicable law or agreed to in writing, software
10+; distributed under the License is distributed on an "AS IS" BASIS,
11+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+; See the License for the specific language governing permissions and
13+; limitations under the License.
14+
15+((comment) @injection.content (#set! injection.language "comment"))
runtime/queries/gn/locals.scmnew file+16
@@ -0,0 +1,16 @@
1+; Copyright (C) 2021 Will Cassella (github@willcassella.com)
2+;
3+; Licensed under the Apache License, Version 2.0 (the "License");
4+; you may not use this file except in compliance with the License.
5+; You may obtain a copy of the License at
6+;
7+; http://www.apache.org/licenses/LICENSE-2.0
8+;
9+; Unless required by applicable law or agreed to in writing, software
10+; distributed under the License is distributed on an "AS IS" BASIS,
11+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+; See the License for the specific language governing permissions and
13+; limitations under the License.
14+
15+(source_file) @local.scope
16+(assignment target: (identifier) @local.definition)
runtime/queries/go/highlights.scm+13−5
@@ -11,6 +11,18 @@
1111 function: (selector_expression
1212 field: (field_identifier) @function.method))
1313
14+
15+; Types
16+
17+(type_parameter_list
18+ (parameter_declaration
19+ name: (identifier) @type.parameter))
20+
21+((type_identifier) @type.builtin
22+ (match? @type.builtin "^(any|bool|byte|comparable|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$"))
23+
24+(type_identifier) @type
25+
1426; Function definitions
1527
1628(function_declaration
@@ -24,20 +36,16 @@
2436
2537; Identifiers
2638
27−((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$"))
2839(const_spec
2940 name: (identifier) @constant)
3041
3142(parameter_declaration (identifier) @variable.parameter)
3243(variadic_parameter_declaration (identifier) @variable.parameter)
3344
34−((type_identifier) @type.builtin
35− (match? @type.builtin "^(any|bool|byte|comparable|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$"))
36−
37−(type_identifier) @type
3845(type_spec
3946 name: (type_identifier) @constructor)
4047(field_identifier) @variable.other.member
48+(keyed_element (literal_element (identifier) @variable.other.member))
4149(identifier) @variable
4250(package_identifier) @namespace
4351
runtime/queries/go/locals.scm+10−2
@@ -1,9 +1,17 @@
11; Scopes
22
3−(block) @local.scope
3+[
4+ (function_declaration)
5+ (type_declaration)
6+ (block)
7+] @local.scope
48
59; Definitions
610
11+(type_parameter_list
12+ (parameter_declaration
13+ name: (identifier) @local.definition))
14+
715(parameter_declaration (identifier) @local.definition)
816(variadic_parameter_declaration (identifier) @local.definition)
917
@@ -27,4 +35,4 @@
2735
2836(identifier) @local.reference
2937(field_identifier) @local.reference
30−
38+(type_identifier) @local.reference
runtime/queries/haskell/highlights.scm+24−11
@@ -33,6 +33,11 @@
3333;; ----------------------------------------------------------------------------
3434;; Keywords, operators, includes
3535
36+[
37+ "forall"
38+ "∀"
39+] @keyword.control.repeat
40+
3641(pragma) @constant.macro
3742
3843[
@@ -68,10 +73,7 @@
6873 "@"
6974] @operator
7075
71−(qualified_module (module) @constructor)
72−(qualified_type (module) @namespace)
73−(qualified_variable (module) @namespace)
74−(import (module) @namespace)
76+(module) @namespace
7577
7678[
7779 (where)
@@ -92,8 +94,6 @@
9294 "do"
9395 "mdo"
9496 "rec"
95− "forall"
96− "∀"
9797 "infix"
9898 "infixl"
9999 "infixr"
@@ -104,22 +104,35 @@
104104;; Functions and variables
105105
106106(signature name: (variable) @type)
107−(function name: (variable) @function)
108−
109−(variable) @variable
110−"_" @variable.builtin
107+(function
108+ name: (variable) @function
109+ patterns: (patterns))
110+((signature (fun)) . (function (variable) @function))
111+((signature (context (fun))) . (function (variable) @function))
112+((signature (forall (context (fun)))) . (function (variable) @function))
111113
112114(exp_infix (variable) @operator) ; consider infix functions as operators
113115
114−("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
116+(exp_infix (exp_name) @function)
117+(exp_apply . (exp_name (variable) @function))
118+(exp_apply . (exp_name (qualified_variable (variable) @function)))
115119
120+(variable) @variable
121+(pat_wildcard) @variable
116122
117123;; ----------------------------------------------------------------------------
118124;; Types
119125
120126(type) @type
127+(type_variable) @type.parameter
121128
122129(constructor) @constructor
123130
124131; True or False
125132((constructor) @_bool (#match? @_bool "(True|False)")) @constant.builtin.boolean
133+
134+;; ----------------------------------------------------------------------------
135+;; Quasi-quotes
136+
137+(quoter) @function
138+; Highlighting of quasiquote_body is handled by injections.scm
runtime/queries/janet/highlights.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: clojure
runtime/queries/jinja/highlights.scmnew file+7
@@ -0,0 +1,7 @@
1+(expression) @string
2+(statement) @variable.builtin
3+(keyword) @keyword
4+(comment) @comment
5+(identifier) @variable.parameter
6+(operator) @operator
7+(string) @string
runtime/queries/jinja/injections.scmnew file+4
@@ -0,0 +1,4 @@
1+((source_file) @injection.content
2+ (#set! injection.combined)
3+ (#set! injection.include-children)
4+ (#set! injection.language "html"))
runtime/queries/json5/highlights.scmnew file+11
@@ -0,0 +1,11 @@
1+(string) @string
2+
3+(identifier) @constant
4+
5+(number) @constant.numeric
6+
7+(null) @constant.builtin
8+
9+[(true) (false)] @constant.builtin.boolean
10+
11+(comment) @comment
runtime/queries/kdl/highlights.scm+4−4
@@ -1,12 +1,12 @@
1−(comment) @comment
21(single_line_comment) @comment
2+(multi_line_comment) @comment
33
44(node
5− name: (identifier) @function)
5+ (identifier) @variable)
6+
67(prop (identifier) @attribute)
7−(type) @type
88
9−(bare_identifier) @variable.other.member
9+(type (_) @type) @punctuation.bracket
1010
1111(keyword) @keyword
1212
runtime/queries/kdl/indents.scmnew file+3
@@ -0,0 +1,3 @@
1+(node_children) @indent
2+
3+ "}" @outdent
runtime/queries/kdl/textobjects.scmnew file+27
@@ -0,0 +1,27 @@
1+(type (_) @test.inside) @test.around
2+
3+(node
4+ children: (node_children)? @class.inside) @class.around
5+
6+(node
7+ children: (node_children)? @function.inside) @function.around
8+
9+(node (identifier) @function.movement)
10+
11+[
12+ (single_line_comment)
13+ (multi_line_comment)
14+] @comment.inside
15+
16+[
17+ (single_line_comment)+
18+ (multi_line_comment)+
19+] @comment.around
20+
21+[
22+ (prop)
23+ (value)
24+] @parameter.inside
25+
26+(value (type) ? (_) @parameter.inside @parameter.movement . ) @parameter.around
27+
runtime/queries/kotlin/highlights.scm+4−1
@@ -244,7 +244,10 @@
244244 . (identifier)) @namespace
245245
246246((type_identifier) @type.builtin
247− (#match? @function.builtin "^(Byte|Short|Int|Long|UByte|UShort|UInt|ULong|Float|Double|Boolean|Char|String|Array|ByteArray|ShortArray|IntArray|LongArray|UByteArray|UShortArray|UIntArray|ULongArray|FloatArray|DoubleArray|BooleanArray|CharArray|Map|Set|List|EmptyMap|EmptySet|EmptyList|MutableMap|MutableSet|MutableList)$"))
247+ (#match? @type.builtin "^(Byte|Short|Int|Long|UByte|UShort|UInt|ULong|Float|Double|Boolean|Char|String|Array|ByteArray|ShortArray|IntArray|LongArray|UByteArray|UShortArray|UIntArray|ULongArray|FloatArray|DoubleArray|BooleanArray|CharArray|Map|Set|List|EmptyMap|EmptySet|EmptyList|MutableMap|MutableSet|MutableList)$"))
248+
249+(type_parameter
250+ (type_identifier) @type.parameter)
248251
249252(type_identifier) @type
250253
runtime/queries/kotlin/locals.scmnew file+15
@@ -0,0 +1,15 @@
1+; Scopes
2+
3+[
4+ (class_declaration)
5+ (function_declaration)
6+] @local.scope
7+
8+; Definitions
9+
10+(type_parameter
11+ (type_identifier) @local.definition)
12+
13+; References
14+
15+(type_identifier) @local.reference
runtime/queries/log/highlights.scmnew file+10
@@ -0,0 +1,10 @@
1+(trace) @comment
2+(debug) @hint
3+(info) @info
4+(warn) @warning
5+(error) @error
6+(year_month_day) @keyword
7+(time) @constant
8+(string_literal) @string
9+(number) @constant.numeric
10+(constant) @constant.builtin
runtime/queries/lpf/highlights.scmnew file+19
@@ -0,0 +1,19 @@
1+[
2+ "SYSCONFIG"
3+ "BLOCK"
4+ "LOCATE"
5+ "COMP"
6+ "FREQUENCY"
7+ "PORT"
8+ "IOBUF"
9+] @keyword
10+
11+["SITE"] @keyword.storage
12+
13+["="] @operator
14+
15+((number) @constant.numeric)
16+
17+((string) @string)
18+((line_comment) @comment)
19+
runtime/queries/markdown.inline/injections.scm+4−1
@@ -1,4 +1,7 @@
11
2−((html_tag) @injection.content (#set! injection.language "html") (#set! injection.include-unnamed-children))
2+((html_tag) @injection.content
3+ (#set! injection.language "html")
4+ (#set! injection.include-unnamed-children)
5+ (#set! injection.combined))
36
47((latex_block) @injection.content (#set! injection.language "latex") (#set! injection.include-unnamed-children))
runtime/queries/nix/injections.scm+14
@@ -5,6 +5,20 @@
55((((comment) @injection.language) .
66 (indented_string_expression (string_fragment) @injection.content))
77 (#set! injection.combined))
8+((binding
9+ (comment) @injection.language
10+ expression: (indented_string_expression (string_fragment) @injection.content))
11+ (#set! injection.combined))
12+
13+; Common attribute keys corresponding to Python scripts,
14+; such as those for NixOS VM tests in nixpkgs/nixos/tests.
15+((binding
16+ attrpath: (attrpath (identifier) @_path)
17+ expression: (indented_string_expression
18+ (string_fragment) @injection.content))
19+ (#match? @_path "(^|\\.)testScript$")
20+ (#set! injection.language "python")
21+ (#set! injection.combined))
822
923; Common attribute keys corresponding to scripts,
1024; such as those of stdenv.mkDerivation.
runtime/queries/nu/folds.scmdeleted−4
@@ -1,4 +0,0 @@
1−[
2− (function_definition)
3− (block)
4−] @fold
runtime/queries/nu/highlights.scm+276−44
@@ -1,55 +1,287 @@
1−(string) @string
2−(type) @type
3−(value_path) @variable
4−(comment) @comment
1+;;; ---
2+;;; keywords
3+[
4+ "def"
5+ "def-env"
6+ "alias"
7+ "export-env"
8+ "export"
9+ "extern"
10+ "module"
511
6−(number_literal) @constant.numeric
7−(range from: (number_literal) @constant.numeric)
8−(range to: (number_literal) @constant.numeric)
12+ "let"
13+ "let-env"
14+ "mut"
15+ "const"
916
10−(command cmd_name: (identifier) @function)
11−(function_definition func_name: (identifier) @function)
17+ "hide-env"
1218
13−[
14− (variable_declaration name: (identifier))
15− (parameter (identifier))
16− (flag (flag_name))
17− (flag (flag_shorthand_name))
18− (record_entry entry_name: (identifier))
19− (block_args block_param: (identifier))
20−] @variable.other.member
21−; (parameter (identifier) @variable.parameter) ; -- alternative highlighting group?
19+ "source"
20+ "source-env"
2221
23−(cmd_invocation) @embedded
22+ "overlay"
23+ "register"
2424
25+ "loop"
26+ "while"
27+ "error"
2528
26−((identifier) @constant
27− (#match? @constant "^[A-Z][A-Z\\d_]*$"))
29+ "do"
30+ "if"
31+ "else"
32+ "try"
33+ "catch"
34+ "match"
35+
36+ "break"
37+ "continue"
38+ "return"
2839
29−[
30− "if"
31− "else"
32− "let"
33− "def"
34− "export"
3540] @keyword
3641
42+(hide_mod "hide" @keyword)
43+(decl_use "use" @keyword)
44+
45+(ctrl_for
46+ "for" @keyword
47+ "in" @keyword
48+)
49+(overlay_list "list" @keyword.storage.modifier)
50+(overlay_hide "hide" @keyword.storage.modifier)
51+(overlay_new "new" @keyword.storage.modifier)
52+(overlay_use
53+ "use" @keyword.storage.modifier
54+ "as" @keyword
55+)
56+(ctrl_error "make" @keyword.storage.modifier)
57+
58+;;; ---
59+;;; literals
60+(val_number) @constant.numeric
61+(val_duration
62+ unit: [
63+ "ns" "µs" "us" "ms" "sec" "min" "hr" "day" "wk"
64+ ] @variable.parameter
65+)
66+(val_filesize
67+ unit: [
68+ "b" "B"
69+
70+ "kb" "kB" "Kb" "KB"
71+ "mb" "mB" "Mb" "MB"
72+ "gb" "gB" "Gb" "GB"
73+ "tb" "tB" "Tb" "TB"
74+ "pb" "pB" "Pb" "PB"
75+ "eb" "eB" "Eb" "EB"
76+ "zb" "zB" "Zb" "ZB"
77+
78+ "kib" "kiB" "kIB" "kIb" "Kib" "KIb" "KIB"
79+ "mib" "miB" "mIB" "mIb" "Mib" "MIb" "MIB"
80+ "gib" "giB" "gIB" "gIb" "Gib" "GIb" "GIB"
81+ "tib" "tiB" "tIB" "tIb" "Tib" "TIb" "TIB"
82+ "pib" "piB" "pIB" "pIb" "Pib" "PIb" "PIB"
83+ "eib" "eiB" "eIB" "eIb" "Eib" "EIb" "EIB"
84+ "zib" "ziB" "zIB" "zIb" "Zib" "ZIb" "ZIB"
85+ ] @variable.parameter
86+)
87+(val_binary
88+ [
89+ "0b"
90+ "0o"
91+ "0x"
92+ ] @constant.numeric
93+ "[" @punctuation.bracket
94+ digit: [
95+ "," @punctuation.delimiter
96+ (hex_digit) @constant.number
97+ ]
98+ "]" @punctuation.bracket
99+) @constant.numeric
100+(val_bool) @constant.builtin
101+(val_nothing) @constant.builtin
102+(val_string) @string
103+(val_date) @constant.number
104+(inter_escape_sequence) @constant.character.escape
105+(escape_sequence) @constant.character.escape
106+(val_interpolated [
107+ "$\""
108+ "$\'"
109+ "\""
110+ "\'"
111+] @string)
112+(unescaped_interpolated_content) @string
113+(escaped_interpolated_content) @string
114+(expr_interpolated ["(" ")"] @variable.parameter)
115+
116+;;; ---
117+;;; operators
118+(expr_binary [
119+ "+"
120+ "-"
121+ "*"
122+ "/"
123+ "mod"
124+ "//"
125+ "++"
126+ "**"
127+ "=="
128+ "!="
129+ "<"
130+ "<="
131+ ">"
132+ ">="
133+ "=~"
134+ "!~"
135+ "and"
136+ "or"
137+ "xor"
138+ "bit-or"
139+ "bit-xor"
140+ "bit-and"
141+ "bit-shl"
142+ "bit-shr"
143+ "in"
144+ "not-in"
145+ "starts-with"
146+ "ends-with"
147+] @operator )
148+
149+(where_command [
150+ "+"
151+ "-"
152+ "*"
153+ "/"
154+ "mod"
155+ "//"
156+ "++"
157+ "**"
158+ "=="
159+ "!="
160+ "<"
161+ "<="
162+ ">"
163+ ">="
164+ "=~"
165+ "!~"
166+ "and"
167+ "or"
168+ "xor"
169+ "bit-or"
170+ "bit-xor"
171+ "bit-and"
172+ "bit-shl"
173+ "bit-shr"
174+ "in"
175+ "not-in"
176+ "starts-with"
177+ "ends-with"
178+] @operator)
179+
180+(assignment [
181+ "="
182+ "+="
183+ "-="
184+ "*="
185+ "/="
186+ "++="
187+] @operator)
188+
189+(expr_unary ["not" "-"] @operator)
190+
191+(val_range [
192+ ".."
193+ "..="
194+ "..<"
195+] @operator)
196+
197+["=>" "=" "|"] @operator
198+
37199[
38− ; "/" Not making / an operator may lead to better highlighting?
39− "$"
40− "|"
41− "+"
42− "-"
43− "*"
44− "="
45− "!="
46− "&&"
47− "||"
48− "=="
49− ">"
50−] @operator
51−
52−["."
53− ","
54− ";"
200+ "o>" "out>"
201+ "e>" "err>"
202+ "e+o>" "err+out>"
203+ "o+e>" "out+err>"
204+] @special
205+
206+;;; ---
207+;;; punctuation
208+[
209+ ","
210+ ";"
55211] @punctuation.delimiter
212+
213+(param_short_flag "-" @punctuation.delimiter)
214+(param_long_flag ["--"] @punctuation.delimiter)
215+(long_flag ["--"] @punctuation.delimiter)
216+(param_rest "..." @punctuation.delimiter)
217+(param_type [":"] @punctuation.special)
218+(param_value ["="] @punctuation.special)
219+(param_cmd ["@"] @punctuation.special)
220+(param_opt ["?"] @punctuation.special)
221+
222+[
223+ "(" ")"
224+ "{" "}"
225+ "[" "]"
226+] @punctuation.bracket
227+
228+(val_record
229+ (record_entry ":" @punctuation.delimiter))
230+;;; ---
231+;;; identifiers
232+(param_rest
233+ name: (_) @variable.parameter)
234+(param_opt
235+ name: (_) @variable.parameter)
236+(parameter
237+ param_name: (_) @variable.parameter)
238+(param_cmd
239+ (cmd_identifier) @string)
240+(param_long_flag) @variable.parameter
241+(param_short_flag) @variable.parameter
242+
243+(short_flag) @variable.parameter
244+(long_flag) @variable.parameter
245+
246+(scope_pattern [(wild_card) @function])
247+
248+(cmd_identifier) @function
249+
250+(command
251+ "^" @punctuation.delimiter
252+ head: (_) @function
253+)
254+
255+"where" @function
256+
257+(path
258+ ["." "?"] @punctuation.delimiter
259+) @variable.parameter
260+
261+(val_variable
262+ "$" @variable.parameter
263+ [
264+ (identifier) @namespace
265+ "in"
266+ "nu"
267+ "env"
268+ "nothing"
269+ ] @special
270+)
271+;;; ---
272+;;; types
273+(flat_type) @type.builtin
274+(list_type
275+ "list" @type.enum
276+ ["<" ">"] @punctuation.bracket
277+)
278+(collection_type
279+ ["record" "table"] @type.enum
280+ "<" @punctuation.bracket
281+ key: (_) @variable.parameter
282+ ["," ":"] @punctuation.delimiter
283+ ">" @punctuation.bracket
284+)
285+
286+(shebang) @comment
287+(comment) @comment
runtime/queries/nu/injections.scm+1−1
@@ -1,2 +1,2 @@
11((comment) @injection.content
2− (#set! injection.language "comment"))
2+ (#set! injection.language "comment"))
runtime/queries/nu/locals.scmdeleted−13
@@ -1,13 +0,0 @@
1−; Scopes
2−(function_definition) @scope
3−
4−; Definitions
5−(variable_declaration
6− name: (identifier) @definition.var)
7−
8−(function_definition
9− func_name: (identifier) @definition.function)
10−
11−; References
12−(value_path) @reference
13−(word) @reference
runtime/queries/nunjucks/highlights.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: jinja
runtime/queries/nunjucks/injections.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: jinja
runtime/queries/ocaml/highlights.scm+2
@@ -8,6 +8,8 @@
88
99[(class_name) (class_type_name) (type_constructor)] @type
1010
11+(type_variable) @type.parameter
12+
1113[(constructor_name) (tag)] @constructor
1214
1315; Functions
runtime/queries/perl/highlights.scm−2
@@ -41,8 +41,6 @@
4141(eof_marker) @keyword.directive
4242(data_section) @comment
4343
44−(pod) @comment.block.documentation
45−
4644(number) @constant.numeric
4745(version) @constant
4846
runtime/queries/perl/indents.scmnew file+29
@@ -0,0 +1,29 @@
1+[
2+ (block)
3+ (conditional_statement)
4+ (loop_statement)
5+ (cstyle_for_statement)
6+ (for_statement)
7+ (elsif)
8+ (array_element_expression)
9+ (hash_element_expression)
10+ (coderef_call_expression)
11+ (anonymous_slice_expression)
12+ (slice_expression)
13+ (keyval_expression)
14+ (anonymous_array_expression)
15+ (anonymous_hash_expression)
16+ (stub_expression)
17+ (func0op_call_expression)
18+ (func1op_call_expression)
19+ (map_grep_expression)
20+ (function_call_expression)
21+ (method_call_expression)
22+ (attribute)
23+] @indent
24+
25+[
26+ "}"
27+ "]"
28+ ")"
29+] @outdent
runtime/queries/perl/injections.scm+2
@@ -1,2 +1,4 @@
11((comment) @injection.content
22 (#set! injection.language "comment"))
3+((pod) @injection.content
4+ (#set! injection.language "pod"))
runtime/queries/perl/textobjects.scmnew file+14
@@ -0,0 +1,14 @@
1+(subroutine_declaration_statement
2+ body: (_) @function.inside) @function.around
3+(anonymous_subroutine_expression
4+ body: (_) @function.inside) @function.around
5+
6+(package_statement) @class.around
7+(package_statement
8+ (block) @class.inside)
9+
10+(list_expression
11+ (_) @parameter.inside)
12+
13+(comment) @comment.around
14+(pod) @comment.around
runtime/queries/pod/highlights.scmnew file+61
@@ -0,0 +1,61 @@
1+[(pod_directive)
2+ (head_directive)
3+ (over_directive)
4+ (item_directive)
5+ (back_directive)
6+ (encoding_directive)
7+ (cut_directive)] @tag
8+
9+(head_paragraph
10+ (head_directive) @directive
11+ (#eq? @directive "=head1")
12+ (content) @markup.heading.1)
13+(head_paragraph
14+ (head_directive) @directive
15+ (#eq? @directive "=head2")
16+ (content) @markup.heading.2)
17+(head_paragraph
18+ (head_directive) @directive
19+ (#eq? @directive "=head3")
20+ (content) @markup.heading.3)
21+(head_paragraph
22+ (head_directive) @directive
23+ (#eq? @directive "=head4")
24+ (content) @markup.heading.4)
25+(head_paragraph
26+ (head_directive) @directive
27+ (#eq? @directive "=head5")
28+ (content) @markup.heading.5)
29+(head_paragraph
30+ (head_directive) @directive
31+ (#eq? @directive "=head6")
32+ (content) @markup.heading.6)
33+
34+(over_paragraph (content) @constant.numeric.integer)
35+(item_paragraph (content) @markup.list)
36+(encoding_paragraph (content) @string)
37+
38+(verbatim_paragraph (content) @markup.raw)
39+
40+(interior_sequence) @tag
41+
42+(interior_sequence
43+ (sequence_letter) @letter
44+ (#eq? @letter "B")
45+ (content) @markup.bold)
46+(interior_sequence
47+ (sequence_letter) @letter
48+ (#eq? @letter "C")
49+ (content) @markup.raw)
50+(interior_sequence
51+ (sequence_letter) @letter
52+ (#eq? @letter "F")
53+ (content) @markup.italic)
54+(interior_sequence
55+ (sequence_letter) @letter
56+ (#eq? @letter "I")
57+ (content) @markup.italic)
58+(interior_sequence
59+ (sequence_letter) @letter
60+ (#eq? @letter "L")
61+ (content) @markup.link.url)
runtime/queries/purescript/highlights.scm+164−1
@@ -1 +1,164 @@
1−; inherits: haskell
1+; ----------------------------------------------------------------------------
2+; Record fields would need to come before literal strings in order to be captured correctly
3+
4+ (record_accessor
5+ field: [ (variable)
6+ (string)
7+ (triple_quote_string)
8+ ] @variable.other.member)
9+
10+ (exp_record_access
11+ field: [ (variable)
12+ (string)
13+ (triple_quote_string)
14+ ] @variable.other.member)
15+
16+
17+; ----------------------------------------------------------------------------
18+; Literals and comments
19+
20+ (integer) @constant.numeric.integer
21+ (exp_negation) @constant.numeric.integer
22+ (exp_literal (number)) @constant.numeric.float
23+ (char) @constant.character
24+ [
25+ (string)
26+ (triple_quote_string)
27+ ] @string
28+
29+ (comment) @comment
30+
31+
32+; ----------------------------------------------------------------------------
33+; Punctuation
34+
35+ [
36+ "("
37+ ")"
38+ "{"
39+ "}"
40+ "["
41+ "]"
42+ ] @punctuation.bracket
43+
44+ [
45+ (comma)
46+ ";"
47+ ] @punctuation.delimiter
48+
49+
50+; ----------------------------------------------------------------------------
51+; Keywords, operators, includes
52+
53+ ; This needs to come before the other "else" in
54+ ; order to be highlighted correctly
55+ (class_instance "else" @keyword)
56+
57+ [
58+ "if"
59+ "then"
60+ "else"
61+ "case"
62+ "of"
63+ ] @keyword.control.conditional
64+
65+ [
66+ "import"
67+ "module"
68+ ] @keyword.control.import
69+
70+ [
71+ (operator)
72+ (constructor_operator)
73+ (type_operator)
74+ (qualified_module) ; grabs the `.` (dot), ex: import System.IO
75+ (all_names)
76+
77+ ; `_` wildcards in if-then-else and case-of expressions,
78+ ; as well as record updates and operator sections
79+ (wildcard)
80+ "="
81+ "|"
82+ "::"
83+ "∷"
84+ "=>"
85+ "⇒"
86+ "<="
87+ "⇐"
88+ "->"
89+ "→"
90+ "<-"
91+ "←"
92+ "\\"
93+ "`"
94+ "@"
95+ ] @operator
96+
97+ (qualified_module (module) @constructor)
98+ (module) @namespace
99+ (qualified_type (module) @namespace)
100+ (qualified_variable (module) @namespace)
101+ (import (module) @namespace)
102+
103+ [
104+ (where)
105+ "let"
106+ "in"
107+ "class"
108+ "instance"
109+ "derive"
110+ "foreign"
111+ "data"
112+ "newtype"
113+ "type"
114+ "as"
115+ "hiding"
116+ "do"
117+ "ado"
118+ "forall"
119+ "∀"
120+ "infix"
121+ "infixl"
122+ "infixr"
123+ ] @keyword
124+
125+ (type_role_declaration
126+ "role" @keyword
127+ role: (type_role) @keyword)
128+
129+ (hole) @label
130+
131+; ----------------------------------------------------------------------------
132+; Functions and variables
133+
134+ (row_field (field_name) @variable.other.member)
135+ (record_field (field_name) @variable.other.member)
136+ (record_field (field_pun) @variable.other.member)
137+
138+ (signature name: (variable) @type)
139+ (function name: (variable) @function)
140+ (class_instance (instance_name) @function)
141+ (derive_declaration (instance_name) @function)
142+
143+ ; true or false
144+ ((variable) @constant.builtin.boolean
145+ (#match? @constant.builtin.boolean "^(true|false)$"))
146+
147+ ; The former one works for `tree-sitter highlight` but not in Helix/Kakoune.
148+ ; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all
149+ ; as an operator and leaving it to the child nodes, and highlighting everything as an operator.
150+ (exp_ticked (_) @operator)
151+ (exp_ticked (exp_name (variable) @operator))
152+ (exp_ticked (exp_name (qualified_variable (variable) @operator)))
153+
154+ (variable) @variable
155+
156+ ("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
157+
158+; ----------------------------------------------------------------------------
159+; Types
160+
161+ (type) @type
162+
163+ (constructor) @constructor
164+
runtime/queries/purescript/injections.scm+2−1
@@ -1 +1,2 @@
1−; inherits: haskell
1+((comment) @injection.content
2+ (#set! injection.language "comment"))
runtime/queries/purescript/locals.scm+4−1
@@ -1 +1,4 @@
1−; inherits: haskell
1+(signature name: (variable)) @local.definition
2+(function name: (variable)) @local.definition
3+(pat_name (variable)) @local.definition
4+(exp_name (variable)) @local.reference
runtime/queries/purescript/textobjects.scmnew file+13
@@ -0,0 +1,13 @@
1+(comment) @comment.inside
2+
3+[
4+ (data)
5+ (type)
6+ (newtype)
7+] @class.around
8+
9+((signature)? (function rhs:(_) @function.inside)) @function.around
10+(exp_lambda) @function.around
11+
12+(data (type_variable) @parameter.inside)
13+(patterns (_) @parameter.inside)
runtime/queries/python/highlights.scm+6
@@ -134,14 +134,17 @@
134134 "//="
135135 "/="
136136 "&"
137+ "&="
137138 "%"
138139 "%="
139140 "^"
141+ "^="
140142 "+"
141143 "->"
142144 "+="
143145 "<"
144146 "<<"
147+ "<<="
145148 "<="
146149 "<>"
147150 "="
@@ -150,8 +153,11 @@
150153 ">"
151154 ">="
152155 ">>"
156+ ">>="
153157 "|"
158+ "|="
154159 "~"
160+ "@="
155161] @operator
156162
157163[
runtime/queries/python/indents.scm+9
@@ -73,3 +73,12 @@
7373(else_clause
7474 "else" @outdent)
7575
76+(parameters
77+ .
78+ (identifier) @anchor
79+ (#set! "scope" "tail")) @align
80+(argument_list
81+ .
82+ (_) @anchor
83+ (#set! "scope" "tail")) @align
84+
runtime/queries/racket/indents.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: scheme
runtime/queries/robot/highlights.scm+51−13
@@ -1,21 +1,59 @@
1−(comment) @comment
1+[
2+ (comment)
3+ (extra_text)
4+] @comment
5+
6+[
7+ (section_header)
8+ (setting_statement)
9+ (keyword_setting)
10+ (test_case_setting)
11+] @keyword
12+
13+(variable_definition (variable_name) @variable)
14+(keyword_definition (name) @function)
15+(test_case_definition (name) @function)
16+
17+(keyword_invocation (keyword) @function)
218(ellipses) @punctuation.delimiter
319
4−(section_header) @keyword
5−(extra_text) @comment
20+(text_chunk) @string
21+(inline_python_expression) @string.special
22+[
23+ (scalar_variable)
24+ (list_variable)
25+ (dictionary_variable)
26+] @variable
627
7−(setting_statement) @keyword
28+; Control structures
829
9−(variable_definition (variable_name) @variable)
30+"RETURN" @keyword.control.return
1031
11−(keyword_definition (name) @function)
12−(keyword_definition (body (keyword_setting) @keyword))
32+[
33+ "FOR"
34+ "IN"
35+ "IN RANGE"
36+ "IN ENUMERATE"
37+ "IN ZIP"
38+ (break_statement)
39+ (continue_statement)
40+] @keyword.control.repeat
41+(for_statement "END" @keyword.control.repeat)
1342
14−(test_case_definition (name) @property)
43+"WHILE" @keyword.control.repeat
44+(while_statement "END" @keyword.control.repeat)
1545
16−(keyword_invocation (keyword) @function)
46+[
47+ "IF"
48+ "ELSE IF"
49+] @keyword.control.conditional
50+(if_statement "END" @keyword.control.conditional)
51+(if_statement (else_statement "ELSE" @keyword.control.conditional))
1752
18−(argument (text_chunk) @string)
19−(argument (scalar_variable) @string.special)
20−(argument (list_variable) @string.special)
21−(argument (dictionary_variable) @string.special)
53+[
54+ "TRY"
55+ "EXCEPT"
56+ "FINALLY"
57+] @keyword.control.exception
58+(try_statement "END" @keyword.control.exception)
59+(try_statement (else_statement "ELSE" @keyword.control.exception))
runtime/queries/ron/highlights.scm+43−1
@@ -1 +1,43 @@
1−; inherits: rust
1+; Literals
2+;------------
3+
4+(string) @string
5+(boolean) @constant.builtin.boolean
6+(integer) @constant.numeric.integer
7+(float) @constant.numeric.float
8+(char) @constant.character
9+
10+; Structs
11+;------------
12+
13+(enum_variant) @type.enum.variant
14+(struct_entry (_) @variable.other.member ":")
15+(struct_name (identifier)) @type
16+
17+
18+
19+
20+; Comments
21+;------------
22+
23+(line_comment) @comment.line
24+(block_comment) @comment.block
25+
26+
27+; Punctuation
28+;------------
29+
30+"," @punctuation.delimiter
31+":" @punctuation.delimiter
32+
33+"(" @punctuation.bracket
34+")" @punctuation.bracket
35+"[" @punctuation.bracket
36+"]" @punctuation.bracket
37+"{" @punctuation.bracket
38+"}" @punctuation.bracket
39+
40+
41+; Special
42+;------------
43+(escape_sequence) @constant.character.escape
runtime/queries/ron/indents.scm+12−1
@@ -1 +1,12 @@
1−; inherits: rust
1+[
2+ (array)
3+ (map)
4+ (tuple)
5+ (struct)
6+] @indent
7+
8+[
9+ "}"
10+ "]"
11+ ")"
12+] @outdent
runtime/queries/ron/injections.scm+2−1
@@ -1 +1,2 @@
1−; inherits: rust
1+([(line_comment) (block_comment)] @injection.content
2+ (#set! injection.language "comment"))
runtime/queries/rust/highlights.scm+7
@@ -9,6 +9,13 @@
99; Types
1010; -------
1111
12+(type_parameters
13+ (type_identifier) @type.parameter)
14+(constrained_type_parameter
15+ left: (type_identifier) @type.parameter)
16+(optional_type_parameter
17+ name: (type_identifier) @type.parameter)
18+
1219; ---
1320; Primitives
1421; ---
runtime/queries/rust/indents.scm+69−2
@@ -14,9 +14,11 @@
1414 (call_expression)
1515 (binary_expression)
1616 (field_expression)
17+ (await_expression)
1718 (tuple_expression)
1819 (array_expression)
1920 (where_clause)
21+ (type_cast_expression)
2022
2123 (token_tree)
2224 (macro_definition)
@@ -48,10 +50,16 @@
4850 (#set! "scope" "all")
4951)
5052(let_declaration
53+ "let" @expr-start
54+ value: (_) @indent
55+ alternative: (_)? @indent
56+ (#not-same-line? @indent @expr-start)
57+ (#set! "scope" "all")
58+)
59+(let_condition
5160 .
5261 (_) @expr-start
5362 value: (_) @indent
54− alternative: (_)? @indent
5563 (#not-same-line? @indent @expr-start)
5664 (#set! "scope" "all")
5765)
@@ -69,6 +77,22 @@
6977 (#not-same-line? @indent @expr-start)
7078 (#set! "scope" "all")
7179)
80+(field_pattern
81+ .
82+ (_) @expr-start
83+ pattern: (_) @indent
84+ (#not-same-line? @indent @expr-start)
85+ (#set! "scope" "all")
86+)
87+; Indent type aliases that span multiple lines, similar to
88+; regular assignment expressions
89+(type_item
90+ .
91+ (_) @expr-start
92+ type: (_) @indent
93+ (#not-same-line? @indent @expr-start)
94+ (#set! "scope" "all")
95+)
7296
7397; Some field expressions where the left part is a multiline expression are not
7498; indented by cargo fmt.
@@ -77,5 +101,48 @@
77101(field_expression
78102 value: (_) @val
79103 "." @outdent
80− (#match? @val "(\\A[^\\n\\r]+\\([\\t ]*(\\n|\\r).*)|(\\A[^\\n\\r]*\\{[\\t ]*(\\n|\\r))")
104+ ; Check whether the first line ends with `(`, `{` or `[` (up to whitespace).
105+ (#match? @val "(\\A[^\\n\\r]+(\\(|\\{|\\[)[\\t ]*(\\n|\\r))")
106+)
107+; Same as above, but with an additional `call_expression`. This is required since otherwise
108+; the arguments of the function call won't be outdented.
109+(call_expression
110+ function: (field_expression
111+ value: (_) @val
112+ "." @outdent
113+ (#match? @val "(\\A[^\\n\\r]+(\\(|\\{|\\[)[\\t ]*(\\n|\\r))")
114+ )
115+ arguments: (_) @outdent
116+)
117+
118+
119+; Indent if guards in patterns.
120+; Since the tree-sitter grammar doesn't create a node for the if expression,
121+; it's not possible to do this correctly in all cases. Indenting the tail of the
122+; whole pattern whenever it contains an `if` only fails if the `if` appears after
123+; the second line of the pattern (which should only rarely be the case)
124+(match_pattern
125+ .
126+ (_) @expr-start
127+ "if" @pattern-guard
128+ (#not-same-line? @expr-start @pattern-guard)
129+) @indent
130+
131+; Align closure parameters if they span more than one line
132+(closure_parameters
133+ "|"
134+ .
135+ (_) @anchor
136+ (_) @expr-end
137+ .
138+ (#not-same-line? @anchor @expr-end)
139+) @align
140+
141+(for_expression
142+ "in" @in
143+ .
144+ (_) @indent
145+ (#not-same-line? @in @indent)
146+ (#set! "scope" "all")
81147)
148+
runtime/queries/rust/injections.scm+6
@@ -1,6 +1,12 @@
11([(line_comment) (block_comment)] @injection.content
22 (#set! injection.language "comment"))
33
4+((macro_invocation
5+ macro: (identifier) @_html (#eq? @_html "html")
6+ (token_tree) @injection.content)
7+ (#set! injection.language "html")
8+ (#set! injection.include-children))
9+
410((macro_invocation
511 (token_tree) @injection.content)
612 (#set! injection.language "rust")
runtime/queries/rust/locals.scm+14−1
@@ -2,6 +2,12 @@
22
33[
44 (function_item)
5+ (struct_item)
6+ (enum_item)
7+ (union_item)
8+ (type_item)
9+ (trait_item)
10+ (impl_item)
511 (closure_expression)
612 (block)
713] @local.scope
@@ -11,8 +17,15 @@
1117(parameter
1218 (identifier) @local.definition)
1319
20+(type_parameters
21+ (type_identifier) @local.definition)
22+(constrained_type_parameter
23+ left: (type_identifier) @local.definition)
24+(optional_type_parameter
25+ name: (type_identifier) @local.definition)
26+
1427(closure_parameters (identifier) @local.definition)
1528
1629; References
1730(identifier) @local.reference
18−
31+(type_identifier) @local.reference
runtime/queries/rust/textobjects.scm+4−1
@@ -1,5 +1,8 @@
11(function_item
2− body: (_) @function.inside) @function.around(closure_expression body: (_) @function.inside) @function.around
2+ body: (_) @function.inside) @function.around
3+
4+(closure_expression
5+ body: (_) @function.inside) @function.around
36
47(struct_item
58 body: (_) @class.inside) @class.around
runtime/queries/scheme/highlights.scm+5
@@ -97,3 +97,8 @@
9797
9898["(" ")" "[" "]" "{" "}"] @punctuation.bracket
9999
100+(quote "'") @operator
101+(unquote_splicing ",@") @operator
102+(unquote ",") @operator
103+(quasiquote "`") @operator
104+
runtime/queries/scheme/indents.scmnew file+43
@@ -0,0 +1,43 @@
1+; This roughly follows the description at: https://github.com/ds26gte/scmindent#how-subforms-are-indented
2+
3+; Exclude literals in the first patterns, since different rules apply for them.
4+; Similarly, exclude certain keywords (detected by a regular expression).
5+; If a list has 2 elements on the first line, it is aligned to the second element.
6+(list . (_) @first . (_) @anchor
7+ (#same-line? @first @anchor)
8+ (#set! "scope" "tail")
9+ (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number")
10+ (#not-match? @first "def.*|let.*|set!")) @align
11+; If the first element in a list is also a list and on a line by itself, the outer list is aligned to it
12+(list . (list) @anchor .
13+ (#set! "scope" "tail")
14+ (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number")) @align
15+(list . (list) @anchor . (_) @second
16+ (#not-same-line? @anchor @second)
17+ (#set! "scope" "tail")
18+ (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number")
19+ (#not-match? @first "def.*|let.*|set!")) @align
20+; If the first element in a list is not a list and on a line by itself, the outer list is aligned to
21+; it plus 1 additional space. This cannot currently be modelled exactly by our indent queries,
22+; but the following is equivalent, assuming that:
23+; - the indent width is 2 (the default for scheme)
24+; - There is no space between the opening parenthesis of the list and the first element
25+(list . (_) @first .
26+ (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number")
27+ (#not-match? @first "def.*|let.*|set!")) @indent
28+(list . (_) @first . (_) @second
29+ (#not-same-line? @first @second)
30+ (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number")
31+ (#not-match? @first "def.*|let.*|set!")) @indent
32+
33+; If the first element in a list is a literal, align the list to it
34+(list . [(boolean) (character) (string) (number)] @anchor
35+ (#set! "scope" "tail")) @align
36+
37+; If the first element is among a set of predefined keywords, align the list to this element
38+; plus 1 space (using the same workaround as above for now). This is a simplification since actually
39+; the second line of the list should be indented by 2 spaces more in some cases. Supporting this would
40+; be possible but require significantly more patterns.
41+(list . (symbol) @first
42+ (#match? @first "def.*|let.*|set!")) @indent
43+
runtime/queries/slint/highlights.scm+118−72
@@ -1,105 +1,153 @@
11
2−(user_type_identifier) @type
2+(identifier) @variable
3+[
4+ (type_identifier)
5+ (units)
6+]@type
37
4−(var_identifier) @variable
8+(array_literal
9+ (identifier) @type)
510
6−(state_identifier) @variable.other.member
11+(function_identifier) @function
12+[
13+ (image_macro)
14+ (children_macro)
15+ (radial_grad_macro)
16+ (linear_grad_macro)
17+] @function.macro
718
8−(var_identifier
9− (post_identifier) @variable)
19+(call_expression
20+ function: (identifier) @function)
21+(call_expression
22+ function: (field_expression
23+ field: (identifier) @function))
1024
11−(function_identifier) @function
25+(vis) @keyword.control.import
1226
13−(reference_identifier) @keyword.storage.modifier.ref
14−(visibility_modifier) @keyword.storage.modifier
27+(transition_statement state: (identifier) @variable.other.member)
28+(state_expression state: (identifier) @variable.other.member)
29+(struct_block_definition field: (identifier) @variable.other.member)
30+(assign_property (identifier) @attribute)
1531
1632(comment) @comment
1733
18−(string) @string
19−(int_number) @constant.numeric
20−(unit_type) @type.builtin
34+(string_literal) @string
35+(int_literal) @constant.numeric.integer
36+(float_literal) @constant.numeric.float
37+
38+[
39+ "in"
40+ "in-out"
41+ "for"
42+] @keyword.control.repeat
43+
44+[
45+ "import"
46+ "export"
47+ "from"
48+] @keyword.control.import
49+
50+[
51+ "if"
52+ "else"
53+ "when"
54+] @keyword.control.conditional
55+
56+[
57+ "struct"
58+ "property"
59+] @keyword.storage.type
60+
61+[
62+ "global"
63+] @keyword.storage.modifier
64+
2165
2266[
23−"struct"
24−"property"
25−"callback"
26−"import"
27−"from"
28−"root"
29−"parent"
30−"this"
31−"for"
32−"in"
33−"if"
34−"else if"
35−"else"
36−"animate"
37−"states"
38−"when"
39−"in"
40−"out"
41−"transitions"
42−"global"
67+ "root"
68+ "parent"
69+ "duration"
70+ "easing"
71+] @variable.builtin
72+
73+
74+[
75+ "callback"
76+ "animate"
77+ "states"
78+ "out"
79+ "transitions"
80+ "component"
81+ "inherits"
4382] @keyword
4483
4584[
46− "black"
47− "transparent"
48− "blue"
49− "ease"
50− "ease_in"
51− "ease-in"
52− "ease_in_out"
53− "ease-in-out"
54− "ease_out"
55− "ease-out"
56− "end"
57− "green"
58− "red"
59− "red"
60− "start"
61− "yellow"
62− "true"
63− "false"
85+ "black"
86+ "transparent"
87+ "blue"
88+ "ease"
89+ "ease_in"
90+ "ease-in"
91+ "ease_in_out"
92+ "ease-in-out"
93+ "ease_out"
94+ "ease-out"
95+ "end"
96+ "green"
97+ "red"
98+ "start"
99+ "yellow"
100+ "white"
101+ "gray"
64102 ] @constant.builtin
65103
104+[
105+ "true"
106+ "false"
107+] @constant.builtin.boolean
108+
66109"@" @keyword
67110
68111; ; Punctuation
69112[
70113 ","
71114 "."
115+ ";"
116+ ":"
72117] @punctuation.delimiter
73118
74119; ; Brackets
75120[
76−"("
77−")"
78−"["
79−"]"
80−"{"
81−"}"
121+ "("
122+ ")"
123+ "["
124+ "]"
125+ "{"
126+ "}"
82127] @punctuation.bracket
83128
129+(define_property ["<" ">"] @punctuation.bracket)
130+
84131[
85−"angle"
86−"bool"
87−"brush"
88−; "color" // This causes problems
89−"duration"
90−"easing"
91−"float"
92−"image"
93−"int"
94−"length"
95−"percent"
96−"physical-length"
97−"physical_length"
98−"string"
132+ "angle"
133+ "bool"
134+ "brush"
135+ "color"
136+ "duration"
137+ "easing"
138+ "float"
139+ "image"
140+ "int"
141+ "length"
142+ "percent"
143+ "physical-length"
144+ "physical_length"
145+ "string"
99146] @type.builtin
100147
101148[
102149 ":="
150+ "<=>"
103151 "!"
104152 "-"
105153 "+"
@@ -118,8 +166,6 @@
118166 "*="
119167 "/="
120168 "?"
121−
122− "=>"
123− ] @operator
169+ "=>" ] @operator
124170
125171(ternary_expression [":" "?"] @keyword.control.conditional)
runtime/queries/slint/indents.scm+6−5
@@ -1,11 +1,12 @@
11[
2− (field_declaration_list_body)
3− (list_definition_body)
4− (struct_field_declaration_list_body)
2+ (comp_body)
3+ (state_statement)
4+ (transition_statement)
5+ (handler_body)
6+ (consequence_body)
7+ (global_single)
58] @indent
69
710[
811 "}"
9− "]"
10− ")"
1112] @outdent
runtime/queries/slint/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))
runtime/queries/slint/locals.scm+1−1
@@ -1,3 +1,3 @@
11; locals.scm
22
3−(component_definition) @local.scope
3+(component_item) @local.scope
runtime/queries/smali/folds.scmnew file+12
@@ -0,0 +1,12 @@
1+[
2+ (annotation_directive)
3+ (array_data_directive)
4+ (field_definition)
5+ (method_definition)
6+ (packed_switch_directive)
7+ (param_directive)
8+ (parameter_directive)
9+ (sparse_switch_directive)
10+ (subannotation_directive)
11+ (list)
12+] @fold
runtime/queries/smali/highlights.scmnew file+216
@@ -0,0 +1,216 @@
1+; Types
2+
3+(class_identifier
4+ (identifier) @type)
5+
6+(primitive_type) @type.builtin
7+
8+((class_identifier
9+ . (identifier) @_first @type.builtin
10+ (identifier) @type.builtin)
11+ (#match? @_first "^(android|dalvik|java|kotlinx)$"))
12+
13+((class_identifier
14+ . (identifier) @_first @type.builtin
15+ . (identifier) @_second @type.builtin
16+ (identifier) @type.builtin)
17+ (#eq? @_first "com")
18+ (#match? @_second "^(android|google)$"))
19+
20+; Methods
21+
22+(method_definition
23+ (method_signature (method_identifier) @function.method))
24+
25+(expression
26+ (opcode) @_invoke
27+ (body
28+ (full_method_signature
29+ (method_signature (method_identifier) @function.method)))
30+ (#match? @_invoke "^invoke"))
31+
32+(expression
33+ (opcode) @_field_access
34+ (body
35+ (field_identifier) @variable.other.member)
36+ (#match? @_field_access "^[is](get|put)-"))
37+
38+(method_handle
39+ (full_method_signature
40+ (method_signature (method_identifier) @function.method)))
41+
42+(custom_invoke
43+ . (identifier) @function.method
44+ (method_signature (method_identifier) @function.method))
45+
46+(annotation_value
47+ (body
48+ (method_signature (method_identifier) @function.method)))
49+
50+(annotation_value
51+ (body
52+ (full_method_signature
53+ (method_signature (method_identifier) @function.method))))
54+
55+(field_definition
56+ (body
57+ (method_signature (method_identifier) @function.method)))
58+
59+(field_definition
60+ (body
61+ (full_method_signature
62+ (method_signature (method_identifier) @function.method))))
63+
64+((method_identifier) @constructor
65+ (#match? @constructor "^(<init>|<clinit>)$"))
66+
67+"constructor" @constructor
68+
69+; Fields
70+
71+[
72+ (field_identifier)
73+ (annotation_key)
74+] @variable.other.member
75+
76+((field_identifier) @constant
77+ (#match? @constant "^[%u_]*$"))
78+
79+; Variables
80+
81+(variable) @variable.builtin
82+
83+(local_directive
84+ (identifier) @variable)
85+
86+; Parameters
87+
88+(parameter) @variable.parameter
89+(param_identifier) @variable.parameter
90+
91+; Labels
92+
93+[
94+ (label)
95+ (jmp_label)
96+] @label
97+
98+; Operators
99+
100+; (opcode) @keyword.operator
101+
102+((opcode) @keyword.control.return
103+ (#match? @keyword.control.return "^return"))
104+
105+((opcode) @keyword.control.conditional
106+ (#match? @keyword.control.conditional "^if"))
107+
108+((opcode) @keyword.control.conditional
109+ (#match? @keyword.control.conditional "^cmp"))
110+
111+((opcode) @keyword.control.exception
112+ (#match? @keyword.control.exception "^throw"))
113+
114+[
115+ "="
116+ ".."
117+] @operator
118+
119+; Keywords
120+
121+[
122+ ".class"
123+ ".super"
124+ ".implements"
125+ ".field"
126+ ".end field"
127+ ".annotation"
128+ ".end annotation"
129+ ".subannotation"
130+ ".end subannotation"
131+ ".param"
132+ ".end param"
133+ ".parameter"
134+ ".end parameter"
135+ ".local"
136+ ".end local"
137+ ".restart local"
138+ ".registers"
139+ ".packed-switch"
140+ ".end packed-switch"
141+ ".sparse-switch"
142+ ".end sparse-switch"
143+ ".array-data"
144+ ".end array-data"
145+ ".enum"
146+ (prologue_directive)
147+ (epilogue_directive)
148+] @keyword
149+
150+[
151+ ".source"
152+] @keyword.directive
153+
154+[
155+ ".method"
156+ ".end method"
157+] @keyword.function
158+
159+[
160+ ".catch"
161+ ".catchall"
162+] @keyword.control.exception
163+
164+; Literals
165+
166+(string) @string
167+(source_directive (string "\"" _ @string.special.url "\""))
168+(escape_sequence) @constant.character.escape
169+
170+(character) @constant.character
171+
172+"L" @punctuation
173+
174+(line_directive (number) @comment) @comment
175+(".locals" (number) @comment) @comment
176+
177+(number) @constant.numeric.integer
178+
179+[
180+ (float)
181+ (NaN)
182+ (Infinity)
183+] @constant.numeric.float
184+
185+(boolean) @constant.builtin.boolean
186+
187+(null) @constant.builtin
188+
189+; Misc
190+
191+(annotation_visibility) @keyword.storage.modifier
192+
193+(access_modifier) @keyword.storage.type
194+
195+(array_type
196+ "[" @punctuation.special)
197+
198+["{" "}"] @punctuation.bracket
199+
200+["(" ")"] @punctuation.bracket
201+
202+[
203+ "->"
204+ ","
205+ ":"
206+ ";"
207+ "@"
208+ "/"
209+] @punctuation.delimiter
210+
211+; Comments
212+
213+(comment) @comment
214+
215+(class_definition
216+ (comment) @comment.block.documentation)
runtime/queries/smali/indents.scmnew file+31
@@ -0,0 +1,31 @@
1+[
2+ (annotation_directive)
3+ (array_data_directive)
4+ (field_definition)
5+ (method_definition)
6+ (packed_switch_directive)
7+ (param_directive)
8+ (parameter_directive)
9+ (sparse_switch_directive)
10+ (subannotation_directive)
11+ (list)
12+ "\{"
13+] @indent
14+
15+[
16+ ".end annotation"
17+ ".end array-data"
18+ ".end field"
19+ ".end method"
20+ ".end packed-switch"
21+ ".end param"
22+ ".end parameter"
23+ ".end sparse-switch"
24+ ".end subannotation"
25+ "\}"
26+] @outdent
27+
28+[
29+ (ERROR)
30+ (comment)
31+] @indent.always
runtime/queries/smali/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))
runtime/queries/smali/locals.scmnew file+42
@@ -0,0 +1,42 @@
1+[
2+ (class_directive)
3+ (expression)
4+ (annotation_directive)
5+ (array_data_directive)
6+ (method_definition)
7+ (packed_switch_directive)
8+ (sparse_switch_directive)
9+ (subannotation_directive)
10+] @local.scope
11+
12+[
13+ (identifier)
14+ (class_identifier)
15+ (label)
16+ (jmp_label)
17+] @local.reference
18+
19+(enum_reference
20+ (field_identifier) @local.definition)
21+
22+((field_definition
23+ (access_modifiers) @_mod
24+ (field_identifier) @local.definition)
25+ (#eq? @_mod "enum"))
26+
27+(field_definition
28+ (field_identifier) @local.definition
29+ (field_type) @local.definition)
30+
31+(annotation_key) @local.definition
32+
33+(method_definition
34+ (method_signature (method_identifier) @local.definition))
35+
36+(param_identifier) @local.definition
37+
38+(annotation_directive
39+ (class_identifier) @local.definition)
40+
41+(class_directive
42+ (class_identifier) @local.definition)
runtime/queries/sql/highlights.scm+317−231
@@ -1,134 +1,169 @@
1+(invocation
2+ (object_reference
3+ name: (identifier) @function.method))
14
25[
6+ (keyword_gist)
37 (keyword_btree)
48 (keyword_hash)
5− (keyword_gist)
69 (keyword_spgist)
710 (keyword_gin)
811 (keyword_brin)
9−
10− (cast)
11− (group_concat)
12− (invocation)
12+ (keyword_array)
1313] @function.builtin
14−
15−(table_reference
16− name: (identifier) @namespace)
1714
18−(relation
19− table_alias: (identifier) @variable.parameter)
20−
21−(field
15+(object_reference
2216 name: (identifier) @variable.other.member)
23−
17+
18+(relation
19+ alias: (identifier) @variable.parameter)
20+
2421(field
25− table_alias: (identifier) @variable.parameter
2622 name: (identifier) @variable.other.member)
2723
28−(comment) @comment
24+(term
25+ alias: (identifier) @variable.parameter)
2926
30−[
31− "("
32− ")"
33−] @punctuation.bracket
27+(term
28+ value: (cast
29+ name: (keyword_cast) @function.builtin
30+ parameter: [(literal)]?))
3431
35−[
36− ";"
37− ","
38− "."
39−] @punctuation.delimiter
32+(literal) @string
33+(comment) @comment.line
34+(marginalia) @comment.block
4035
41−(binary_expression
42− operator: _ @operator)
36+((literal) @constant.numeric.integer
37+ (#match? @constant.numeric.integer "^-?\\d+$"))
4338
44−(unary_expression
45− operator: _ @operator)
39+((literal) @constant.numeric.float
40+ (#match? @constant.numeric.float "^-?\\d*\\.\\d*$"))
4641
47−(all_fields) @special
42+(parameter) @variable.parameter
4843
4944[
50− (keyword_null)
51− (keyword_true)
52− (keyword_false)
53−] @constant.builtin
45+ (keyword_true)
46+ (keyword_false)
47+] @constant.builtin.boolean
5448
55−((literal) @constant.numeric
56− (#match? @constant.numeric "^-?\\d*\\.?\\d*$"))
49+[
50+ (keyword_asc)
51+ (keyword_desc)
52+ (keyword_terminated)
53+ (keyword_escaped)
54+ (keyword_unsigned)
55+ (keyword_nulls)
56+ (keyword_last)
57+ (keyword_delimited)
58+ (keyword_replication)
59+ (keyword_auto_increment)
60+ (keyword_default)
61+ (keyword_collate)
62+ (keyword_concurrently)
63+ (keyword_engine)
64+ (keyword_always)
65+ (keyword_generated)
66+ (keyword_preceding)
67+ (keyword_following)
68+ (keyword_first)
69+ (keyword_current_timestamp)
70+ (keyword_immutable)
71+ (keyword_atomic)
72+ (keyword_parallel)
73+ (keyword_leakproof)
74+ (keyword_safe)
75+ (keyword_cost)
76+ (keyword_strict)
77+] @attribute
5778
58−(literal) @string
79+[
80+ (keyword_materialized)
81+ (keyword_recursive)
82+ (keyword_temp)
83+ (keyword_temporary)
84+ (keyword_unlogged)
85+ (keyword_external)
86+ (keyword_parquet)
87+ (keyword_csv)
88+ (keyword_rcfile)
89+ (keyword_textfile)
90+ (keyword_orc)
91+ (keyword_avro)
92+ (keyword_jsonfile)
93+ (keyword_sequencefile)
94+ (keyword_volatile)
95+] @keyword.storage.type
96+
97+[
98+ (keyword_case)
99+ (keyword_when)
100+ (keyword_then)
101+ (keyword_else)
102+] @keyword.control.conditional
59103
60104[
61105 (keyword_select)
106+ (keyword_from)
107+ (keyword_where)
108+ (keyword_index)
109+ (keyword_join)
110+ (keyword_primary)
62111 (keyword_delete)
112+ (keyword_create)
63113 (keyword_insert)
114+ (keyword_merge)
115+ (keyword_distinct)
64116 (keyword_replace)
65117 (keyword_update)
66118 (keyword_into)
67119 (keyword_overwrite)
120+ (keyword_matched)
68121 (keyword_values)
122+ (keyword_value)
123+ (keyword_attribute)
69124 (keyword_set)
70− (keyword_from)
71125 (keyword_left)
72126 (keyword_right)
127+ (keyword_outer)
73128 (keyword_inner)
74129 (keyword_full)
75− (keyword_outer)
76− (keyword_cross)
77− (keyword_join)
78− (keyword_lateral)
79− (keyword_on)
80− (keyword_not)
81130 (keyword_order)
82− (keyword_group)
83131 (keyword_partition)
84− (keyword_by)
132+ (keyword_group)
133+ (keyword_with)
134+ (keyword_without)
135+ (keyword_as)
85136 (keyword_having)
86− (keyword_desc)
87− (keyword_asc)
88137 (keyword_limit)
89138 (keyword_offset)
90− (keyword_primary)
91− (keyword_create)
92− (keyword_alter)
93− (keyword_change)
94− (keyword_analyze)
95− (keyword_modify)
96− (keyword_drop)
97− (keyword_add)
98139 (keyword_table)
99140 (keyword_tables)
100− (keyword_view)
101− (keyword_materialized)
102− (keyword_column)
103141 (keyword_key)
104− (keyword_as)
105− (keyword_distinct)
142+ (keyword_references)
143+ (keyword_foreign)
106144 (keyword_constraint)
107− ; (keyword_cast)
108− ; (keyword_group_concat)
109− (keyword_separator)
110− (keyword_max)
111− (keyword_min)
112− (keyword_avg)
113− (keyword_end)
114145 (keyword_force)
115− (keyword_ignore)
116− (keyword_using)
117146 (keyword_use)
118− (keyword_index)
119147 (keyword_for)
120148 (keyword_if)
121149 (keyword_exists)
122− (keyword_auto_increment)
123− (keyword_generated)
124− (keyword_always)
125− (keyword_collate)
126− (keyword_character)
127− (keyword_engine)
128− (keyword_default)
129− (keyword_cascade)
130− (keyword_restrict)
131− (keyword_with)
150+ (keyword_max)
151+ (keyword_min)
152+ (keyword_avg)
153+ (keyword_column)
154+ (keyword_columns)
155+ (keyword_cross)
156+ (keyword_lateral)
157+ (keyword_natural)
158+ (keyword_alter)
159+ (keyword_drop)
160+ (keyword_add)
161+ (keyword_view)
162+ (keyword_end)
163+ (keyword_is)
164+ (keyword_using)
165+ (keyword_between)
166+ (keyword_window)
132167 (keyword_no)
133168 (keyword_data)
134169 (keyword_type)
@@ -136,208 +171,259 @@
136171 (keyword_to)
137172 (keyword_schema)
138173 (keyword_owner)
139− (keyword_temp)
140− (keyword_temporary)
141− (keyword_unlogged)
142− (keyword_union)
174+ (keyword_authorization)
143175 (keyword_all)
144176 (keyword_any)
145177 (keyword_some)
146− (keyword_except)
147− (keyword_intersect)
148178 (keyword_returning)
149179 (keyword_begin)
150180 (keyword_commit)
151181 (keyword_rollback)
152182 (keyword_transaction)
183+ (keyword_only)
184+ (keyword_like)
185+ (keyword_similar)
153186 (keyword_over)
154− (keyword_nulls)
155− (keyword_first)
187+ (keyword_change)
188+ (keyword_modify)
156189 (keyword_after)
157− (keyword_last)
158− (keyword_window)
190+ (keyword_before)
159191 (keyword_range)
160192 (keyword_rows)
161193 (keyword_groups)
162− (keyword_between)
163− (keyword_unbounded)
164− (keyword_preceding)
165− (keyword_following)
166194 (keyword_exclude)
167195 (keyword_current)
168− (keyword_row)
169196 (keyword_ties)
170197 (keyword_others)
171− (keyword_only)
172− (keyword_unique)
173− (keyword_foreign)
174− (keyword_references)
175− (keyword_concurrently)
176− ; (keyword_btree)
177− ; (keyword_hash)
178− ; (keyword_gist)
179− ; (keyword_spgist)
180− ; (keyword_gin)
181− ; (keyword_brin)
182− (keyword_like)
183− (keyword_similar)
184198 (keyword_preserve)
185− (keyword_unsigned)
186199 (keyword_zerofill)
187− (keyword_conflict)
188− (keyword_do)
189− (keyword_nothing)
190− (keyword_high_priority)
191− (keyword_low_priority)
192− (keyword_delayed)
193− (keyword_recursive)
194− (keyword_cascaded)
195− (keyword_local)
196− (keyword_current_timestamp)
197− (keyword_check)
198− (keyword_option)
200+ (keyword_format)
201+ (keyword_fields)
202+ (keyword_row)
203+ (keyword_sort)
204+ (keyword_compute)
205+ (keyword_comment)
206+ (keyword_location)
207+ (keyword_cached)
208+ (keyword_uncached)
209+ (keyword_lines)
210+ (keyword_stored)
211+ (keyword_virtual)
212+ (keyword_partitioned)
213+ (keyword_analyze)
214+ (keyword_explain)
215+ (keyword_verbose)
216+ (keyword_truncate)
217+ (keyword_rewrite)
218+ (keyword_optimize)
199219 (keyword_vacuum)
200− (keyword_wait)
201− (keyword_nowait)
202−
203− (keyword_trigger)
204− (keyword_function)
205− (keyword_returns)
206− (keyword_return)
207− (keyword_setof)
208− (keyword_atomic)
209− (keyword_declare)
210− ; (keyword_language)
220+ (keyword_cache)
221+ (keyword_language)
211222 (keyword_sql)
223+ (keyword_called)
224+ (keyword_conflict)
225+ (keyword_declare)
226+ (keyword_filter)
227+ (keyword_function)
228+ (keyword_input)
229+ (keyword_name)
230+ (keyword_oid)
231+ (keyword_oids)
232+ (keyword_options)
212233 (keyword_plpgsql)
213− (keyword_immutable)
214− (keyword_stable)
215− (keyword_volatile)
216− (keyword_leakproof)
217− (keyword_parallel)
218− (keyword_safe)
219− (keyword_unsafe)
234+ (keyword_precision)
235+ (keyword_regclass)
236+ (keyword_regnamespace)
237+ (keyword_regproc)
238+ (keyword_regtype)
220239 (keyword_restricted)
221− (keyword_called)
240+ (keyword_return)
222241 (keyword_returns)
223− (keyword_input)
224− (keyword_strict)
225− (keyword_cost)
226− (keyword_rows)
242+ (keyword_separator)
243+ (keyword_setof)
244+ (keyword_stable)
227245 (keyword_support)
228−
229− (keyword_external)
230− (keyword_stored)
231− (keyword_cached)
232− (keyword_uncached)
233− (keyword_replication)
234246 (keyword_tblproperties)
235− (keyword_options)
236− (keyword_compute)
237− (keyword_stats)
238− (keyword_statistics)
239− (keyword_optimize)
240− (keyword_rewrite)
241− (keyword_bin_pack)
242− (keyword_incremental)
243− (keyword_location)
244− (keyword_partitioned)
245− (keyword_comment)
246− (keyword_sort)
247− (keyword_format)
248− (keyword_delimited)
249− (keyword_fields)
250− (keyword_terminated)
251− (keyword_escaped)
252− (keyword_lines)
253− (keyword_cache)
254− (keyword_metadata)
255− (keyword_noscan)
256−
257− (keyword_parquet)
258− (keyword_rcfile)
259− (keyword_csv)
260− (keyword_textfile)
261− (keyword_avro)
262− (keyword_sequencefile)
263− (keyword_orc)
264− (keyword_avro)
265− (keyword_jsonfile)
266−
267− (keyword_precision)
268− (keyword_inet)
247+ (keyword_trigger)
248+ (keyword_unsafe)
249+ (keyword_admin)
250+ (keyword_connection)
251+ (keyword_cycle)
252+ (keyword_database)
253+ (keyword_encrypted)
254+ (keyword_increment)
255+ (keyword_logged)
256+ (keyword_none)
257+ (keyword_owned)
258+ (keyword_password)
259+ (keyword_reset)
260+ (keyword_role)
261+ (keyword_sequence)
262+ (keyword_start)
263+ (keyword_restart)
264+ (keyword_tablespace)
265+ (keyword_until)
266+ (keyword_user)
267+ (keyword_valid)
268+ (keyword_action)
269+ (keyword_definer)
270+ (keyword_invoker)
271+ (keyword_security)
272+ (keyword_extension)
273+ (keyword_version)
274+ (keyword_out)
275+ (keyword_inout)
276+ (keyword_variadic)
277+ (keyword_session)
278+ (keyword_isolation)
279+ (keyword_level)
280+ (keyword_serializable)
281+ (keyword_repeatable)
282+ (keyword_read)
283+ (keyword_write)
284+ (keyword_committed)
285+ (keyword_uncommitted)
286+ (keyword_deferrable)
287+ (keyword_names)
288+ (keyword_zone)
289+ (keyword_immediate)
290+ (keyword_deferred)
291+ (keyword_constraints)
292+ (keyword_snapshot)
293+ (keyword_characteristics)
294+ (keyword_off)
295+ (keyword_follows)
296+ (keyword_precedes)
297+ (keyword_each)
298+ (keyword_instead)
299+ (keyword_of)
300+ (keyword_initially)
301+ (keyword_old)
302+ (keyword_new)
303+ (keyword_referencing)
304+ (keyword_statement)
305+ (keyword_execute)
306+ (keyword_procedure)
269307] @keyword
270308
271309[
272− (keyword_case)
273− (keyword_when)
274− (keyword_then)
275− (keyword_else)
276− (keyword_where)
277−] @keyword.control.conditional
278−
279−[
280− (keyword_in)
281− (keyword_and)
282− (keyword_or)
283− (keyword_is)
284−] @keyword.operator
310+ (keyword_restrict)
311+ (keyword_unbounded)
312+ (keyword_unique)
313+ (keyword_cascade)
314+ (keyword_delayed)
315+ (keyword_high_priority)
316+ (keyword_low_priority)
317+ (keyword_ignore)
318+ (keyword_nothing)
319+ (keyword_check)
320+ (keyword_option)
321+ (keyword_local)
322+ (keyword_cascaded)
323+ (keyword_wait)
324+ (keyword_nowait)
325+ (keyword_metadata)
326+ (keyword_incremental)
327+ (keyword_bin_pack)
328+ (keyword_noscan)
329+ (keyword_stats)
330+ (keyword_statistics)
331+ (keyword_maxvalue)
332+ (keyword_minvalue)
333+] @keyword
285334
286335[
336+ (keyword_int)
337+ (keyword_null)
287338 (keyword_boolean)
288− (bit)
289339 (keyword_binary)
290−
340+ (keyword_varbinary)
341+ (keyword_image)
342+ (keyword_bit)
343+ (keyword_inet)
344+ (keyword_character)
291345 (keyword_smallserial)
292346 (keyword_serial)
293347 (keyword_bigserial)
294−
295− (tinyint)
296− (smallint)
297− (mediumint)
298− (int)
299− (bigint)
300− (decimal)
301− (numeric)
348+ (keyword_smallint)
349+ (keyword_mediumint)
350+ (keyword_bigint)
351+ (keyword_tinyint)
352+ (keyword_decimal)
353+ (keyword_float)
354+ (keyword_double)
355+ (keyword_numeric)
302356 (keyword_real)
303357 (double)
304− (float)
305−
306358 (keyword_money)
307−
308− (char)
309− (varchar)
310− (numeric)
311− (keyword_string)
359+ (keyword_smallmoney)
360+ (keyword_char)
361+ (keyword_nchar)
362+ (keyword_varchar)
363+ (keyword_nvarchar)
364+ (keyword_varying)
312365 (keyword_text)
313−
366+ (keyword_string)
314367 (keyword_uuid)
315−
316368 (keyword_json)
317369 (keyword_jsonb)
318370 (keyword_xml)
319−
320371 (keyword_bytea)
321− (keyword_inet)
322−
323− (enum)
324−
372+ (keyword_enum)
325373 (keyword_date)
326374 (keyword_datetime)
375+ (keyword_time)
376+ (keyword_datetime2)
377+ (keyword_datetimeoffset)
378+ (keyword_smalldatetime)
327379 (keyword_timestamp)
328380 (keyword_timestamptz)
329−
330− (keyword_interval)
331−
332381 (keyword_geometry)
333382 (keyword_geography)
334383 (keyword_box2d)
335384 (keyword_box3d)
336−
337− (keyword_oid)
338− (keyword_name)
339− (keyword_regclass)
340− (keyword_regnamespace)
341− (keyword_regproc)
342− (keyword_regtype)
385+ (keyword_interval)
343386] @type.builtin
387+
388+[
389+ (keyword_in)
390+ (keyword_and)
391+ (keyword_or)
392+ (keyword_not)
393+ (keyword_by)
394+ (keyword_on)
395+ (keyword_do)
396+ (keyword_union)
397+ (keyword_except)
398+ (keyword_intersect)
399+] @keyword.operator
400+
401+[
402+ "+"
403+ "-"
404+ "*"
405+ "/"
406+ "%"
407+ "^"
408+ ":="
409+ "="
410+ "<"
411+ "<="
412+ "!="
413+ ">="
414+ ">"
415+ "<>"
416+ (op_other)
417+ (op_unary_other)
418+] @operator
419+
420+[
421+ "("
422+ ")"
423+] @punctuation.bracket
424+
425+[
426+ ";"
427+ ","
428+ "."
429+] @punctuation.delimiter
runtime/queries/strace/highlights.scmnew file+8
@@ -0,0 +1,8 @@
1+(syscall) @function
2+(integer) @constant.numeric
3+(pointer) @constant.numeric
4+(value) @label
5+(string) @string
6+(comment) @comment
7+(errorName) @error
8+(errorDescription) @error
runtime/queries/templ/highlights.scmnew file+99
@@ -0,0 +1,99 @@
1+(package_identifier) @namespace
2+
3+(parameter_declaration (identifier) @variable.parameter)
4+(variadic_parameter_declaration (identifier) @variable.parameter)
5+
6+(function_declaration
7+ name: (identifier) @function)
8+
9+(type_spec name: (type_identifier) @type)
10+(type_identifier) @type
11+(field_identifier) @variable.other.member
12+(identifier) @variable
13+
14+; Function calls
15+
16+(call_expression
17+ function: (identifier) @function)
18+
19+(call_expression
20+ function: (selector_expression
21+ field: (field_identifier) @function))
22+
23+;
24+; These are Templ specific
25+;
26+
27+(component_declaration
28+ name: (component_identifier) @function)
29+
30+(tag_start) @tag
31+(tag_end) @tag
32+(self_closing_tag) @tag
33+(style_element) @tag
34+
35+(attribute
36+ name: (attribute_name) @attribute)
37+(attribute
38+ value: (quoted_attribute_value) @string)
39+
40+(element_text) @string.special
41+(style_element_text) @string.special
42+
43+(css_property
44+ name: (css_property_name) @attribute)
45+
46+(expression) @function.method
47+(dynamic_class_attribute_value) @function.method
48+
49+(component_import
50+ name: (component_identifier) @function)
51+
52+(component_render) @function
53+
54+[
55+ "@"
56+] @operator
57+
58+[
59+ "func"
60+ "var"
61+ "const"
62+ "templ"
63+ "css"
64+ "type"
65+ "struct"
66+ "range"
67+ "script"
68+] @keyword.storage.type
69+
70+[
71+ "return"
72+] @keyword.control.return
73+
74+[
75+ "import"
76+ "package"
77+] @keyword.control.import
78+
79+[
80+ "else"
81+ "case"
82+ "switch"
83+ "if"
84+ "default"
85+] @keyword.control.conditional
86+
87+"for" @keyword.control.repeat
88+
89+[
90+ (interpreted_string_literal)
91+ (raw_string_literal)
92+ (rune_literal)
93+] @string
94+
95+; Comments
96+
97+(comment) @comment
98+
99+(element_comment) @comment
runtime/queries/templ/injections.scmnew file+4
@@ -0,0 +1,4 @@
1+((script_block_text) @injection.content (#set! injection.language "javascript"))
2+((script_element_text) @injection.content (#set! injection.language "javascript"))
3+
4+((style_element_text) @injection.content (#set! injection.language "css"))
runtime/queries/todotxt/highlights.scmnew file+6
@@ -0,0 +1,6 @@
1+(done_task) @comment
2+(task (priority) @keyword)
3+(task (date) @comment)
4+(task (kv) @comment)
5+(task (project) @string)
6+(task (context) @type)
runtime/queries/typst/highlights.scmnew file+77
@@ -0,0 +1,77 @@
1+(call
2+ item: (ident) @function)
3+(call
4+ item: (field field: (ident) @function.method))
5+(tagged field: (ident) @tag)
6+(field field: (ident) @tag)
7+(comment) @comment
8+
9+; CONTROL
10+(let "let" @keyword.storage.type)
11+(branch ["if" "else"] @keyword.control.conditional)
12+(while "while" @keyword.control.repeat)
13+(for ["for" "in"] @keyword.control.repeat)
14+(import "import" @keyword.control.import)
15+(as "as" @keyword.operator)
16+(include "include" @keyword.control.import)
17+(show "show" @keyword.control)
18+(set "set" @keyword.control)
19+(return "return" @keyword.control)
20+(flow ["break" "continue"] @keyword.control)
21+
22+; OPERATOR
23+(in ["in" "not"] @keyword.operator)
24+(and "and" @keyword.operator)
25+(or "or" @keyword.operator)
26+(not "not" @keyword.operator)
27+(sign ["+" "-"] @operator)
28+(add "+" @operator)
29+(sub "-" @operator)
30+(mul "*" @operator)
31+(div "/" @operator)
32+(cmp ["==" "<=" ">=" "!=" "<" ">"] @operator)
33+(fraction "/" @operator)
34+(fac "!" @operator)
35+(attach ["^" "_"] @operator)
36+(wildcard) @operator
37+
38+; VALUE
39+(raw_blck "```" @operator) @markup.raw.block
40+(raw_span "`" @operator) @markup.raw.block
41+(raw_blck lang: (ident) @tag)
42+(label) @tag
43+(ref) @tag
44+(number) @constant.numeric
45+(string) @string
46+(content ["[" "]"] @operator)
47+(bool) @constant.builtin.boolean
48+(builtin) @constant.builtin
49+(none) @constant.builtin
50+(auto) @constant.builtin
51+(ident) @variable
52+(call
53+ item: (builtin) @function.builtin)
54+
55+; MARKUP
56+(item "-" @markup.list)
57+(term ["/" ":"] @markup.list)
58+(heading ["=" "==" "===" "====" "====="] @markup.heading.marker) @markup.heading
59+(url) @tag
60+(emph) @markup.italic
61+(strong) @markup.bold
62+(symbol) @constant.character
63+(shorthand) @constant.builtin
64+(quote) @markup.quote
65+(align) @operator
66+(letter) @constant.character
67+(linebreak) @constant.builtin
68+
69+(math "$" @operator)
70+"#" @operator
71+"end" @operator
72+
73+(escape) @constant.character.escape
74+["(" ")" "{" "}"] @punctuation.bracket
75+["," ";" ".." ":" "sep"] @punctuation.delimiter
76+"assign" @punctuation
77+(field "." @punctuation)
runtime/queries/typst/injections.scmnew file+6
@@ -0,0 +1,6 @@
1+(raw_blck
2+ (blob) @injection.shebang @injection.content)
3+
4+(raw_blck
5+ lang: (ident) @injection.language
6+ (blob) @injection.content)
runtime/queries/unison/highlights.scm+21−6
@@ -10,14 +10,18 @@
1010[
1111 (kw_forall)
1212 (unique_kw)
13+ (structural_kw)
1314 (type_kw)
1415 (kw_equals)
1516 (do)
17+ (ability)
18+ (where)
1619] @keyword
1720
1821(kw_let) @keyword.function
1922(type_kw) @keyword.storage.type
2023(unique) @keyword.storage.modifier
24+(structural) @keyword.storage.modifier
2125("use") @keyword.control.import
2226
2327
@@ -31,6 +35,7 @@
3135 (arrow_symbol)
3236 (">")
3337 (or)
38+ (and)
3439 (bang)
3540] @operator
3641
@@ -47,13 +52,22 @@
4752
4853;; Types
4954(record_field name: (wordy_id) @variable.other.member type: (wordy_id) @type)
50−[
51− (type_name)
52− (type_signature)
53− (effect)
54−] @type
55+(type_constructor (type_name (wordy_id) @constructor))
56+(ability_declaration type_name: (wordy_id) @type type_arg: (wordy_id) @variable.parameter)
57+(effect (wordy_id) @special) ;; NOTE: an effect is just like a type, but in signature we special case it
58+
59+;; Namespaces
60+(path) @namespace
61+(namespace) @namespace
62+
63+;; Terms
64+(type_signature term_name: (path)? @variable term_name: (wordy_id) @variable)
65+(type_signature (wordy_id) @type)
66+(type_signature (delayed (wordy_id)) @type)
67+
68+(term_definition param: (wordy_id) @variable.parameter)
5569
56−(term_definition) @variable
70+(function_application function_name: (path)? function_name: (wordy_id) @function)
5771
5872;; Punctuation
5973[
@@ -70,3 +84,4 @@
7084 "]"
7185] @punctuation.bracket
7286
87+(test_watch_expression (wordy_id) @keyword.directive)
runtime/queries/yaml/indents.scm+35−1
@@ -1,2 +1,36 @@
1−(block_mapping_pair) @indent
1+(block_scalar) @indent @extend
22
3+; indent sequence items only if they span more than one line, e.g.
4+;
5+; - foo:
6+; bar: baz
7+; - quux:
8+; bar: baz
9+;
10+; but not
11+;
12+; - foo
13+; - bar
14+; - baz
15+((block_sequence_item) @item @indent.always @extend
16+ (#not-one-line? @item))
17+
18+; map pair where without a key
19+;
20+; foo:
21+((block_mapping_pair
22+ key: (_) @key
23+ !value
24+ ) @indent.always @extend
25+)
26+
27+; map pair where the key and value are on different lines
28+;
29+; foo:
30+; bar: baz
31+((block_mapping_pair
32+ key: (_) @key
33+ value: (_) @val
34+ (#not-same-line? @key @val)
35+ ) @indent.always @extend
36+)
runtime/queries/yaml/injections.scm+52
@@ -1,2 +1,54 @@
11((comment) @injection.content
22 (#set! injection.language "comment"))
3+
4+; The remaining code in this file incorporates work covered by the following
5+; copyright and permission notice:
6+;
7+; Copyright 2023 the nvim-treesitter authors
8+;
9+; Licensed under the Apache License, Version 2.0 (the "License");
10+; you may not use this file except in compliance with the License.
11+; You may obtain a copy of the License at
12+;
13+; http://www.apache.org/licenses/LICENSE-2.0
14+;
15+; Unless required by applicable law or agreed to in writing, software
16+; distributed under the License is distributed on an "AS IS" BASIS,
17+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+; See the License for the specific language governing permissions and
19+; limitations under the License.
20+
21+; Modified for Helix from https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/yaml/injections.scm
22+
23+;; Github actions ("run") / Gitlab CI ("scripts")
24+(block_mapping_pair
25+ key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$")
26+ value: (flow_node
27+ (plain_scalar
28+ (string_scalar) @injection.content)
29+ (#set! injection.language "bash")))
30+
31+(block_mapping_pair
32+ key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$")
33+ value: (block_node
34+ (block_scalar) @injection.content
35+ (#set! injection.language "bash")))
36+
37+(block_mapping_pair
38+ key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$")
39+ value: (block_node
40+ (block_sequence
41+ (block_sequence_item
42+ (flow_node
43+ (plain_scalar
44+ (string_scalar) @injection.content))
45+ (#set! injection.language "bash")))))
46+
47+(block_mapping_pair
48+ key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$")
49+ value: (block_node
50+ (block_sequence
51+ (block_sequence_item
52+ (block_node
53+ (block_scalar) @injection.content
54+ (#set! injection.language "bash"))))))
runtime/queries/yuck/highlights.scm+1−1
@@ -101,7 +101,7 @@
101101(list
102102 (symbol) @tag)
103103
104−; Other stuff that has not been catched by the previous queries yet
104+; Other stuff that has not been caught by the previous queries yet
105105
106106(ident) @variable
107107(index) @variable
runtime/themes/README.md+8
@@ -6,4 +6,12 @@ If you submit a theme, please include a comment at the top with your name and em
66# Author : Name <email@my.domain>
77```
88
9+If you are submitting a theme that is already published somewhere, then please
10+add the corresponding license file for it under `licenses/` with the following
11+name `theme_name.license` and add a comment at the top of the theme file:
12+
13+```toml
14+# License: <License specification>
15+```
16+
917We have a preview page for themes on our [wiki](https://github.com/helix-editor/helix/wiki/Themes)!
runtime/themes/autumn.toml+62−65
@@ -7,81 +7,79 @@
77# Jens Getreu ported and optimised the color theme for the Helix editor.
88# Author: Jens Getreu <getreu at web.de>
99
10+"attribute" = "my_turquoise1"
11+"comment" = { fg = "my_gray5" }
12+"constant.character.escape" = "my_turquoise1"
13+"constant" = "my_white3"
14+"constant.numeric" = "my_turquoise1"
15+"constructor" = "my_yellow1"
16+"debug" = "my_yellow2"
17+"diagnostic.error" = { underline = { style = "curl", color = "my_red" } }
18+"diagnostic.hint" = { underline = { style = "line", color = "my_gray5" }, bg = "my_black"}
19+"diagnostic.info" = { underline = { style = "line" } }
20+"diagnostic" = { underline = { style = "line", color = "my_gray5" }, bg = "my_black"}
21+"diagnostic.warning" = { underline = { style = "curl", color = "my_yellow2" } }
22+"diff.delta" = "my_gray5"
23+"diff.minus" = "my_red"
24+"diff.plus" = "my_green"
25+"error" = "my_red"
26+"function" = "my_yellow1"
27+"hint" = "my_gray6"
28+"info" = "my_yellow2"
29+"keyword" = "my_red"
30+"label" = "my_red"
31+"markup.bold" = { modifiers = ["bold"] }
32+"markup.heading" = "my_yellow1"
33+"markup.italic" = { modifiers = ["italic"] }
34+"markup.link.text" = "my_white2"
35+"markup.link.url" = "my_turquoise2"
36+"markup.list" = "my_white2"
37+"markup.quote" = "my_brown"
38+"markup.raw" = "my_green"
39+"markup.strikethrough" = { modifiers = ["crossed_out"] }
40+"namespace" = "my_white3"
41+"operator" = "my_white1"
42+"special" = "my_yellow1"
43+"string" = "my_green"
44+"type" = { fg = "my_white3", modifiers = ["italic"] }
1045"ui.background" = { bg = "my_gray0" }
11−"ui.menu" = { fg = "my_white", bg = "my_gray2" }
12−"ui.menu.selected" = { fg = "my_gray2", bg = "my_gray6" }
46+"ui.cursor" = { bg = "my_white4", fg = "my_black" }
47+"ui.cursorline" = { bg = "my_gray3" }
48+"ui.cursorline.primary" = { bg = "my_black" }
49+"ui.cursorline.secondary" = { bg = "my_black" }
50+"ui.cursor.match" = { fg = "my_white1", modifiers = ["bold"], underline = { style = "double_line", color = "my_white1" }, bg = "my_black"}
51+"ui.cursor.primary" = { fg = "my_white1", modifiers = ["reversed"] }
52+"ui.debug" = { fg = "my_yellow1", bg = "my_gray0" }
53+"ui.gutter" = { bg = "my_gray0" }
54+"ui.help" = { fg = "my_gray7", bg = "my_gray2" }
55+"ui.highlight.frameline" = { bg = "#8b6904" }
1356"ui.linenr" = { fg = "my_gray3", bg = "my_gray0" }
14−"ui.popup" = { bg = "my_gray2" }
15−"ui.window" = { fg = "my_gray3", bg = "my_gray2" }
1657"ui.linenr.selected" = { fg = "my_gray7", bg = "my_gray0"}
58+"ui.menu" = { fg = "my_white1", bg = "my_gray2" }
59+"ui.menu.selected" = { fg = "my_gray2", bg = "my_gray6" }
60+"ui.popup" = { bg = "my_gray2" }
1761"ui.selection" = { bg = "my_gray3" }
18−"comment" = { fg = "my_gray5", modifiers = ["italic"] }
19−"ui.cursorline" = { bg = "my_gray3" }
2062"ui.statusline" = { fg = "my_gray7", bg = "my_gray2" }
2163"ui.statusline.inactive" = { fg = 'my_gray5', bg = 'my_gray2' }
2264"ui.statusline.insert" = {fg = "my_black", bg = "my_gray6", modifiers = ["bold"]}
2365"ui.statusline.normal" = {fg = "my_gray7", bg = "my_gray2"}
2466"ui.statusline.select" = {fg = "my_gray7", bg = "my_black", modifiers = ["bold"]}
25−"ui.cursor" = { bg = "my_white4", fg = "my_black" }
26−"ui.cursor.primary" = { fg = "my_white", modifiers = ["reversed"] }
27−"ui.cursor.match" = { fg = "my_white", modifiers = ["bold"], underline = { style = "double_line", color = "my_white" }, bg = "my_black"}
28−"ui.cursorline.primary" = { bg = "my_black" }
29−"ui.cursorline.secondary" = { bg = "my_black" }
30−"ui.highlight.frameline" = { bg = "#8b6904" }
31−"ui.debug" = { fg = "my_yellow1", bg = "my_gray0" }
32−"ui.text" = "my_white"
33−"operator" = "my_white"
34−"ui.text.focus" = "my_white"
35−"variable" = "my_white3"
36−"constant.numeric" = "my_turquoise"
37−"constant" = "my_white3"
38−"attribute" = "my_turquoise"
39−"type" = { fg = "my_white3", modifiers = ["italic"] }
40−"string" = "my_green"
41−"variable.other.member" = "my_brown"
42−"constant.character.escape" = "my_turquoise"
43−"function" = "my_yellow1"
44−"constructor" = "my_yellow1"
45−"special" = "my_yellow1"
46−"keyword" = "my_red"
47−"label" = "my_red"
48−"namespace" = "my_white3"
49−"ui.help" = { fg = "my_gray7", bg = "my_gray2" }
50−"ui.virtual.wrap" = "my_gray4"
51−"ui.virtual.whitespace" = { fg = "my_gray6" }
52−"ui.virtual.ruler" = { bg = "my_gray1" }
67+"ui.text.focus" = "my_white1"
68+"ui.text" = "my_white1"
5369"ui.virtual.inlay-hint" = { fg = "my_gray4", bg="my_black", modifiers = ["normal"] }
5470"ui.virtual.inlay-hint.parameter" = { fg = "my_gray4", modifiers = ["normal"] }
5571"ui.virtual.inlay-hint.type" = { fg = "my_gray4", modifiers = ["italic"] }
56−
57−"markup.heading" = "my_yellow1"
58−"markup.list" = "my_white2"
59−"markup.bold" = { modifiers = ["bold"] }
60−"markup.italic" = { modifiers = ["italic"] }
61−"markup.strikethrough" = { modifiers = ["crossed_out"] }
62−"markup.link.url" = "my_turquoise2"
63−"markup.link.text" = "my_white2"
64−"markup.quote" = "my_brown"
65−"markup.raw" = "my_green"
66−
67−"diff.plus" = "my_green"
68−"diff.delta" = "my_gray5"
69−"diff.minus" = "my_red"
70−
71−"diagnostic" = { underline = { style = "line", color = "my_gray5" }, bg = "my_black"}
72−"diagnostic.hint" = { underline = { style = "line", color = "my_gray5" }, bg = "my_black"}
73−"diagnostic.info" = { underline = { style = "line" } }
74−"diagnostic.warning" = { underline = { style = "curl", color = "my_yellow2" } }
75−"diagnostic.error" = { underline = { style = "curl", color = "my_red" } }
76−"ui.gutter" = { bg = "my_gray0" }
77−"hint" = "my_gray6"
78−"debug" = "my_yellow2"
79−"info" = "my_yellow2"
72+"ui.virtual.ruler" = { bg = "my_gray1" }
73+"ui.virtual.whitespace" = { fg = "my_gray6" }
74+"ui.virtual.wrap" = "my_gray4"
75+"ui.window" = { fg = "my_gray3", bg = "my_gray2" }
76+"variable" = "my_white3"
77+"variable.other.member" = "my_brown"
8078"warning" = "my_yellow2"
81−"error" = "my_red"
8279
8380[palette]
8481my_black = "#212121" # Cursorline
82+my_brown = "#cfba8b" # Member variables, Quotes
8583my_gray0 = "#232323" # Default Background
8684my_gray1 = "#2b2b2b" # Ruler
8785my_gray2 = "#323232" # Lighter Background (Used for status bars, line number and folding marks)
@@ -91,14 +89,13 @@ my_gray5 = "#646f69" # Comments, Invisibles, Line Highlighting
9189my_gray6 = "#a8a8a8" # Dark Foreground (Used for status bars)
9290my_gray7 = "#c8c8c8" # Light Foreground
9391my_gray8 = "#e8e8e8" # Light Background
94−my_white = "#F3F2CC" # Default Foreground, Caret, Delimiters, Operators
92+my_green = "#99be70" # Strings, Inherited Class, Markup Code, Diff Inserted
93+my_red = "#F05E48" # Keywords, Storage, Selector, Diff Changed
94+my_turquoise1 = "#86c1b9" # Support, Regular Expressions, Escape Characters
95+my_turquoise2 = "#72a59e" # URL
96+my_white1 = "#F3F2CC" # Default Foreground, Caret, Delimiters, Operators
9597my_white2 = "#F3F2CC" # Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
9698my_white3 = "#F3F2CC" # Classes, Markup Bold, Search Text Background
9799my_white4 = "#7e7d6a" # Cursor match
98−my_turquoise = "#86c1b9" # Support, Regular Expressions, Escape Characters
99−my_turquoise2 = "#72a59e" # URL
100−my_green = "#99be70" # Strings, Inherited Class, Markup Code, Diff Inserted
101−my_brown = "#cfba8b" # Member variables, Quotes
102100my_yellow1 = "#FAD566" # Functions, Methods, Attribute IDs, Headings
103101my_yellow2 = "#ffff9f" # Debug, Info
104−my_red = "#F05E48" # Keywords, Storage, Selector, Diff Changed
runtime/themes/autumn_night.toml+6−6
@@ -11,6 +11,7 @@ inherits = "autumn"
1111
1212[palette]
1313my_black = "#111111" # Cursorline
14+my_brown = "#cfba8b" # Member variables, Quotes
1415my_gray0 = "#090909" # Default Background
1516my_gray1 = "#0e0e0e" # Ruler
1617my_gray2 = "#1a1a1a" # Lighter Background (Used for status bars, line number and folding marks)
@@ -20,14 +21,13 @@ my_gray5 = "#626C66" # Comments, Invisibles, Line Highlighting
2021my_gray6 = "#aaaaaa" # Dark Foreground (Used for status bars)
2122my_gray7 = "#c4c4c4" # Light Foreground
2223my_gray8 = "#e8e8e8" # Light Background
23−my_white = "#F3F2CC" # Default Foreground, Caret, Delimiters, Operators
24+my_green = "#99be70" # Strings, Inherited Class, Markup Code, Diff Inserted
25+my_red = "#F05E48" # Keywords, Storage, Selector, Diff Changed
26+my_turquoise1 = "#86c1b9" # Support, Regular Expressions, Escape Characters
27+my_turquoise2 = "#72a59e" # URL
28+my_white1 = "#F3F2CC" # Default Foreground, Caret, Delimiters, Operators
2429my_white2 = "#F3F2CC" # Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
2530my_white3 = "#F3F2CC" # Classes, Markup Bold, Search Text Background
2631my_white4 = "#7e7d6a" # Secondary cursors
27−my_turquoise = "#86c1b9" # Support, Regular Expressions, Escape Characters
28−my_turquoise2 = "#72a59e" # URL
29−my_green = "#99be70" # Strings, Inherited Class, Markup Code, Diff Inserted
30−my_brown = "#cfba8b" # Member variables, Quotes
3132my_yellow1 = "#FAD566" # Functions, Methods, Attribute IDs, Headings
3233my_yellow2 = "#ffff9f" # Debug, Info
33−my_red = "#F05E48" # Keywords, Storage, Selector, Diff Changed
runtime/themes/catppuccin_frappe.toml+2
@@ -34,3 +34,5 @@ crust = "#232634"
3434# derived colors by blending existing palette colors
3535cursorline = "#3b3f52"
3636secondary_cursor = "#b8a5a6"
37+secondary_cursor_normal = "#9193be"
38+secondary_cursor_insert = "#83a275"
runtime/themes/catppuccin_latte.toml+2
@@ -34,3 +34,5 @@ crust = "#dce0e8"
3434# derived colors by blending existing palette colors
3535cursorline = "#e9ebf1"
3636secondary_cursor = "#e2a99e"
37+secondary_cursor_normal = "#98a7fb"
38+secondary_cursor_insert = "#75b868"
runtime/themes/catppuccin_macchiato.toml+2
@@ -34,3 +34,5 @@ crust = "#181926"
3434# derived colors by blending existing palette colors
3535cursorline = "#303347"
3636secondary_cursor = "#b6a5a7"
37+secondary_cursor_normal = "#8b90bf"
38+secondary_cursor_insert = "#7fa47a"
runtime/themes/catppuccin_mocha.toml+11
@@ -83,6 +83,7 @@
8383
8484"ui.text" = "text"
8585"ui.text.focus" = { fg = "text", bg = "surface0", modifiers = ["bold"] }
86+"ui.text.inactive" = { fg = "overlay1" }
8687
8788"ui.virtual" = "overlay0"
8889"ui.virtual.ruler" = { bg = "surface0" }
@@ -95,6 +96,14 @@
9596"ui.cursor.primary" = { fg = "base", bg = "rosewater" }
9697"ui.cursor.match" = { fg = "peach", modifiers = ["bold"] }
9798
99+"ui.cursor.primary.normal" = { fg = "base", bg = "lavender" }
100+"ui.cursor.primary.insert" = { fg = "base", bg = "green" }
101+"ui.cursor.primary.select" = { fg = "base", bg = "flamingo" }
102+
103+"ui.cursor.normal" = { fg = "base", bg = "secondary_cursor_normal" }
104+"ui.cursor.insert" = { fg = "base", bg = "secondary_cursor_insert" }
105+"ui.cursor.select" = { fg = "base", bg = "secondary_cursor" }
106+
98107"ui.cursorline.primary" = { bg = "cursorline" }
99108
100109"ui.highlight" = { bg = "surface1", modifiers = ["bold"] }
@@ -146,3 +155,5 @@ crust = "#11111b"
146155# derived colors by blending existing palette colors
147156cursorline = "#2a2b3c"
148157secondary_cursor = "#b5a6a8"
158+secondary_cursor_normal = "#878ec0"
159+secondary_cursor_insert = "#7da87e"
runtime/themes/cyan_light.tomlnew file+154

This diff is too big to show here.

runtime/themes/darcula-solid.toml+1−4

This diff is too big to show here.

runtime/themes/darcula.toml+10−4

This diff is too big to show here.

runtime/themes/dracula.toml+2

This diff is too big to show here.

runtime/themes/everblush.toml+1

This diff is too big to show here.

runtime/themes/gruber-darker.tomlnew file+114

This diff is too big to show here.

runtime/themes/horizon-dark.tomlnew file+80

This diff is too big to show here.

runtime/themes/jellybeans.toml+1−1

This diff is too big to show here.

runtime/themes/licenses/everforest.LICENSEnew file+21

This diff is too big to show here.

runtime/themes/licenses/modus_vivendi.LICENSEnew file+5

This diff is too big to show here.

runtime/themes/licenses/modus_vivendi_deuteranopia.LICENSEnew file+5

This diff is too big to show here.

runtime/themes/licenses/modus_vivendi_tinted.LICENSEnew file+5

This diff is too big to show here.

runtime/themes/licenses/modus_vivendi_tritanopia.LICENSEnew file+5

This diff is too big to show here.

runtime/themes/licenses/poimandres.LICENSEnew file+21

This diff is too big to show here.

runtime/themes/licenses/serika-syntax.LICENSEnew file+21

This diff is too big to show here.

runtime/themes/licenses/sonokai.LICENSEnew file+21

This diff is too big to show here.

runtime/themes/licenses/starlight.LICENSEnew file+24

This diff is too big to show here.

runtime/themes/material_darker.tomlnew file+20

This diff is too big to show here.

runtime/themes/material_deep_ocean.tomlnew file+123

This diff is too big to show here.

runtime/themes/material_oceanic.tomlnew file+21

This diff is too big to show here.

runtime/themes/material_palenight.tomlnew file+19

This diff is too big to show here.

runtime/themes/modus_operandi.tomlnew file+194

This diff is too big to show here.

runtime/themes/modus_operandi_deuteranopia.tomlnew file+46

This diff is too big to show here.

runtime/themes/modus_operandi_tinted.tomlnew file+45

This diff is too big to show here.

runtime/themes/modus_operandi_tritanopia.tomlnew file+73

This diff is too big to show here.

runtime/themes/modus_vivendi.tomlnew file+242

This diff is too big to show here.

runtime/themes/modus_vivendi_deuteranopia.tomlnew file+158

This diff is too big to show here.

runtime/themes/modus_vivendi_tinted.tomlnew file+144

This diff is too big to show here.

runtime/themes/modus_vivendi_tritanopia.tomlnew file+186

This diff is too big to show here.

runtime/themes/molokai.toml+1−1

This diff is too big to show here.

runtime/themes/monokai.toml+5

This diff is too big to show here.

runtime/themes/naysayer.toml+2−2

This diff is too big to show here.

runtime/themes/nightfox.toml+2−2

This diff is too big to show here.

runtime/themes/noctis.toml+26−26

This diff is too big to show here.

runtime/themes/nord-night.tomlnew file+23

This diff is too big to show here.

runtime/themes/nord.toml+23−13

This diff is too big to show here.

runtime/themes/onedark.toml+1

This diff is too big to show here.

runtime/themes/papercolor-dark.toml+67−116

This diff is too big to show here.

runtime/themes/papercolor-light.toml+194−103

This diff is too big to show here.

runtime/themes/poimandres.tomlnew file+113

This diff is too big to show here.

runtime/themes/poimandres_storm.tomlnew file+19

This diff is too big to show here.

runtime/themes/rose_pine.toml+31−29

This diff is too big to show here.

runtime/themes/starlight.tomlnew file+113

This diff is too big to show here.

runtime/themes/yellowed.tomlnew file+135

This diff is too big to show here.

runtime/themes/zenburn.toml+1−1

This diff is too big to show here.

runtime/tutor+157−3

This diff is too big to show here.

rust-toolchain.toml+2−2

This diff is too big to show here.

xtask/Cargo.toml+12−6

This diff is too big to show here.