From 20ed8c259519f1e37cf6c2a37479bdd681e9b924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 5 Sep 2022 10:50:32 +0900 Subject: [PATCH 01/64] tree-sitter-solidity: Use upstream, update queries --- languages.toml | 2 +- runtime/queries/solidity/highlights.scm | 134 +++++++++++++++--------- runtime/queries/solidity/locals.scm | 9 ++ 3 files changed, 92 insertions(+), 53 deletions(-) create mode 100644 runtime/queries/solidity/locals.scm diff --git a/languages.toml b/languages.toml index 06921534..b19fde6a 100644 --- a/languages.toml +++ b/languages.toml @@ -1192,7 +1192,7 @@ language-server = { command = "solc", args = ["--lsp"] } [[grammar]] name = "solidity" -source = { git = "https://github.com/slinlee/tree-sitter-solidity", rev = "f3a002274744e859bf64cf3524985f8c31ea84fd" } +source = { git = "https://github.com/JoranHonig/tree-sitter-solidity", rev = "9004b86531cb424bd379424cf7266a4585f2af7d" } [[language]] name = "gleam" diff --git a/runtime/queries/solidity/highlights.scm b/runtime/queries/solidity/highlights.scm index 544cf3d9..08178c36 100644 --- a/runtime/queries/solidity/highlights.scm +++ b/runtime/queries/solidity/highlights.scm @@ -1,15 +1,16 @@ -(comment) @comment +; identifiers +; ----------- +(identifier) @variable +(yul_identifier) @variable ; Pragma (pragma_directive) @tag -(solidity_version_comparison_operator ">=" @tag) -(solidity_version_comparison_operator "<=" @tag) -(solidity_version_comparison_operator "=" @tag) -(solidity_version_comparison_operator "~" @tag) -(solidity_version_comparison_operator "^" @tag) +(solidity_version_comparison_operator _ @tag) ; Literals +; -------- + [ (string) (hex_string_literal) @@ -26,26 +27,38 @@ (false) ] @constant.builtin +(comment) @comment + + +; Definitions and references +; ----------- -; Type (type_name) @type (primitive_type) @type -(struct_declaration struct_name: (identifier) @type) -(enum_declaration enum_type_name: (identifier) @type) +(user_defined_type (identifier) @type) + ; Color payable in payable address conversion as type and not as keyword (payable_conversion_expression "payable" @type) -(emit_statement . (identifier) @type) -; Handles ContractA, ContractB in function foo() override(ContractA, contractB) {} -(override_specifier (identifier) @type) ; Ensures that delimiters in mapping( ... => .. ) are not colored like types (type_name "(" @punctuation.bracket "=>" @punctuation.delimiter ")" @punctuation.bracket) - - -; Functions and parameters +; Definitions +(struct_declaration + name: (identifier) @type) +(enum_declaration + name: (identifier) @type) +(contract_declaration + name: (identifier) @type) +(library_declaration + name: (identifier) @type) +(interface_declaration + name: (identifier) @type) +(event_definition + name: (identifier) @type) (function_definition - function_name: (identifier) @function) + name: (identifier) @function) + (modifier_definition name: (identifier) @function) (yul_evm_builtin) @function.builtin @@ -55,37 +68,38 @@ (fallback_receive_definition "receive" @constructor) (fallback_receive_definition "fallback" @constructor) -(modifier_invocation (identifier) @function) +(struct_member name: (identifier) @variable.other.member) +(enum_value) @constant -; Handles expressions like structVariable.g(); -(call_expression . (member_expression (property_identifier) @function.method)) +; Invocations +(emit_statement . (identifier) @type) +(modifier_invocation (identifier) @function) -; Handles expressions like g(); +(call_expression . (member_expression property: (identifier) @function.method)) (call_expression . (identifier) @function) ; Function parameters -(event_paramater name: (identifier) @variable.parameter) ; TODO fix spelling once fixed upstream -(function_definition - function_name: (identifier) @variable.parameter) +(call_struct_argument name: (identifier) @field) +(event_paramater name: (identifier) @variable.parameter) +(parameter name: (identifier) @variable.parameter) ; Yul functions (yul_function_call function: (yul_identifier) @function) - -; Yul function parameters (yul_function_definition . (yul_identifier) @function (yul_identifier) @variable.parameter) -(meta_type_expression "type" @keyword) -(member_expression (property_identifier) @variable.other.member) -(property_identifier) @variable.other.member -(struct_expression ((identifier) @variable.other.member . ":")) -(enum_value) @variable.other.member +; Structs and members +(member_expression property: (identifier) @variable.other.member) +(struct_expression type: ((identifier) @type .)) +(struct_field_assignment name: (identifier) @variable.other.member) +; Tokens +; ------- ; Keywords +(meta_type_expression "type" @keyword) [ "pragma" - "import" "contract" "interface" "library" @@ -95,19 +109,6 @@ "event" "using" "assembly" - "switch" - "case" - "default" - "break" - "continue" - "if" - "else" - "for" - "while" - "do" - "try" - "catch" - "return" "emit" "public" "internal" @@ -117,20 +118,47 @@ "view" "payable" "modifier" - "returns" "memory" "storage" "calldata" - "function" "var" - (constant) + "constant" (virtual) (override_specifier) (yul_leave) ] @keyword -(import_directive "as" @keyword) -(import_directive "from" @keyword) +[ + "for" + "while" + "do" +] @keyword.control.repeat + +[ + "break" + "continue" + "if" + "else" + "switch" + "case" + "default" +] @keyword.control.conditional + +[ + "try" + "catch" +] @keyword.control.exception + +[ + "return" + "returns" +] @keyword.control.return + +"function" @keyword.function + +"import" @keyword.control.import +(import_directive "as" @keyword.control.import) +(import_directive "from" @keyword.control.import) (event_paramater "indexed" @keyword) ; TODO fix spelling once fixed upstream ; Punctuation @@ -142,7 +170,7 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket [ @@ -185,5 +213,7 @@ "--" ] @operator -(identifier) @variable -(yul_identifier) @variable +[ + "delete" + "new" +] @keyword.operator diff --git a/runtime/queries/solidity/locals.scm b/runtime/queries/solidity/locals.scm new file mode 100644 index 00000000..29bdc02c --- /dev/null +++ b/runtime/queries/solidity/locals.scm @@ -0,0 +1,9 @@ +(function_definition) @local.scope +(block_statement) @local.scope + +(function_definition (parameter name: (identifier) @local.definition)) + +; still have to support tuple assignments +(assignment_expression left: (identifier) @local.definition) + +(identifier) @local.reference \ No newline at end of file From 9c3c6a1c22db065512c5563e9ed1c9dca869c886 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sun, 4 Sep 2022 21:34:49 -0500 Subject: [PATCH 02/64] Fix off-by-one in extend_line_above (#3689) `extend_line_above` (and `extend_line` when facing backwards) skip a line when the current range does not fully cover a line. Before this change: foo b#[|a]#r baz With `extend_line_above` or `extend_line` selected the line above. #[|foo bar]# baz Which is inconsistent with `extend_line_below`. This commit changes the behavior to select the current line when it is not already selected. foo #[|bar]# baz Then further calls of `extend_line_above` extend the selection up line-wise. --- helix-term/src/commands.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 906f201a..babfb2c8 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1971,7 +1971,7 @@ fn extend_line_impl(cx: &mut Context, extend: Extend) { let (start_line, end_line) = range.line_range(text.slice(..)); let start = text.line_to_char(match extend { - Extend::Above => start_line.saturating_sub(count), + Extend::Above => start_line.saturating_sub(count - 1), Extend::Below => start_line, }); let end = text.line_to_char( @@ -1985,7 +1985,7 @@ fn extend_line_impl(cx: &mut Context, extend: Extend) { // extend to previous/next line if current line is selected let (anchor, head) = if range.from() == start && range.to() == end { match extend { - Extend::Above => (end, text.line_to_char(start_line.saturating_sub(count + 1))), + Extend::Above => (end, text.line_to_char(start_line.saturating_sub(count))), Extend::Below => ( start, text.line_to_char((end_line + count + 1).min(text.len_lines())), From 1acdfaa073327cb52c27186235d69ac095ab468d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 5 Sep 2022 11:57:41 +0900 Subject: [PATCH 03/64] fix: View needs to retain the original scroll offset on split --- helix-term/src/commands.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index babfb2c8..e869446e 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4142,12 +4142,16 @@ fn split(cx: &mut Context, action: Action) { let (view, doc) = current!(cx.editor); let id = doc.id(); let selection = doc.selection(view.id).clone(); + let offset = view.offset; cx.editor.switch(id, action); // match the selection in the previous view let (view, doc) = current!(cx.editor); doc.set_selection(view.id, selection); + // match the view scroll offset (switch doesn't handle this fully + // since the selection is only matched after the split) + view.offset = offset; } fn hsplit(cx: &mut Context) { From 16197664ab8dc1921de880a5487c0adea450635c Mon Sep 17 00:00:00 2001 From: Michael Kohl Date: Mon, 5 Sep 2022 13:11:06 +0700 Subject: [PATCH 04/64] Add file_picker_in_current_directory to keymap.md (#3701) --- book/src/keymap.md | 1 + 1 file changed, 1 insertion(+) diff --git a/book/src/keymap.md b/book/src/keymap.md index a26fd7ea..698b504c 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -257,6 +257,7 @@ This layer is a kludge of mappings, mostly pickers. | Key | Description | Command | | ----- | ----------- | ------- | | `f` | Open file picker | `file_picker` | +| `F` | Open file picker at current working directory | `file_picker_in_current_directory` | | `b` | Open buffer picker | `buffer_picker` | | `j` | Open jumplist picker | `jumplist_picker` | | `k` | Show documentation for item under cursor in a [popup](#popup) (**LSP**) | `hover` | From fb92d71d087e8e8f5c4b28acab9cfdd65857d4c1 Mon Sep 17 00:00:00 2001 From: Lennard Hofmann Date: Mon, 5 Sep 2022 15:35:14 +0200 Subject: [PATCH 05/64] Update tree-sitter-fish to latest commit (#3704) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index b19fde6a..aee00f45 100644 --- a/languages.toml +++ b/languages.toml @@ -121,7 +121,7 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "fish" -source = { git = "https://github.com/ram02z/tree-sitter-fish", rev = "04e54ab6585dfd4fee6ddfe5849af56f101b6d4f" } +source = { git = "https://github.com/ram02z/tree-sitter-fish", rev = "84436cf24c2b3176bfbb220922a0fdbd0141e406" } [[language]] name = "mint" From df1ed0a5fd02cc89ccfa3bf0912848249bebae6d Mon Sep 17 00:00:00 2001 From: NotAgentBilly <82730686+NotAgentBilly@users.noreply.github.com> Date: Mon, 5 Sep 2022 13:42:17 +0000 Subject: [PATCH 06/64] xcopy - assume destination is a directory (#3686) --- README.md | 4 ++-- book/src/install.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0d3dab4b..98ec7822 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,8 @@ config directory (for example `~/.config/helix/runtime` on Linux/macOS, or `%App | OS | Command | | -------------------- | -------------------------------------------- | -| Windows (cmd.exe) | `xcopy /e runtime %AppData%\helix\runtime` | -| Windows (PowerShell) | `xcopy /e runtime $Env:AppData\helix\runtime` | +| Windows (cmd.exe) | `xcopy /e /i runtime %AppData%\helix\runtime` | +| Windows (PowerShell) | `xcopy /e /i runtime $Env:AppData\helix\runtime` | | Linux/macOS | `ln -s $PWD/runtime ~/.config/helix/runtime` | This location can be overridden via the `HELIX_RUNTIME` environment variable. diff --git a/book/src/install.md b/book/src/install.md index 497dd0a4..d7a51ac2 100644 --- a/book/src/install.md +++ b/book/src/install.md @@ -66,8 +66,8 @@ via the `HELIX_RUNTIME` environment variable. | OS | command | |-------------------|-----------| -|windows(cmd.exe) |`xcopy /e runtime %AppData%/helix/runtime` | -|windows(powershell)|`xcopy /e runtime $Env:AppData\helix\runtime` | +|windows(cmd.exe) |`xcopy /e /i runtime %AppData%/helix/runtime` | +|windows(powershell)|`xcopy /e /i runtime $Env:AppData\helix\runtime` | |linux/macos |`ln -s $PWD/runtime ~/.config/helix/runtime`| ## Finishing up the installation From da8071047a8d48cb93dfb4a6ab9b8b2d08efb0dd Mon Sep 17 00:00:00 2001 From: Clay Date: Mon, 5 Sep 2022 03:49:41 -1000 Subject: [PATCH 07/64] Elixir: update tree-sitter queries (#3645) --- runtime/queries/elixir/injections.scm | 50 +++++++++++++++++++++----- runtime/queries/elixir/textobjects.scm | 2 +- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/runtime/queries/elixir/injections.scm b/runtime/queries/elixir/injections.scm index 5c58a863..4853b84b 100644 --- a/runtime/queries/elixir/injections.scm +++ b/runtime/queries/elixir/injections.scm @@ -1,20 +1,16 @@ +; Elixir Code Comments ((comment) @injection.content (#set! injection.language "comment")) +; Elixir Regular Expressions ((sigil (sigil_name) @_sigil_name (quoted_content) @injection.content) - (#match? @_sigil_name "^(r|R)$") + (#match? @_sigil_name "^(R|r)$") (#set! injection.language "regex") (#set! injection.combined)) -((sigil - (sigil_name) @_sigil_name - (quoted_content) @injection.content) - (#eq? @_sigil_name "H") - (#set! injection.language "heex") - (#set! injection.combined)) - +; Elixir Markdown Documentation (unary_operator operator: "@" operand: (call @@ -23,3 +19,41 @@ (string (quoted_content) @injection.content) (sigil (quoted_content) @injection.content) ])) (#set! injection.language "markdown")) + +; Zigler Sigils +((sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content) + (#match? @_sigil_name "^(Z|z)$") + (#set! injection.language "zig") + (#set! injection.combined)) + +; Jason Sigils +((sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content) + (#match? @_sigil_name "^(J|j)$") + (#set! injection.language "json") + (#set! injection.combined)) + +; Phoenix Live View HEEx Sigils +((sigil + (sigil_name) @_sigil_name + (quoted_content) @injection.content) + (#eq? @_sigil_name "H") + (#set! injection.language "heex") + (#set! injection.combined)) + +; Phoenix Live View Component Macros +(call + (identifier) @_identifier + (arguments + (atom)+ + (keywords (pair + ((keyword) @_keyword (#eq? @_keyword "doc: ")) + [ + (string (quoted_content) @injection.content) + (sigil (quoted_content) @injection.content) + ])) + (#match? @_identifier "^(attr|slot)$") + (#set! injection.language "markdown"))) diff --git a/runtime/queries/elixir/textobjects.scm b/runtime/queries/elixir/textobjects.scm index cc1bee99..ab456584 100644 --- a/runtime/queries/elixir/textobjects.scm +++ b/runtime/queries/elixir/textobjects.scm @@ -32,4 +32,4 @@ (do_block (_)* @test.inside)?) (#match? @_keyword "^(test|describe)$")) @test.around -(comment) @comment.around @comment.inside +(comment)+ @comment.around @comment.inside From 8882615483bc1cd6ade59da83f1cb6c2a3c5acf5 Mon Sep 17 00:00:00 2001 From: Kirawi <67773714+kirawi@users.noreply.github.com> Date: Mon, 5 Sep 2022 15:38:37 -0400 Subject: [PATCH 08/64] Delete hooks.md (#3711) --- book/src/SUMMARY.md | 1 - book/src/hooks.md | 1 - 2 files changed, 2 deletions(-) delete mode 100644 book/src/hooks.md diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index ef214b12..eaf0c4f4 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -11,7 +11,6 @@ - [Configuration](./configuration.md) - [Themes](./themes.md) - [Key Remapping](./remapping.md) - - [Hooks](./hooks.md) - [Languages](./languages.md) - [Guides](./guides/README.md) - [Adding Languages](./guides/adding_languages.md) diff --git a/book/src/hooks.md b/book/src/hooks.md deleted file mode 100644 index 744f34e8..00000000 --- a/book/src/hooks.md +++ /dev/null @@ -1 +0,0 @@ -# Hooks From 5e1296b8885fc731ed05b4af01e3c7c2af343b47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Sep 2022 18:33:01 -0500 Subject: [PATCH 09/64] build(deps): bump once_cell from 1.13.1 to 1.14.0 (#3715) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- helix-core/Cargo.toml | 2 +- helix-loader/Cargo.toml | 2 +- helix-term/Cargo.toml | 2 +- helix-view/Cargo.toml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b2225f88..e327e4b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -739,9 +739,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" +checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" [[package]] name = "parking_lot" diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 0bae7b89..3ea7235d 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -26,7 +26,7 @@ unicode-general-category = "0.5" # slab = "0.4.2" slotmap = "1.0" tree-sitter = "0.20" -once_cell = "1.13" +once_cell = "1.14" arc-swap = "1" regex = "1" diff --git a/helix-loader/Cargo.toml b/helix-loader/Cargo.toml index 46144a30..e23e0290 100644 --- a/helix-loader/Cargo.toml +++ b/helix-loader/Cargo.toml @@ -19,7 +19,7 @@ serde = { version = "1.0", features = ["derive"] } toml = "0.5" etcetera = "0.4" tree-sitter = "0.20" -once_cell = "1.13" +once_cell = "1.14" log = "0.4" # TODO: these two should be on !wasm32 only diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index f4a9642a..0ebcb24f 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -32,7 +32,7 @@ helix-dap = { version = "0.6", path = "../helix-dap" } helix-loader = { version = "0.6", path = "../helix-loader" } anyhow = "1" -once_cell = "1.13" +once_cell = "1.14" which = "4.2" diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml index ef21f9a6..9182ce23 100644 --- a/helix-view/Cargo.toml +++ b/helix-view/Cargo.toml @@ -22,7 +22,7 @@ helix-dap = { version = "0.6", path = "../helix-dap" } crossterm = { version = "0.25", optional = true } # Conversion traits -once_cell = "1.13" +once_cell = "1.14" url = "2" arc-swap = { version = "1.5.1" } From c34929b1346f2a8e26b9faa1a91e75fd067b0d7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Sep 2022 18:33:50 -0500 Subject: [PATCH 10/64] build(deps): bump thiserror from 1.0.33 to 1.0.34 (#3717) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e327e4b0..922d8b75 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1126,18 +1126,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0a539a918745651435ac7db7a18761589a94cd7e94cd56999f828bf73c8a57" +checksum = "8c1b05ca9d106ba7d2e31a9dab4a64e7be2cce415321966ea3132c49a656e252" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c251e90f708e16c49a16f4917dc2131e75222b72edfa9cb7f7c58ae56aae0c09" +checksum = "e8f2591983642de85c921015f3f070c665a197ed69e417af436115e3a1407487" dependencies = [ "proc-macro2", "quote", From 8667a4d2bef393add4b5fa6da1697f7c9fa38a43 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Sep 2022 18:48:58 -0500 Subject: [PATCH 11/64] build(deps): bump anyhow from 1.0.63 to 1.0.64 (#3718) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 922d8b75..6dcbd8ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,9 +22,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26fa4d7e3f2eebadf743988fc8aec9fa9a9e82611acafd77c1462ed6262440a" +checksum = "b9a8f622bcf6ff3df478e9deba3e03e4e04b300f8e6a139e192c05fa3490afc7" [[package]] name = "arc-swap" From b85d0c597a094e53f1b3a5af15336d4d335a53ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Sep 2022 18:51:33 -0500 Subject: [PATCH 12/64] build(deps): bump tree-sitter from 0.20.8 to 0.20.9 (#3719) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6dcbd8ea..ad7e089d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,9 +1231,9 @@ dependencies = [ [[package]] name = "tree-sitter" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "268bf3e3ca0c09e5d21b59c2638e12cb6dcf7ea2681250a696a2d0936cb57ba0" +checksum = "d4423c784fe11398ca91e505cdc71356b07b1a924fc8735cfab5333afe3e18bc" dependencies = [ "cc", "regex", From f7c216d497efdca8de61a0deb34449c85c6d5229 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Sep 2022 11:25:54 +0900 Subject: [PATCH 13/64] build(deps): bump tokio from 1.20.1 to 1.21.0 (#3716) Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.20.1 to 1.21.0. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.20.1...tokio-1.21.0) --- updated-dependencies: - dependency-name: tokio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- helix-lsp/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad7e089d..341f0f6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1179,9 +1179,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.20.1" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" +checksum = "89797afd69d206ccd11fb0ea560a44bbb87731d020670e79416d442919257d42" dependencies = [ "autocfg", "bytes", diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index b7d26662..2e5b8139 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -22,6 +22,6 @@ lsp-types = { version = "0.93", features = ["proposed"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" -tokio = { version = "1.19", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } +tokio = { version = "1.21", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } tokio-stream = "0.1.9" which = "4.2" From 43b31f702a13d3ced2dc414d2febe5bcf222366a Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 5 Sep 2022 22:02:37 -0500 Subject: [PATCH 14/64] Update tree-sitter-diff (#3708) This change also renames the grammar from `git-diff` to `diff`. The grammar covers regular diff syntax so I renamed the repository a while ago. --- book/src/generated/lang-support.md | 2 +- languages.toml | 6 +++--- runtime/queries/{git-diff => diff}/highlights.scm | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename runtime/queries/{git-diff => diff}/highlights.scm (100%) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 467e4c5e..4e10ffc1 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -15,6 +15,7 @@ | cue | ✓ | | | `cuelsp` | | dart | ✓ | | ✓ | `dart` | | devicetree | ✓ | | | | +| diff | ✓ | | | | | dockerfile | ✓ | | | `docker-langserver` | | dot | ✓ | | | `dot-language-server` | | edoc | ✓ | | | | @@ -32,7 +33,6 @@ | git-attributes | ✓ | | | | | git-commit | ✓ | | | | | git-config | ✓ | | | | -| git-diff | ✓ | | | | | git-ignore | ✓ | | | | | git-rebase | ✓ | | | | | gleam | ✓ | ✓ | | `gleam` | diff --git a/languages.toml b/languages.toml index aee00f45..e288db8f 100644 --- a/languages.toml +++ b/languages.toml @@ -978,7 +978,7 @@ name = "git-commit" source = { git = "https://github.com/the-mikedavis/tree-sitter-git-commit", rev = "318dd72abfaa7b8044c1d1fbeabcd06deaaf038f" } [[language]] -name = "git-diff" +name = "diff" scope = "source.diff" roots = [] file-types = ["diff"] @@ -987,8 +987,8 @@ comment-token = "#" indent = { tab-width = 2, unit = " " } [[grammar]] -name = "git-diff" -source = { git = "https://github.com/the-mikedavis/tree-sitter-git-diff", rev = "c12e6ecb54485f764250556ffd7ccb18f8e2942b" } +name = "diff" +source = { git = "https://github.com/the-mikedavis/tree-sitter-diff", rev = "fd74c78fa88a20085dbc7bbeaba066f4d1692b63" } [[language]] name = "git-rebase" diff --git a/runtime/queries/git-diff/highlights.scm b/runtime/queries/diff/highlights.scm similarity index 100% rename from runtime/queries/git-diff/highlights.scm rename to runtime/queries/diff/highlights.scm From 665e27ff9dc017ee47f646187d98f5e4cdb18411 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sun, 28 Aug 2022 20:16:10 -0600 Subject: [PATCH 15/64] nix: add language injections By simply placing a comment with the name of the desired language just before a multi-line string, that language will be injected. Also, common functions and attributes which are expected to be shell code are automatically injected. --- runtime/queries/nix/injections.scm | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 runtime/queries/nix/injections.scm diff --git a/runtime/queries/nix/injections.scm b/runtime/queries/nix/injections.scm new file mode 100644 index 00000000..82d79cc7 --- /dev/null +++ b/runtime/queries/nix/injections.scm @@ -0,0 +1,39 @@ +; mark arbitary languages with a comment +((((comment) @injection.language) . + (indented_string_expression (string_fragment) @injection.content)) + (#set! injection.combined)) + +((binding + attrpath: (attrpath (identifier) @_path) + expression: (indented_string_expression + (string_fragment) @injection.content)) + (#match? @_path "(^\\w*Phase|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$") + (#set! injection.language "bash") + (#set! injection.combined)) + +((apply_expression + function: (apply_expression function: (_) @_func) + argument: (indented_string_expression (string_fragment) @injection.content)) + (#match? @_func "(^|\\.)writeShellScript(Bin)?$") + (#set! injection.language "bash") + (#set! injection.combined)) + +(apply_expression + (apply_expression + function: (apply_expression + function: ((_) @_func))) + argument: (indented_string_expression (string_fragment) @injection.content) + (#match? @_func "(^|\\.)runCommand(((No)?(CC))?(Local)?)?$") + (#set! injection.language "bash") + (#set! injection.combined)) + +(apply_expression + function: ((_) @_func) + argument: (_ (_)* (_ (_)* (binding + attrpath: (attrpath (identifier) @_path) + expression: (indented_string_expression + (string_fragment) @injection.content)))) + (#match? @_func "(^|\\.)writeShellApplication$") + (#match? @_path "^text$") + (#set! injection.language "bash") + (#set! injection.combined)) From 5ed751c67d004544a05b0cf19ed0c9c99c534d97 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Fri, 2 Sep 2022 18:48:45 -0600 Subject: [PATCH 16/64] remove `^$` from injection regexs --- languages.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/languages.toml b/languages.toml index e288db8f..d3051377 100644 --- a/languages.toml +++ b/languages.toml @@ -331,7 +331,7 @@ source = { git = "https://github.com/omertuc/tree-sitter-go-work", rev = "6dd9dd [[language]] name = "javascript" scope = "source.js" -injection-regex = "^(js|javascript)$" +injection-regex = "(js|javascript)" file-types = ["js", "jsx", "mjs", "cjs"] shebangs = ["node"] roots = [] @@ -370,7 +370,7 @@ grammar = "javascript" [[language]] name = "typescript" scope = "source.ts" -injection-regex = "^(ts|typescript)$" +injection-regex = "(ts|typescript)" file-types = ["ts"] shebangs = [] roots = [] @@ -385,7 +385,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-typescript", rev = [[language]] name = "tsx" scope = "source.tsx" -injection-regex = "^(tsx)$" # |typescript +injection-regex = "(tsx)" # |typescript file-types = ["tsx"] roots = [] # TODO: highlights-params @@ -1183,7 +1183,7 @@ source = { git = "https://github.com/milisims/tree-sitter-org", rev = "698bb1a34 [[language]] name = "solidity" scope = "source.sol" -injection-regex = "^(sol|solidity)$" +injection-regex = "(sol|solidity)" file-types = ["sol"] roots = [] comment-token = "//" @@ -1400,7 +1400,7 @@ source = { git = "https://github.com/archseer/tree-sitter-cairo", rev = "5155c6e [[language]] name = "cpon" scope = "scope.cpon" -injection-regex = "^cpon$" +injection-regex = "cpon" file-types = ["cpon", "cp"] roots = [] auto-format = true From 14f12c8a0b7992a6836ad0b9e3177329696e5dc1 Mon Sep 17 00:00:00 2001 From: Rohit K Viswanath Date: Wed, 7 Sep 2022 04:21:02 +0530 Subject: [PATCH 17/64] Theme: Rasmus (#3728) --- runtime/themes/rasmus.toml | 135 +++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 runtime/themes/rasmus.toml diff --git a/runtime/themes/rasmus.toml b/runtime/themes/rasmus.toml new file mode 100644 index 00000000..a7baa83c --- /dev/null +++ b/runtime/themes/rasmus.toml @@ -0,0 +1,135 @@ +# Author : Rohit K Viswanath +# Ported from : [rsms/sublime-theme](https://github.com/rsms/sublime-theme) + +"attribute" = "cyan" + +"keyword" = "blue" +"keyword.control.conditional" = { fg = "blue", modifiers = ["italic"] } +"keyword.directive" = "magenta" # -- preprocessor comments (#if in C) + +"namespace" = { fg = "blue", modifiers = ["italic"] } + +"punctuation" = "gray06" +"punctuation.delimiter" = "gray06" + +"operator" = "yellow" +"special" = "yellow" + +"variable" = "white" +"variable.builtin" = "bright_blue" +"variable.parameter" = "bright_white" +"variable.other.member" = "white" + +"type" = "bright_white" +"type.builtin" = "magenta" +"type.enum.variant" = "magenta" + +"constructor" = "yellow" + +"function" = "white" +"function.macro" = "blue" +"function.builtin" = "blue" + +"tag" = "yellow" +"comment" = { fg = "gray05", modifiers = ["italic"] } + +"string" = "cyan" +"string.regexp" = "green" +"string.special" = "blue" + +"constant" = "white" +"constant.builtin" = "white" +"constant.numeric" = "magenta" +"constant.character.escape" = "magenta" + +# used for lifetimes +"label" = "yellow" + +"markup.heading.marker" = { fg = "gray07" } +"markup.heading.1" = { fg = "white", modifiers = ["bold"] } +"markup.heading.2" = { fg = "gray07", modifiers = ["bold"] } +"markup.heading.3" = { fg = "gray07", modifiers = ["bold"] } +"markup.heading.4" = { fg = "gray07", modifiers = ["bold"] } +"markup.heading.5" = { fg = "gray06", modifiers = ["bold"] } +"markup.heading.6" = { fg = "gray06", modifiers = ["bold"] } +"markup.list" = "gray07" +"markup.bold" = { modifiers = ["bold"] } +"markup.italic" = { modifiers = ["italic"] } +"markup.link.url" = { fg = "cyan", modifiers = ["underlined"] } +"markup.link.text" = "blue" +"markup.raw" = "yellow" + +"diff.plus" = "bright_green" +"diff.minus" = "bright_red" +"diff.delta" = "bright_cyan" + +"ui.background" = { bg = "bg" } +"ui.background.separator" = { fg = "fg" } + +"ui.linenr" = { fg = "gray04" } +"ui.linenr.selected" = { fg = "gray07" } + +"ui.statusline" = { fg = "gray07", bg = "gray02" } +"ui.statusline.inactive" = { fg = "gray05", bg = "gray01" } +"ui.statusline.normal" = { fg = "black", bg = "cyan", modifiers = ["bold"] } +"ui.statusline.insert" = { fg = "black", bg = "blue", modifiers = ["bold"] } +"ui.statusline.select" = { fg = "black", bg = "magenta", modifiers = ["bold"] } + +"ui.popup" = { bg = "gray01" } +"ui.window" = { fg = "gray02" } +"ui.help" = { bg = "gray01", fg = "fg" } + +"ui.text" = { fg = "fg" } +"ui.text.focus" = { fg = "white" } + +"ui.virtual" = { fg = "gray03" } +"ui.virtual.indent-guide" = { fg = "gray04" } + +"ui.selection" = { bg = "gray03" } +"ui.selection.primary" = { bg = "gray03" } + +"ui.cursor" = { bg = "gray04" } +"ui.cursor.insert" = { bg = "white" } +"ui.cursor.match" = { fg = "bright_yellow" } +"ui.cursor.select" = { bg = "gray03" } +"ui.cursorline.primary" = { bg = "gray01" } + +"ui.highlight" = { bg = "gray03" } + +"ui.menu" = { fg = "white", bg = "gray01" } +"ui.menu.selected" = { fg = "fg", bg = "gray03" } +"ui.menu.scroll" = { fg = "white", bg = "gray01" } + +diagnostic = { modifiers = ["underlined"] } + +warning = "bright_yellow" +error = "bright_red" +info = "bright_blue" +hint = "bright_cyan" + +[palette] +bg = "#1a1a19" +fg = "#d1d1d1" +black = "#333332" +red = "#ff968c" +green = "#61957f" +yellow = "#ffc591" +blue = "#8db4d4" +magenta = "#de9bc8" +cyan = "#7bb099" +white = "#d1d1d1" +bright_black = "#4c4c4b" +bright_red = "#ffafa5" +bright_green = "#7aae98" +bright_yellow = "#ffdeaa" +bright_blue = "#a6cded" +bright_magenta = "#f7b4e1" +bright_cyan = "#94c9b2" +bright_white = "#eaeaea" +gray01 = "#222221" +gray02 = "#2a2a29" +gray03 = "#323231" +gray04 = "#3a3a39" +gray05 = "#6a6a69" +gray06 = "#767675" +gray07 = "#b6b6b5" From 1fc97a9a203adce6a700cb871cddb75c655a4b98 Mon Sep 17 00:00:00 2001 From: yvt Date: Fri, 2 Sep 2022 12:42:25 +0900 Subject: [PATCH 18/64] chore(ci): install a pre-release version of Cross --- .github/workflows/release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b8be1541..55233bfd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -100,6 +100,14 @@ jobs: target: ${{ matrix.target }} override: true + # Install a pre-release version of Cross + # TODO: We need to pre-install Cross because we need cross-rs/cross#591 to + # get a newer C++ compiler toolchain. Remove this step when Cross + # 0.3.0, which includes cross-rs/cross#591, is released. + - name: Install Cross + if: "matrix.cross" + run: cargo install cross --git https://github.com/cross-rs/cross.git --rev 47df5c76e7cba682823a0b6aa6d95c17b31ba63a + - name: Run cargo test uses: actions-rs/cargo@v1 if: "!matrix.skip_tests" From 038a91d204bd4a0038201f37d64cc55615ca9fca Mon Sep 17 00:00:00 2001 From: yvt Date: Fri, 2 Sep 2022 12:44:18 +0900 Subject: [PATCH 19/64] chore(ci): build binary for aarch64-linux --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55233bfd..76e12eac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,11 +49,11 @@ jobs: rust: stable target: x86_64-unknown-linux-gnu cross: false - # - build: aarch64-linux - # os: ubuntu-20.04 - # rust: stable - # target: aarch64-unknown-linux-gnu - # cross: true + - build: aarch64-linux + os: ubuntu-20.04 + rust: stable + target: aarch64-unknown-linux-gnu + cross: true - build: x86_64-macos os: macos-latest rust: stable From b7380313a5d5e590970742bf7eaa2f2d695b6e0c Mon Sep 17 00:00:00 2001 From: yvt Date: Sat, 3 Sep 2022 21:49:45 +0900 Subject: [PATCH 20/64] chore(ci): build AppImage for aarch64-linux --- .github/workflows/release.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76e12eac..7d723b98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -138,7 +138,7 @@ jobs: - name: Build AppImage shell: bash - if: matrix.build == 'x86_64-linux' + if: matrix.build == 'aarch64-linux' || matrix.build == 'x86_64-linux' run: | mkdir dist @@ -147,8 +147,10 @@ jobs: name=${GITHUB_REF:10} fi + build="${{ matrix.build }}" + export VERSION="$name" - export ARCH=x86_64 + export ARCH=${build%-linux} export APP=helix export OUTPUT="helix-$VERSION-$ARCH.AppImage" export UPDATE_INFORMATION="gh-releases-zsync|$GITHUB_REPOSITORY_OWNER|helix|latest|$APP-*-$ARCH.AppImage.zsync" @@ -245,7 +247,7 @@ jobs: mv bins-$platform/hx$exe $pkgname chmod +x $pkgname/hx$exe - if [[ "$platform" = "x86_64-linux" ]]; then + if [[ "$platform" = "aarch64-linux" || "$platform" = "x86_64-linux" ]]; then mv bins-$platform/helix-*.AppImage* dist/ fi From 1fe32737faa5dbe9128427197b20be1768298a17 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sun, 4 Sep 2022 17:46:31 -0600 Subject: [PATCH 21/64] nix: fix highlighting rules * avoid coloring `identifier`s globally * fix function application when not part of `select_expression` * add `has_attribute_expression` highlighting * fix precendence for interpolation, which should be after select * highlight `@` as delimiter --- runtime/queries/nix/highlights.scm | 35 +++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/runtime/queries/nix/highlights.scm b/runtime/queries/nix/highlights.scm index d5ff4032..ce8e3c1a 100644 --- a/runtime/queries/nix/highlights.scm +++ b/runtime/queries/nix/highlights.scm @@ -1,16 +1,20 @@ (comment) @comment +"assert" @keyword.control.exception +"or" @keyword.operator +"rec" @keyword.control.repeat + [ "if" "then" "else" +] @keyword.control.conditional + +[ "let" "inherit" "in" - "rec" "with" - "assert" - "or" ] @keyword ((identifier) @variable.builtin @@ -42,14 +46,11 @@ (integer_expression) @constant.numeric.integer (float_expression) @constant.numeric.float -(interpolation - "${" @punctuation.special - "}" @punctuation.special) @embedded - (escape_sequence) @constant.character.escape (function_expression universal: (identifier) @variable.parameter + "@"? @punctuation.delimiter ) (formal @@ -57,11 +58,15 @@ "?"? @punctuation.delimiter) (select_expression - attrpath: (attrpath (identifier)) @variable.other.member) + attrpath: (attrpath attr: (identifier)) @variable.other.member) + +(interpolation + "${" @punctuation.special + "}" @punctuation.special) @embedded (apply_expression function: [ - (variable_expression (identifier)) @function + (variable_expression name: (identifier) @function) (select_expression attrpath: (attrpath attr: (identifier) @function .))]) @@ -72,14 +77,18 @@ (binary_expression operator: _ @operator) -(variable_expression (identifier) @variable) +(variable_expression name: (identifier) @variable) (binding - attrpath: (attrpath (identifier)) @variable.other.member) + attrpath: (attrpath attr: (identifier)) @variable.other.member) -(identifier) @variable.other.member +(inherit_from attrs: (inherited_attrs attr: (identifier) @variable)) -(inherit_from attrs: (inherited_attrs attr: (identifier) @variable.other.member) ) +(has_attr_expression + expression: (_) + "?" @operator + attrpath: (attrpath + attr: (identifier) @variable.other.member)) [ ";" From 301f5d7cf704c2f2e4fc53e258125e39d1845176 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 6 Sep 2022 22:45:51 -0500 Subject: [PATCH 22/64] Fix Rust attribute highlights (#3729) --- runtime/queries/rust/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 39a764a6..78a7abf0 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -258,6 +258,9 @@ ; --- (meta_item (identifier) @function.macro) +(attr_item + (identifier) @function.macro + (token_tree (identifier) @function.macro)?) (inner_attribute_item) @attribute From fe37a66046b16eaf7829606f7b90c18bd73fae3e Mon Sep 17 00:00:00 2001 From: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Date: Wed, 7 Sep 2022 10:22:48 +0300 Subject: [PATCH 23/64] Handle formatter errors, and save anyway (#3684) If formatting fails, report error to log and save without formatting. --- helix-view/src/document.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 3f8dc4e6..a0d50440 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -543,12 +543,19 @@ impl Document { } if let Some(fmt) = formatting { - let transaction = fmt.await?; - let success = transaction.changes().apply(&mut text); - if !success { - // This shouldn't happen, because the transaction changes were generated - // from the same text we're saving. - log::error!("failed to apply format changes before saving"); + match fmt.await { + Ok(transaction) => { + let success = transaction.changes().apply(&mut text); + if !success { + // This shouldn't happen, because the transaction changes were generated + // from the same text we're saving. + log::error!("failed to apply format changes before saving"); + } + } + Err(err) => { + // formatting failed: report error, and save file without modifications + log::error!("{}", err); + } } } From a123fb60572720a5fd0817b194f4d34534f87b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Wed, 7 Sep 2022 16:42:33 +0900 Subject: [PATCH 24/64] Remove LspNotDefined, instead return an Option<> --- helix-lsp/src/lib.rs | 16 +++++----------- helix-term/src/ui/editor.rs | 1 + helix-view/src/editor.rs | 1 + 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 516c93ca..a39325fa 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -38,8 +38,6 @@ pub enum Error { Timeout, #[error("server closed the stream")] StreamClosed, - #[error("LSP not defined")] - LspNotDefined, #[error("Unhandled")] Unhandled, #[error(transparent)] @@ -320,14 +318,14 @@ impl Registry { .map(|(_, client)| client.as_ref()) } - pub fn get(&mut self, language_config: &LanguageConfiguration) -> Result> { + pub fn get(&mut self, language_config: &LanguageConfiguration) -> Result>> { let config = match &language_config.language_server { Some(config) => config, - None => return Err(Error::LspNotDefined), + None => return Ok(None), }; match self.inner.entry(language_config.scope.clone()) { - Entry::Occupied(entry) => Ok(entry.get().1.clone()), + Entry::Occupied(entry) => Ok(Some(entry.get().1.clone())), Entry::Vacant(entry) => { // initialize a new client let id = self.counter.fetch_add(1, Ordering::Relaxed); @@ -356,11 +354,7 @@ impl Registry { .await; if let Err(e) = value { - if let Error::LspNotDefined = e { - // Skip logging "lsp not defined" - } else { - log::error!("failed to initialize language server: {}", e); - } + log::error!("failed to initialize language server: {}", e); return; } @@ -374,7 +368,7 @@ impl Registry { }); entry.insert((id, client.clone())); - Ok(client) + Ok(Some(client)) } } } diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 64e95e33..7cb29c3b 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -1316,6 +1316,7 @@ impl Component for EditorView { if cx.editor.should_close() { return EventResult::Ignored(None); } + // if the focused view still exists and wasn't closed if cx.editor.tree.contains(focus) { let config = cx.editor.config(); diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index b6947e44..5eff9983 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -853,6 +853,7 @@ impl Editor { ) }) .ok() + .flatten() }); if let Some(language_server) = language_server { // only spawn a new lang server if the servers aren't the same From e14b48af2ebeb84868334e3b3281844353a9371d Mon Sep 17 00:00:00 2001 From: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Date: Wed, 7 Sep 2022 20:50:54 +0300 Subject: [PATCH 25/64] Fix :reflow panic by enusring cursor in view (#3733) --- helix-term/src/commands/typed.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index ad4e7f4c..f005d9bf 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1324,6 +1324,7 @@ fn reflow( return Ok(()); } + let scrolloff = cx.editor.config().scrolloff; let (view, doc) = current!(cx.editor); const DEFAULT_MAX_LEN: usize = 79; @@ -1354,6 +1355,7 @@ fn reflow( doc.apply(&transaction, view.id); doc.append_changes_to_history(view.id); + view.ensure_cursor_in_view(doc, scrolloff); Ok(()) } From 5b1113766d5363c2e434ab596fcca64a1c707a55 Mon Sep 17 00:00:00 2001 From: Giorbo <43214182+Giorbo@users.noreply.github.com> Date: Wed, 7 Sep 2022 20:13:06 +0200 Subject: [PATCH 26/64] Add syntax highlighting for SML (#3692) Co-authored-by: Michael Davis --- book/src/generated/lang-support.md | 1 + languages.toml | 12 ++++ runtime/queries/sml/highlights.scm | 91 ++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 runtime/queries/sml/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 4e10ffc1..a66fae21 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -95,6 +95,7 @@ | scheme | ✓ | | | | | scss | ✓ | | | `vscode-css-language-server` | | slint | ✓ | | ✓ | `slint-lsp` | +| sml | ✓ | | | | | solidity | ✓ | | | `solc` | | sql | ✓ | | | | | sshclientconfig | ✓ | | | | diff --git a/languages.toml b/languages.toml index d3051377..38d9cb55 100644 --- a/languages.toml +++ b/languages.toml @@ -1712,3 +1712,15 @@ language-server = { command = "pasls", args = [] } [[grammar]] name = "pascal" source = { git = "https://github.com/Isopod/tree-sitter-pascal", rev = "2fd40f477d3e2794af152618ccfac8d92eb72a66" } + +[[language]] +name = "sml" +scope = "source.sml" +injection-regex = "sml" +file-types = ["sml"] +comment-token = "(*" +roots = [] + +[[grammar]] +name = "sml" +source = { git = "https://github.com/Giorbo/tree-sitter-sml", rev = "bd4055d5554614520d4a0706b34dc0c317c6b608" } diff --git a/runtime/queries/sml/highlights.scm b/runtime/queries/sml/highlights.scm new file mode 100644 index 00000000..dfbf5caf --- /dev/null +++ b/runtime/queries/sml/highlights.scm @@ -0,0 +1,91 @@ +; Highlights queries from Matthew Fluet (https://github.com/MatthewFluet/tree-sitter-sml) +; +; MIT License +; +; Copyright (c) 2022 Matthew Fluet +; +; Permission is hereby granted, free of charge, to any person obtaining a copy +; of this software and associated documentation files (the "Software"), to deal +; in the Software without restriction, including without limitation the rights +; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the Software is +; furnished to do so, subject to the following conditions: +; +; The above copyright notice and this permission notice shall be included in all +; copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +; SOFTWARE. + +;; ******************************************************************* +;; Comments +;; ******************************************************************* + +[(block_comment) (line_comment)] @comment + +;; ******************************************************************* +;; Keywords +;; ******************************************************************* + +[ + ;; Reserved Words Core + "abstype" "and" "andalso" "as" "case" "datatype" "do" "else" "end" + "exception" "fn" "fun" "handle" "if" "in" "infix" "infixr" "let" + "local" "nonfix" "of" "op" "open" "orelse" "raise" "rec" "then" + "type" "val" "with" "withtype" "while" + ;; Reserved Words Modules + "eqtype" "functor" "include" "sharing" "sig" "signature" "struct" + "structure" "where" +] @keyword + +;; ******************************************************************* +;; Constants +;; ******************************************************************* + +(integer_scon) @constant.numeric.integer +(real_scon) @constant.numeric.float +(word_scon) @constant.numeric +(string_scon) @string +(char_scon) @constant.character + +;; ******************************************************************* +;; Types +;; ******************************************************************* + +(fn_ty "->" @type) +(tuple_ty "*" @type) +(paren_ty ["(" ")"] @type) +(tyvar_ty (tyvar) @type) +(record_ty + ["{" "," "}"] @type + (tyrow [(lab) ":"] @type)? + (ellipsis_tyrow ["..." ":"] @type)?) +(tycon_ty + (tyseq ["(" "," ")"] @type)? + (longtycon) @type) + +;; ******************************************************************* +;; Constructors +;; ******************************************************************* + +;; Assume value identifiers starting with capital letter are constructors +((vid) @constructor + (#match? @constructor "^[A-Z].*")) + +((vid) @constant.builtin (#eq? @constant.builtin "nil")) +((vid) @constant.builtin.boolean + (#match? @constant.builtin.boolean "^(true|false)$")) +((vid) @operator (#eq? @operator "::")) +((vid) @keyword.storage.modifier (#eq? @keyword.storage.modifier "ref")) + +;; ******************************************************************* +;; Punctuation +;; ******************************************************************* + +["(" ")" "[" "]" "{" "}"] @punctuation.bracket +["." "," ":" ";" "|" "=>" ":>"] @punctuation.delimiter From 16ce036bdf3a7899d14d62bc46bbc9a8b5fa99e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Cortier?= Date: Wed, 7 Sep 2022 16:29:41 -0400 Subject: [PATCH 27/64] Add good default rulers when editing git messages (#3738) Around 50 columns for the summary is good because it is often used as heading or as subject in emails. 72 columns for the body is generally good because some tools do not wrap long lines (`git log` with pager `less` is a good example). Helix's `:reflow` command is really good to help with the second point. Linux kernel documentation says: > For these reasons, the ``summary`` must be no more than 70-75 > characters, and it must describe both what the patch changes, as well > as why the patch might be necessary. It is challenging to be both > succinct and descriptive, but that is what a well-written summary > should do. Source: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst#n627 tpope: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html Commit message style guide for Git: https://commit.style/ --- languages.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/languages.toml b/languages.toml index 38d9cb55..c7bc982d 100644 --- a/languages.toml +++ b/languages.toml @@ -972,6 +972,8 @@ roots = [] file-types = ["COMMIT_EDITMSG"] comment-token = "#" indent = { tab-width = 2, unit = " " } +rulers = [50, 72] +max-line-length = 72 [[grammar]] name = "git-commit" From 5ab85283e944b9b0409c70953c7655b9c5f84067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Thu, 8 Sep 2022 16:04:18 +0200 Subject: [PATCH 28/64] feat(languages): jsonnet (#3714) Co-authored-by: Michael Davis --- book/src/generated/lang-support.md | 1 + languages.toml | 12 ++++++++ runtime/queries/jsonnet/highlights.scm | 38 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 runtime/queries/jsonnet/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index a66fae21..88c9df91 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -53,6 +53,7 @@ | javascript | ✓ | ✓ | ✓ | `typescript-language-server` | | jsdoc | ✓ | | | | | json | ✓ | | ✓ | `vscode-json-language-server` | +| jsonnet | ✓ | | | | | jsx | ✓ | ✓ | ✓ | `typescript-language-server` | | julia | ✓ | | | `julia` | | kotlin | ✓ | | | `kotlin-language-server` | diff --git a/languages.toml b/languages.toml index c7bc982d..12f02781 100644 --- a/languages.toml +++ b/languages.toml @@ -1726,3 +1726,15 @@ roots = [] [[grammar]] name = "sml" source = { git = "https://github.com/Giorbo/tree-sitter-sml", rev = "bd4055d5554614520d4a0706b34dc0c317c6b608" } + +[[language]] +name = "jsonnet" +scope = "source.jsonnet" +file-types = ["libsonnet", "jsonnet"] +roots = [] +comment-token = "//" +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "jsonnet" +source = { git = "https://github.com/sourcegraph/tree-sitter-jsonnet", rev = "0475a5017ad7dc84845d1d33187f2321abcb261d" } diff --git a/runtime/queries/jsonnet/highlights.scm b/runtime/queries/jsonnet/highlights.scm new file mode 100644 index 00000000..f54e7d5c --- /dev/null +++ b/runtime/queries/jsonnet/highlights.scm @@ -0,0 +1,38 @@ +["if" "then" "else"] @keyword.control.conditional +[ + (local) + "function" +] @keyword +(comment) @comment + +(string) @string +(number) @constant.numeric +[ + (true) + (false) +] @constant.builtin.boolean + +(binaryop) @operator +(unaryop) @operator + +(param identifier: (id) @variable.parameter) +(bind function: (id) @function) +(fieldname (id) @variable.other.member) +[ + "[" + "]" + "{" + "}" +] @punctuation.bracket +"for" @keyword.control.repeat +"in" @keyword.operator +[(self) (dollar)] @variable.builtin +"assert" @keyword +(null) @constant.builtin +[ + ":" + "::" + ";" + "=" +] @punctuation.delimiter +(id) @variable From e12690e2f5c881db731bc8e7efe8554d5d423e78 Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Sat, 3 Sep 2022 14:22:17 -0400 Subject: [PATCH 29/64] Remove default insert mode movement bindings Helix is first and foremost a modal editor. Willingness to support non-modal editing is there, but it is not one that should be encouraged with the default settings. There are an increasing number of users who are stumbling because they are trying to use Helix as a non-modal editor, so this is an effort to encourage new users to stop and take notice that Helix has a different paradigm than VSCode, Sublime, etc. Users can still add these bindings back to their own configs if they wish. --- book/src/keymap.md | 34 +++++++++++++++++--------------- helix-term/src/keymap/default.rs | 19 ------------------ 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 698b504c..da4433f3 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -315,10 +315,12 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire ## Insert Mode -We support many readline/emacs style bindings in insert mode for -convenience. These can be helpful for making simple modifications -without escaping to normal mode, but beware that you will not have an -undo-able "save point" until you return to normal mode. +Insert mode bindings are somewhat minimal by default. Helix is designed to +be a modal editor, and this is reflected in the user experience and internal +mechanics. For example, changes to the text are only saved for undos when +escaping from insert mode to normal mode. For this reason, new users are +strongly encouraged to learn the modal editing paradigm to get the smoothest +experience. | Key | Description | Command | | ----- | ----------- | ------- | @@ -327,23 +329,23 @@ undo-able "save point" until you return to normal mode. | `Ctrl-r` | Insert a register content | `insert_register` | | `Ctrl-w`, `Alt-Backspace`, `Ctrl-Backspace` | Delete previous word | `delete_word_backward` | | `Alt-d`, `Alt-Delete`, `Ctrl-Delete` | Delete next word | `delete_word_forward` | -| `Alt-b`, `Ctrl-Left` | Backward a word | `move_prev_word_end` | -| `Ctrl-b`, `Left` | Backward a char | `move_char_left` | -| `Alt-f`, `Ctrl-Right` | Forward a word | `move_next_word_start` | -| `Ctrl-f`, `Right` | Forward a char | `move_char_right` | -| `Ctrl-e`, `End` | Move to line end | `goto_line_end_newline` | -| `Ctrl-a`, `Home` | Move to line start | `goto_line_start` | | `Ctrl-u` | Delete to start of line | `kill_to_line_start` | | `Ctrl-k` | Delete to end of line | `kill_to_line_end` | | `Ctrl-j`, `Enter` | Insert new line | `insert_newline` | | `Backspace`, `Ctrl-h` | Delete previous char | `delete_char_backward` | | `Delete`, `Ctrl-d` | Delete next char | `delete_char_forward` | -| `Ctrl-p`, `Up` | Move to previous line | `move_line_up` | -| `Ctrl-n`, `Down` | Move to next line | `move_line_down` | -| `PageUp` | Move one page up | `page_up` | -| `PageDown` | Move one page down | `page_down` | -| `Alt->` | Go to end of buffer | `goto_file_end` | -| `Alt-<` | Go to start of buffer | `goto_file_start` | + +However, if you really want navigation in insert mode, this is supported. An +example config that gives the ability to use arrow keys while still in insert +mode: + +```toml +[keys.insert] +up = "move_line_up" +down = "move_line_down" +left = "move_char_left" +right = "move_char_right" +``` ## Select / extend mode diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index fd7ea457..f07d4028 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -355,25 +355,6 @@ pub fn default() -> HashMap { "A-del" => delete_word_forward, "C-s" => commit_undo_checkpoint, - "left" => move_char_left, - "C-b" => move_char_left, - "down" => move_line_down, - "up" => move_line_up, - "right" => move_char_right, - "C-f" => move_char_right, - "A-b" => move_prev_word_end, - "C-left" => move_prev_word_end, - "A-f" => move_next_word_start, - "C-right" => move_next_word_start, - "A-<" => goto_file_start, - "A->" => goto_file_end, - "pageup" => page_up, - "pagedown" => page_down, - "home" => goto_line_start, - "C-a" => goto_line_start, - "end" => goto_line_end_newline, - "C-e" => goto_line_end_newline, - "C-k" => kill_to_line_end, "C-u" => kill_to_line_start, From 8a1047c844c9e84ad2a171473438236b6ad1a947 Mon Sep 17 00:00:00 2001 From: Akseli Date: Fri, 9 Sep 2022 02:29:36 +0300 Subject: [PATCH 30/64] Add "markdown" as a possible filetype (#3749) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 12f02781..3082c127 100644 --- a/languages.toml +++ b/languages.toml @@ -904,7 +904,7 @@ source = { git = "https://github.com/Flakebi/tree-sitter-tablegen", rev = "568dd name = "markdown" scope = "source.md" injection-regex = "md|markdown" -file-types = ["md"] +file-types = ["md", "markdown"] roots = [] indent = { tab-width = 2, unit = " " } From 7210b39587be031621a4a77b1866bbdbc6646992 Mon Sep 17 00:00:00 2001 From: ChemicalXandco <32775248+ChemicalXandco@users.noreply.github.com> Date: Fri, 9 Sep 2022 00:36:03 +0100 Subject: [PATCH 31/64] change to openscad-lsp (#3750) --- book/src/generated/lang-support.md | 2 +- languages.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 88c9df91..738bd5ec 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -75,7 +75,7 @@ | ocaml | ✓ | | ✓ | `ocamllsp` | | ocaml-interface | ✓ | | | `ocamllsp` | | odin | ✓ | | | `ols` | -| openscad | ✓ | | | `openscad-language-server` | +| openscad | ✓ | | | `openscad-lsp` | | org | ✓ | | | | | pascal | ✓ | ✓ | | `pasls` | | perl | ✓ | ✓ | ✓ | | diff --git a/languages.toml b/languages.toml index 3082c127..7b4737cf 100644 --- a/languages.toml +++ b/languages.toml @@ -1523,7 +1523,7 @@ injection-regex = "openscad" file-types = ["scad"] roots = [] comment-token = "//" -language-server = { command = "openscad-language-server" } +language-server = { command = "openscad-lsp", args = ["--stdio"] } indent = { tab-width = 2, unit = "\t" } [[grammar]] From 76b3f502c40913cb73096720bc9702c0a5242a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Thu, 8 Sep 2022 20:16:11 +0200 Subject: [PATCH 32/64] feat(lsp): jsonnet-language-server Add jsonnet-language-server for jsonnet language. See: https://github.com/grafana/jsonnet-language-server --- book/src/generated/lang-support.md | 2 +- languages.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 738bd5ec..ca7c1248 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -53,7 +53,7 @@ | javascript | ✓ | ✓ | ✓ | `typescript-language-server` | | jsdoc | ✓ | | | | | json | ✓ | | ✓ | `vscode-json-language-server` | -| jsonnet | ✓ | | | | +| jsonnet | ✓ | | | `jsonnet-language-server` | | jsx | ✓ | ✓ | ✓ | `typescript-language-server` | | julia | ✓ | | | `julia` | | kotlin | ✓ | | | `kotlin-language-server` | diff --git a/languages.toml b/languages.toml index 7b4737cf..417c8280 100644 --- a/languages.toml +++ b/languages.toml @@ -1734,6 +1734,7 @@ file-types = ["libsonnet", "jsonnet"] roots = [] comment-token = "//" indent = { tab-width = 2, unit = " " } +language-server = { command = "jsonnet-language-server", args= ["-t"] } [[grammar]] name = "jsonnet" From 321cce3f13b2609f7d7d4fc3bef4257809acf484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Thu, 8 Sep 2022 23:10:24 +0200 Subject: [PATCH 33/64] enable lint option Enable lint option to highlight unused vars, etc. and take full advantage of the running language server. --- languages.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/languages.toml b/languages.toml index 417c8280..15fbe7fb 100644 --- a/languages.toml +++ b/languages.toml @@ -1731,10 +1731,10 @@ source = { git = "https://github.com/Giorbo/tree-sitter-sml", rev = "bd4055d5554 name = "jsonnet" scope = "source.jsonnet" file-types = ["libsonnet", "jsonnet"] -roots = [] +roots = ["jsonnetfile.json"] comment-token = "//" indent = { tab-width = 2, unit = " " } -language-server = { command = "jsonnet-language-server", args= ["-t"] } +language-server = { command = "jsonnet-language-server", args= ["-t", "--lint"] } [[grammar]] name = "jsonnet" From fae9203c3efd4dee4ac0234090ab9c3163c3e4f7 Mon Sep 17 00:00:00 2001 From: "Soc Virnyl S. Estela" Date: Fri, 9 Sep 2022 08:02:06 +0800 Subject: [PATCH 34/64] Add papercolor dark variant (#3742) --- runtime/themes/papercolor-dark.toml | 118 ++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 runtime/themes/papercolor-dark.toml diff --git a/runtime/themes/papercolor-dark.toml b/runtime/themes/papercolor-dark.toml new file mode 100644 index 00000000..20950469 --- /dev/null +++ b/runtime/themes/papercolor-dark.toml @@ -0,0 +1,118 @@ +# Palette based on https://github.com/NLKNguyen/papercolor-theme +# Author: Soc Virnyl Estela + +"ui.linenr.selected" = { fg = "linenr_fg_selected" } +"ui.background" = {bg="background"} +"ui.text" = "foreground" +"ui.text.focus" = { fg = "selection_background", modifiers = ["bold"]} +"ui.selection" = {bg="selection_background", fg="selection_foreground"} +"ui.cursorline" = {bg="cursorline_background"} +"ui.statusline" = {bg="paper_bar_bg", fg="regular0"} +"ui.statusline.select" = {bg="background", fg="bright7"} +"ui.statusline.normal" = {bg="background", fg="bright3"} +"ui.statusline.inactive" = {bg="background", fg="bright0"} +"ui.virtual.whitespace" = { fg = "regular5" } +"ui.virtual.ruler" = {bg="cursorline_background"} +"ui.cursor.match" = {bg = "regular5", fg = "regular0"} +"ui.cursor" = {bg = "regular5", fg = "background"} +"ui.window" = {bg = "#303030", fg = "bright2"} +"ui.help" = {bg = "background", fg = "bright2"} +"ui.popup" = {bg = "#303030", fg = "bright6"} +"ui.menu" = {bg = "#303030", fg = "bright6"} +"ui.menu.selected" = {bg = "#C6C6C6", fg="selection_foreground"} + +"markup.heading" = { fg = "regular4", modifiers = ["bold"] } +"markup.heading.1" = { fg = "bright2", modifiers = ["bold"] } +"markup.heading.2" = { fg = "bright5", modifiers = ["bold"] } +"markup.heading.3" = { fg = "bright3", modifiers = ["bold"] } +"markup.heading.4" = { fg = "bright5", modifiers = ["bold"] } +"markup.heading.5" = { fg = "bright5", modifiers = ["bold"] } +"markup.heading.6" = { fg = "bright5", modifiers = ["bold"] } +"markup.list" = "bright3" +"markup.bold" = { fg = "foreground", modifiers = ["bold"] } +"markup.italic" = { fg = "bright0", modifiers = ["italic"] } +"markup.link.url" = { fg = "bright6", modifiers = ["underlined"] } +"markup.link.text" = "bright2" +"markup.link.label" = { fg = "regular2", modifiers = ["bold"] } +"markup.raw" = "foreground" + +"string" = "foreground" +"attribute" = "bright7" +"keyword" = { fg = "regular4", modifiers = ["bold"]} +"keyword.directive" = "regular4" +"keyword.control.conditional" = "bright3" +"keyword.function" = "regular4" +"namespace" = "bright1" +"type" = "bright2" +"type.builtin" = { fg = "foreground", modifiers = ["bold"]} +"variable" = "foreground" +"variable.builtin" = "cyan" +"variable.other.member" = "cyan" +"variable.parameter" = "foreground" + +"special" = "#3E999F" +"function" = "bright6" +"constructor" = "regular4" +"function.builtin" = { fg = "foreground", modifiers = ["bold"]} +"function.macro" = { fg = "regular4", modifiers = ["bold"] } +"comment" = { fg = "#686868", modifiers = ["dim"] } +"ui.linenr" = { fg = "bright0" } +"module" = "regular4" +"constant" = "bright5" +"constant.builtin" = "bright6" +"constant.numeric" = "bright5" +"constant.character.escape" = { fg = "foreground", modifiers = ["bold"]} +"operator" = { fg = "regular4", modifiers = ["bold"]} + +"label" = { fg = "selection_background", modifiers = ["bold", "italic"] } + +"diff.plus" = "regular2" +"diff.delta" = "regular6" +"diff.minus" = "regular1" + +"warning" = "bright4" +"error" = "regular1" +"info" = "bright4" +diagnostic = { modifiers = ["bold", "underlined"]} + + +[palette] +background="#1c1c1c" +foreground="#d0d0d0" +regular0="#1c1c1c" +regular1="#af005f" +regular2="#5faf00" +regular3="#d7af5f" +regular4="#5fafd7" +regular5="#808080" +regular6="#d7875f" +regular7="#d0d0d0" +bright0="#585858" +bright1="#5faf5f" +bright2="#afd700" +bright3="#af87d7" +bright4="#FFAF00" +bright5="#ff5faf" +bright6="#00afaf" +bright7="#5f8787" +selection_foreground="#585858" +selection_background="#8787AF" +cursorline_background="#d0d0d0" +paper_bar_bg="#5F8787" +black="#1c1c1c" +red="#af005f" +green="#5faf00" +yellow="#d7af5f" +blue="#5fafd7" +magenta="#808080" +cyan="#d7875f" +gray="#d0d0d0" +light-red="#5faf5f" +light-green="#afd700" +light-yellow="#af87d7" +light-blue="#FFAF00" +light-magenta="#ff5faf" +light-cyan="#00afaf" +light-gray="#5f8787" +white="#808080" +linenr_fg_selected="#FFFF00" From 01ee42bb149adee2fe17561806d9525370c84ef4 Mon Sep 17 00:00:00 2001 From: Evan Richter Date: Sat, 10 Sep 2022 00:14:03 -0500 Subject: [PATCH 35/64] ordinals instead of indexes when listing grammar fetch errors (#3773) --- helix-loader/src/grammar.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index 98a93e56..eb1895a5 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -139,7 +139,7 @@ pub fn fetch_grammars() -> Result<()> { let len = errors.len(); println!("{} grammars failed to fetch", len); for (i, error) in errors.into_iter().enumerate() { - println!("\tFailure {}/{}: {}", i, len, error); + println!("\tFailure {}/{}: {}", i + 1, len, error); } } From cc47d3fb9d048b7fe2546409a492f27f6199adf5 Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Mon, 8 Aug 2022 22:03:41 +0300 Subject: [PATCH 36/64] Add `text` to language completer --- helix-term/src/ui/mod.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 01ffe243..60ad3b24 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -330,13 +330,19 @@ pub mod completers { pub fn language(editor: &Editor, input: &str) -> Vec { let matcher = Matcher::default(); - let mut matches: Vec<_> = editor + let text: String = "text".into(); + + let language_ids = editor .syn_loader .language_configs() - .filter_map(|config| { + .map(|config| &config.language_id) + .chain(std::iter::once(&text)); + + let mut matches: Vec<_> = language_ids + .filter_map(|language_id| { matcher - .fuzzy_match(&config.language_id, input) - .map(|score| (&config.language_id, score)) + .fuzzy_match(language_id, input) + .map(|score| (language_id, score)) }) .collect(); From e8add6f46d0f208c96407151276a985dd34fc93f Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Mon, 8 Aug 2022 22:04:41 +0300 Subject: [PATCH 37/64] Add error handling to set language command If you type a nonexistant language an appropriate message will show, and the language won't be changed. --- helix-term/src/commands/typed.rs | 11 ++++++++++- helix-view/src/document.rs | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index f005d9bf..127eea0d 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1253,7 +1253,16 @@ fn language( } let doc = doc_mut!(cx.editor); - doc.set_language_by_language_id(&args[0], cx.editor.syn_loader.clone()); + + let loader = cx.editor.syn_loader.clone(); + if args[0] == "text" { + doc.set_language(None, Some(loader)) + } else { + let ok = doc.set_language_by_language_id(&args[0], loader); + if !ok { + anyhow::bail!("invalid language: {}", args[0]); + } + } doc.detect_indent_and_line_ending(); let id = doc.id(); diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index a0d50440..84c92320 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -683,9 +683,13 @@ impl Document { &mut self, language_id: &str, config_loader: Arc, - ) { + ) -> bool { let language_config = config_loader.language_config_for_language_id(language_id); + if language_config.is_none() { + return false; + } self.set_language(language_config, Some(config_loader)); + true } /// Set the LSP. From 75e6a6432747eae6d2255afc52f20ced6902519b Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Tue, 9 Aug 2022 10:43:27 +0300 Subject: [PATCH 38/64] Switch to Result for invalid language --- helix-term/src/commands/typed.rs | 8 ++------ helix-view/src/document.rs | 13 ++++++------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 127eea0d..674ce7a6 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1254,14 +1254,10 @@ fn language( let doc = doc_mut!(cx.editor); - let loader = cx.editor.syn_loader.clone(); if args[0] == "text" { - doc.set_language(None, Some(loader)) + doc.set_language(None, None) } else { - let ok = doc.set_language_by_language_id(&args[0], loader); - if !ok { - anyhow::bail!("invalid language: {}", args[0]); - } + doc.set_language_by_language_id(&args[0], cx.editor.syn_loader.clone())?; } doc.detect_indent_and_line_ending(); diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 84c92320..8ebc9002 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -683,13 +683,12 @@ impl Document { &mut self, language_id: &str, config_loader: Arc, - ) -> bool { - let language_config = config_loader.language_config_for_language_id(language_id); - if language_config.is_none() { - return false; - } - self.set_language(language_config, Some(config_loader)); - true + ) -> anyhow::Result<()> { + let language_config = config_loader + .language_config_for_language_id(language_id) + .ok_or_else(|| anyhow!("invalid language id: {}", language_id))?; + self.set_language(Some(language_config), Some(config_loader)); + Ok(()) } /// Set the LSP. From 9c627c65e55ab71e236d70406feb5d55bd8703bb Mon Sep 17 00:00:00 2001 From: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Date: Sat, 10 Sep 2022 16:32:49 +0300 Subject: [PATCH 39/64] Improve error handling for config-reload (#3668) * Don't change config to default when refreshing invalid config * Propely handle theme errors with config-reload * Extract refresh theme into seperate function --- helix-term/src/application.rs | 48 +++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 9653b373..ec698321 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -366,29 +366,39 @@ impl Application { self.editor.refresh_config(); } - fn refresh_config(&mut self) { - let config = Config::load_default().unwrap_or_else(|err| { - self.editor.set_error(err.to_string()); - Config::default() - }); - - // Refresh theme + /// Refresh theme after config change + fn refresh_theme(&mut self, config: &Config) { if let Some(theme) = config.theme.clone() { let true_color = self.true_color(); - self.editor.set_theme( - self.theme_loader - .load(&theme) - .map_err(|e| { - log::warn!("failed to load theme `{}` - {}", theme, e); - e - }) - .ok() - .filter(|theme| (true_color || theme.is_16_color())) - .unwrap_or_else(|| self.theme_loader.default_theme(true_color)), - ); + match self.theme_loader.load(&theme) { + Ok(theme) => { + if true_color || theme.is_16_color() { + self.editor.set_theme(theme); + } else { + self.editor + .set_error("theme requires truecolor support, which is not available"); + } + } + Err(err) => { + let err_string = format!("failed to load theme `{}` - {}", theme, err); + self.editor.set_error(err_string); + } + } } + } - self.config.store(Arc::new(config)); + fn refresh_config(&mut self) { + match Config::load_default() { + Ok(config) => { + self.refresh_theme(&config); + + // Store new config + self.config.store(Arc::new(config)); + } + Err(err) => { + self.editor.set_error(err.to_string()); + } + } } fn true_color(&self) -> bool { From 29fe0c3862a6bf549101c621f72502cc1e7b2631 Mon Sep 17 00:00:00 2001 From: yvt Date: Sat, 10 Sep 2022 22:35:35 +0900 Subject: [PATCH 40/64] Enable CI builds for `riscv64-linux` (#3685) --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d723b98..66be880e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,6 +54,11 @@ jobs: rust: stable target: aarch64-unknown-linux-gnu cross: true + - build: riscv64-linux + os: ubuntu-20.04 + rust: stable + target: riscv64gc-unknown-linux-gnu + cross: true - build: x86_64-macos os: macos-latest rust: stable From 0090a2d86fd573127d28ce99546e200579390d9b Mon Sep 17 00:00:00 2001 From: yvt Date: Mon, 20 Jun 2022 12:31:14 +0900 Subject: [PATCH 41/64] chore(ci): support "preview" release CI runs Expands the trigger sources of the release CI workflow (`release.yml`), allowing the developers to test changes to `.github/workflows/release.yml` easily. The new trigger sources start the workflow in a "preview" mode, in which it publishes build outputs as a CI artifact instead of creating a new release so that they can be manually inspected. The following events trigger the preview mode: - Pushing to any branch matching the glob pattern `patch/ci-release-*`. - Opening a pull request that modifies `.github/workflows/release.yml`. - Pushing versioning tags to a forked repository. --- .github/workflows/release.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 66be880e..c9510ec0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,18 @@ on: tags: - '[0-9]+.[0-9]+' - '[0-9]+.[0-9]+.[0-9]+' + branches: + - 'patch/ci-release-*' + pull_request: + paths: + - '.github/workflows/release.yml' + +env: + # Preview mode: Publishes the build output as a CI artifact instead of creating + # a release, allowing for manual inspection of the output. This mode is + # activated if the CI run was triggered by events other than pushed tags, or + # if the repository is a fork. + preview: ${{ !startsWith(github.ref, 'refs/tags/') || github.repository != 'helix-editor/helix' }} jobs: fetch-grammars: @@ -268,9 +280,17 @@ jobs: - name: Upload binaries to release uses: svenstaro/upload-release-action@v2 + if: env.preview == 'false' with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: dist/* file_glob: true tag: ${{ steps.tagname.outputs.val }} overwrite: true + + - name: Upload binaries as artifact + uses: actions/upload-artifact@v2 + if: env.preview == 'true' + with: + name: release + path: dist/* From 02d6102540eb1d3d2ffda0e2050f65d0daf97258 Mon Sep 17 00:00:00 2001 From: yvt Date: Sat, 10 Sep 2022 13:15:49 +0900 Subject: [PATCH 42/64] chore(ci): upgrade `actions/upload-artifact` to v3 Co-authored-by: Michael Davis --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9510ec0..481e7b32 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -289,7 +289,7 @@ jobs: overwrite: true - name: Upload binaries as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: env.preview == 'true' with: name: release From 5489c9ad4e66af24165b9bc6d37a05275ccd19b4 Mon Sep 17 00:00:00 2001 From: yvt Date: Sat, 10 Sep 2022 17:36:53 +0900 Subject: [PATCH 43/64] chore: rename `.cargo/{config -> config.toml}` --- .cargo/{config => config.toml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .cargo/{config => config.toml} (100%) diff --git a/.cargo/config b/.cargo/config.toml similarity index 100% rename from .cargo/config rename to .cargo/config.toml From 54e78dd24f2cfcf98a974d6f4d5846cc1cb5c9eb Mon Sep 17 00:00:00 2001 From: Erasin Date: Sat, 10 Sep 2022 21:45:52 +0800 Subject: [PATCH 44/64] Add godot resource support (#3759) Co-authored-by: Michael Davis --- book/src/generated/lang-support.md | 1 + languages.toml | 15 ++++++++++ runtime/queries/godot-resource/highlights.scm | 28 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 runtime/queries/godot-resource/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index ca7c1248..70609464 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -38,6 +38,7 @@ | gleam | ✓ | ✓ | | `gleam` | | glsl | ✓ | ✓ | ✓ | | | go | ✓ | ✓ | ✓ | `gopls` | +| godot-resource | ✓ | | | | | gomod | ✓ | | | `gopls` | | gotmpl | ✓ | | | `gopls` | | gowork | ✓ | | | `gopls` | diff --git a/languages.toml b/languages.toml index 15fbe7fb..1a3be93c 100644 --- a/languages.toml +++ b/languages.toml @@ -1333,6 +1333,21 @@ indent = { tab-width = 4, unit = " " } name = "gdscript" source = { git = "https://github.com/PrestonKnopp/tree-sitter-gdscript", rev = "2a6abdaa47fcb91397e09a97c7433fd995ea46c6" } +[[language]] +name = "godot-resource" +scope = "source.tscn" +injection-regex = "godot" +file-types = ["tscn","tres"] +shebangs = [] +roots = ["project.godot"] +auto-format = false +comment-token = "#" +indent = { tab-width = 4, unit = "\t" } + +[[grammar]] +name = "godot-resource" +source = { git = "https://github.com/PrestonKnopp/tree-sitter-godot-resource", rev = "b6ef0768711086a86b3297056f9ffb5cc1d77b4a" } + [[language]] name = "nu" scope = "source.nu" diff --git a/runtime/queries/godot-resource/highlights.scm b/runtime/queries/godot-resource/highlights.scm new file mode 100644 index 00000000..18dae41f --- /dev/null +++ b/runtime/queries/godot-resource/highlights.scm @@ -0,0 +1,28 @@ +(section (identifier) @type.builtin) + +(attribute (identifier) @attribute) +(property (path) @variable.other.member) +(constructor (identifier) @constructor) + +(string) @string +(integer) @constant.numeric.integer +(float) @constant.numeric.float + +(true) @constant.builtin.boolean +(false) @constant.builtin.boolean + +[ + "[" + "]" +] @tag + +[ + "(" + ")" + "{" + "}" +] @punctuation.bracket + +"=" @operator + +(ERROR) @error \ No newline at end of file From a15420ed1c3b46df0dade6ec6d05a0e4b26e06e0 Mon Sep 17 00:00:00 2001 From: Erasin Date: Sat, 10 Sep 2022 21:47:08 +0800 Subject: [PATCH 45/64] Add textobject for gdscript (#3760) --- book/src/generated/lang-support.md | 2 +- languages.toml | 2 +- runtime/queries/gdscript/highlights.scm | 5 +++++ runtime/queries/gdscript/textobjects.scm | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 runtime/queries/gdscript/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 70609464..37ceec16 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -29,7 +29,7 @@ | esdl | ✓ | | | | | fish | ✓ | ✓ | ✓ | | | fortran | ✓ | | ✓ | `fortls` | -| gdscript | ✓ | | | | +| gdscript | ✓ | ✓ | | | | git-attributes | ✓ | | | | | git-commit | ✓ | | | | | git-config | ✓ | | | | diff --git a/languages.toml b/languages.toml index 1a3be93c..83e4affd 100644 --- a/languages.toml +++ b/languages.toml @@ -1327,7 +1327,7 @@ shebangs = [] roots = ["project.godot"] auto-format = true comment-token = "#" -indent = { tab-width = 4, unit = " " } +indent = { tab-width = 4, unit = "\t" } [[grammar]] name = "gdscript" diff --git a/runtime/queries/gdscript/highlights.scm b/runtime/queries/gdscript/highlights.scm index 0849eedb..f36f4e35 100644 --- a/runtime/queries/gdscript/highlights.scm +++ b/runtime/queries/gdscript/highlights.scm @@ -3,6 +3,11 @@ ((identifier) @constant (#match? @constant "^[A-Z][A-Z_]*$")) +; class +(class_name_statement (name) @type) +(class_definition (name) @type) + + ; Function calls (attribute_call (identifier) @function) diff --git a/runtime/queries/gdscript/textobjects.scm b/runtime/queries/gdscript/textobjects.scm new file mode 100644 index 00000000..08954468 --- /dev/null +++ b/runtime/queries/gdscript/textobjects.scm @@ -0,0 +1,17 @@ + +(class_definition + (body) @class.inside) @class.around + +(function_definition + (body) @function.inside) @function.around + +(parameters + [ + (identifier) + (typed_parameter) + (default_parameter) + (typed_default_parameter) + ] @parameter.inside @parameter.around) + +(comment) @comment.inside +(comment)+ @comment.around From c2e41082e4b2e0e1dba6a980a7f09ccaad88cbd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Sun, 11 Sep 2022 11:09:12 +0900 Subject: [PATCH 46/64] Remove the .txt suffix from tutor The tutor file is loaded as .txt which can potentially spawn a language server. Then the path is unset, but the LS remains active. This can cause panics since updates are now submitted for a doc with no path. As a quick workaround we remove the extension which should avoid detection. Fixes #3730 --- book/src/usage.md | 2 +- helix-term/src/application.rs | 2 +- helix-term/src/commands/typed.rs | 2 +- runtime/{tutor.txt => tutor} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename runtime/{tutor.txt => tutor} (100%) diff --git a/book/src/usage.md b/book/src/usage.md index ba631b62..164ae267 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -2,7 +2,7 @@ (Currently not fully documented, see the [keymappings](./keymap.md) list for more.) -See [tutor.txt](https://github.com/helix-editor/helix/blob/master/runtime/tutor.txt) (accessible via `hx --tutor` or `:tutor`) for a vimtutor-like introduction. +See [tutor](https://github.com/helix-editor/helix/blob/master/runtime/tutor) (accessible via `hx --tutor` or `:tutor`) for a vimtutor-like introduction. ## Registers diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index ec698321..7ee5b7f1 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -157,7 +157,7 @@ impl Application { compositor.push(editor_view); if args.load_tutor { - let path = helix_loader::runtime_dir().join("tutor.txt"); + let path = helix_loader::runtime_dir().join("tutor"); editor.open(&path, Action::VerticalSplit)?; // Unset path to prevent accidentally saving to the original tutor file. doc_mut!(editor).set_path(None)?; diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 674ce7a6..c22f8712 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1147,7 +1147,7 @@ fn tutor( return Ok(()); } - let path = helix_loader::runtime_dir().join("tutor.txt"); + let path = helix_loader::runtime_dir().join("tutor"); cx.editor.open(&path, Action::Replace)?; // Unset path to prevent accidentally saving to the original tutor file. doc_mut!(cx.editor).set_path(None)?; diff --git a/runtime/tutor.txt b/runtime/tutor similarity index 100% rename from runtime/tutor.txt rename to runtime/tutor From b191ecf828b3bb2a20a8848fc2a45de771741502 Mon Sep 17 00:00:00 2001 From: yvt Date: Sun, 11 Sep 2022 11:15:07 +0900 Subject: [PATCH 47/64] Strip release binary by setting `profile.release.strip` in a pre-build step (#3780) * chore(ci): remove the strip step from the release CI workflow * chore(ci): set `profile.release.strip = true` in the release CI workflow --- .github/workflows/release.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 481e7b32..e7aca89b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -133,6 +133,14 @@ jobs: command: test args: --release --locked --target ${{ matrix.target }} --workspace + - name: Set profile.release.strip = true + shell: bash + run: | + cat >> .cargo/config.toml < Date: Sun, 11 Sep 2022 13:11:35 +0200 Subject: [PATCH 48/64] Update usage.md with paragraph textobject(#3797) --- book/src/usage.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/book/src/usage.md b/book/src/usage.md index 164ae267..600a514f 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -125,8 +125,6 @@ will move the selection over to the "func" `identifier`. ## Textobjects -Currently supported: `word`, `surround`, `function`, `class`, `parameter`. - ![textobject-demo](https://user-images.githubusercontent.com/23398472/124231131-81a4bb00-db2d-11eb-9d10-8e577ca7b177.gif) ![textobject-treesitter-demo](https://user-images.githubusercontent.com/23398472/132537398-2a2e0a54-582b-44ab-a77f-eb818942203d.gif) @@ -137,6 +135,7 @@ Currently supported: `word`, `surround`, `function`, `class`, `parameter`. | --- | --- | | `w` | Word | | `W` | WORD | +| `p` | Paragraph | | `(`, `[`, `'`, etc | Specified surround pairs | | `m` | Closest surround pair | | `f` | Function | From 865a1a4cb328bcd35e89e3fdb901283c39857686 Mon Sep 17 00:00:00 2001 From: Fanda Vacek Date: Mon, 12 Sep 2022 16:15:41 +0200 Subject: [PATCH 49/64] Make whitespace in monokai-pro-spectrum theme one step dimmer to avoid (#3814) the white space confusion with hyphen Co-authored-by: Fanda Vacek --- runtime/themes/monokai_pro_spectrum.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/themes/monokai_pro_spectrum.toml b/runtime/themes/monokai_pro_spectrum.toml index a42a2681..89575e3a 100644 --- a/runtime/themes/monokai_pro_spectrum.toml +++ b/runtime/themes/monokai_pro_spectrum.toml @@ -6,7 +6,7 @@ "ui.text.focus" = { fg = "yellow", modifiers= ["bold"] } "ui.menu" = { fg = "base8", bg = "base3" } "ui.menu.selected" = { fg = "base2", bg = "yellow" } -"ui.virtual.whitespace" = "base5" +"ui.virtual.whitespace" = "base4" "ui.virtual.ruler" = { bg = "base1" } "info" = "base8" From 936ad884ebcec8f274a69bc4178f5866bafcdf4b Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 12 Sep 2022 09:15:54 -0500 Subject: [PATCH 50/64] Remove arrow key recommendation from tutor (#3811) --- runtime/tutor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/tutor b/runtime/tutor index 4a6c4425..dc0a345a 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -102,12 +102,12 @@ _________________________________________________________________ --> Th stce misg so. This sentence is missing some text. - Note: If you want to move the cursor while in Insert mode, - you may use the arrow keys instead of exiting and - reentering Insert mode. Note: The status bar will display your current mode. Notice that when you type i, 'NOR' changes to 'INS'. + + + ================================================================= = 1.5 SAVING A FILE = ================================================================= From 23027a454a1f383739f353f722169a4d5b0506ff Mon Sep 17 00:00:00 2001 From: Alex Mayer Date: Mon, 12 Sep 2022 10:32:24 -0400 Subject: [PATCH 51/64] Clean Up Nord Theme (#3792) - Add markup styles - Replace custom colors with Nord colors - Clean up code spacing --- runtime/themes/nord.toml | 63 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/runtime/themes/nord.toml b/runtime/themes/nord.toml index a2aff585..6260ddbe 100644 --- a/runtime/themes/nord.toml +++ b/runtime/themes/nord.toml @@ -1,11 +1,10 @@ # Author : RayGervais -"ui.linenr.selected" = { fg = "nord4" } +"ui.linenr.selected" = "nord4" "ui.cursorline.primary" = { bg = "nord1" } -"ui.text.focus" = { fg = "nord8", modifiers= ["bold"] } -"ui.menu" = { fg = "nord6", bg = "#232d38" } +"ui.text.focus" = { fg = "nord8", modifiers = ["bold"] } +"ui.menu" = { fg = "nord6", bg = "nord1" } "ui.menu.selected" = { fg = "nord8", bg = "nord2" } -"ui.virtual.whitespace" = "gray" "ui.virtual.ruler" = { bg = "nord1" } "info" = "nord8" @@ -14,33 +13,33 @@ # Polar Night # nord0 - background color "ui.background" = { bg = "nord0" } -"ui.statusline.inactive" = { fg = "nord8", bg = "nord1" } +"ui.statusline.inactive" = { fg = "nord8", bg = "nord1" } "ui.statusline.normal" = { fg = "nord0", bg = "nord8" } "ui.statusline.insert" = { fg = "nord0", bg = "nord13" } "ui.statusline.select" = { fg = "nord0", bg = "nord15" } # nord1 - status bars, panels, modals, autocompletion -"ui.statusline" = { fg = "nord4", bg = "#4c566a" } -"ui.popup" = { bg = "#232d38" } -"ui.window" = { bg = "#232d38" } -"ui.help" = { bg = "#232d38", fg = "nord4" } +"ui.statusline" = { fg = "nord4", bg = "nord1" } +"ui.popup" = { bg = "nord1" } +"ui.window" = { bg = "nord1" } +"ui.help" = { bg = "nord1", fg = "nord4" } # nord2 - active line, highlighting "ui.selection" = { bg = "nord2" } "ui.cursor.match" = { bg = "nord2" } -# nord3 - comments, nord3 based lighter color -# relative: https://github.com/arcticicestudio/nord/issues/94 -"comment" = { fg = "gray", modifiers = ["italic"] } -"ui.linenr" = { fg = "gray" } +# nord3 - comments, invisible/non-printable characters +"comment" = { fg = "nord3_bright", modifiers = ["italic"] } +"ui.linenr" = "nord3_bright" +"ui.virtual.whitespace" = "nord3_bright" # Snow Storm # nord4 - cursor, variables, constants, attributes, fields "ui.cursor.primary" = { fg = "nord4", modifiers = ["reversed"] } "attribute" = "nord4" -"variable" = "nord4" -"constant" = "nord4" +"variable" = "nord4" +"constant" = "nord4" "variable.builtin" = "nord4" "constant.builtin" = "nord4" "namespace" = "nord4" @@ -48,28 +47,28 @@ # nord5 - subtle UI text # nord6 - base text, punctuation -"ui.text" = { fg = "nord6" } +"ui.text" = "nord6" "punctuation" = "nord6" # Frost # nord7 - classes, types, primitives "type" = "nord7" -"type.builtin" = { fg = "nord7"} +"type.builtin" = "nord7" "label" = "nord7" # nord8 - declaration, methods, routines "constructor" = "nord8" "function" = "nord8" -"function.macro" = { fg = "nord8" } -"function.builtin" = { fg = "nord8" } +"function.macro" = "nord8" +"function.builtin" = "nord8" # nord9 - operator, tags, units, punctuations "punctuation.delimiter" = "nord9" -"operator" = { fg = "nord9" } +"operator" = "nord9" "variable.other.member" = "nord9" # nord10 - keywords, special -"keyword" = { fg = "nord10" } +"keyword" = "nord10" "keyword.directive" = "nord10" "variable.parameter" = "nord10" @@ -83,7 +82,7 @@ # nord13 - warnings, escape characters, regex "warning" = "nord13" -"constant.character.escape" = { fg = "nord13" } +"constant.character.escape" = "nord13" # nord14 - strings "string" = "nord14" @@ -91,15 +90,13 @@ # nord15 - integer, floating point "constant.numeric" = "nord15" -# TODO markup -"markup.heading" = "blue" -"markup.list" = "red" -"markup.bold" = { fg = "yellow", modifiers = ["bold"] } -"markup.italic" = { fg = "magenta", modifiers = ["italic"] } -"markup.link.url" = { fg = "yellow", modifiers = ["underlined"] } -"markup.link.text" = "red" -"markup.quote" = "cyan" -"markup.raw" = "green" +# markup +"markup.heading" = "nord8" +"markup.list" = "nord9" +"markup.bold" = { modifiers = ["bold"] } +"markup.italic" = { modifiers = ["italic"] } +"markup.link.text" = "nord8" +"markup.raw" = "nord7" # vcs "diff.plus" = "nord14" @@ -110,6 +107,9 @@ nord0 = "#2e3440" nord1 = "#3b4252" nord2 = "#434c5e" +# we use a brighter nord3 based on discussion here: +# https://github.com/arcticicestudio/nord/issues/94 +nord3_bright = "#616e88" nord4 = "#d8dee9" nord6 = "#eceff4" nord7 = "#8fbcbb" @@ -121,4 +121,3 @@ nord12 = "#d08770" nord13 = "#ebcb8b" nord14 = "#a3be8c" nord15 = "#b48ead" -gray = "#616e88" From 800a4906767d69443cda183acd0e982f88c7b29a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 10:01:38 +0900 Subject: [PATCH 52/64] build(deps): bump url from 2.2.2 to 2.3.1 (#3828) Bumps [url](https://github.com/servo/rust-url) from 2.2.2 to 2.3.1. - [Release notes](https://github.com/servo/rust-url/releases) - [Commits](https://github.com/servo/rust-url/compare/v2.2.2...v2.3.1) --- updated-dependencies: - dependency-name: url dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 341f0f6a..d8d82d28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -268,11 +268,10 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" dependencies = [ - "matches", "percent-encoding", ] @@ -564,11 +563,10 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" dependencies = [ - "matches", "unicode-bidi", "unicode-normalization", ] @@ -675,12 +673,6 @@ dependencies = [ "url", ] -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - [[package]] name = "memchr" version = "2.5.0" @@ -768,9 +760,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pin-project-lite" @@ -1298,13 +1290,12 @@ checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "url" -version = "2.2.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", "idna", - "matches", "percent-encoding", "serde", ] From 16b9a1841ff2d53e855522d24f0749b06ed30186 Mon Sep 17 00:00:00 2001 From: Alexander Brevig Date: Tue, 13 Sep 2022 08:08:23 +0200 Subject: [PATCH 53/64] fix: map_err()? instead of unwrap (#3826) --- helix-core/src/syntax.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 6ec56bde..e0a984d2 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -985,7 +985,9 @@ impl LanguageLayer { } fn parse(&mut self, parser: &mut Parser, source: &Rope) -> Result<(), Error> { - parser.set_included_ranges(&self.ranges).unwrap(); + parser + .set_included_ranges(&self.ranges) + .map_err(|_| Error::InvalidRanges)?; parser .set_language(self.config.language) @@ -1135,6 +1137,7 @@ pub struct Highlight(pub usize); pub enum Error { Cancelled, InvalidLanguage, + InvalidRanges, Unknown, } From 0d8ffa6b4ae8de827b24df9aaccc4a2e43465d58 Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Tue, 13 Sep 2022 02:49:18 -0400 Subject: [PATCH 54/64] add example config for all removed insert mode bindings (#3827) --- book/src/keymap.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index da4433f3..5a506ba0 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -341,10 +341,25 @@ mode: ```toml [keys.insert] -up = "move_line_up" -down = "move_line_down" -left = "move_char_left" -right = "move_char_right" +"up" = "move_line_up" +"down" = "move_line_down" +"left" = "move_char_left" +"right" = "move_char_right" +"C-b" = "move_char_left" +"C-f" = "move_char_right" +"A-b" = "move_prev_word_end" +"C-left" = "move_prev_word_end" +"A-f" = "move_next_word_start" +"C-right" = "move_next_word_start" +"A-<" = "goto_file_start" +"A->" = "goto_file_end" +"pageup" = "page_up" +"pagedown" = "page_down" +"home" = "goto_line_start" +"C-a" = "goto_line_start" +"end" = "goto_line_end_newline" +"C-e" = "goto_line_end_newline" +"A-left" = "goto_line_start" ``` ## Select / extend mode From ffb41a94f040e251a3269e0d13417b16bef244c0 Mon Sep 17 00:00:00 2001 From: Benjamin Streit Date: Tue, 13 Sep 2022 01:53:55 -0500 Subject: [PATCH 55/64] feat: Syntax highlighting for Astro files (#3829) --- book/src/generated/lang-support.md | 1 + languages.toml | 12 ++++++++++++ runtime/queries/astro/highlights.scm | 3 +++ runtime/queries/astro/injections.scm | 9 +++++++++ 4 files changed, 25 insertions(+) create mode 100644 runtime/queries/astro/highlights.scm create mode 100644 runtime/queries/astro/injections.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 37ceec16..78362384 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -1,5 +1,6 @@ | Language | Syntax Highlighting | Treesitter Textobjects | Auto Indent | Default LSP | | --- | --- | --- | --- | --- | +| astro | ✓ | | | | | awk | ✓ | ✓ | | `awk-language-server` | | bash | ✓ | | | `bash-language-server` | | beancount | ✓ | | | | diff --git a/languages.toml b/languages.toml index 83e4affd..5e563178 100644 --- a/languages.toml +++ b/languages.toml @@ -1754,3 +1754,15 @@ language-server = { command = "jsonnet-language-server", args= ["-t", "--lint"] [[grammar]] name = "jsonnet" source = { git = "https://github.com/sourcegraph/tree-sitter-jsonnet", rev = "0475a5017ad7dc84845d1d33187f2321abcb261d" } + +[[language]] +name = "astro" +scope = "source.astro" +injection-regex = "astro" +file-types = ["astro"] +roots = [] +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "astro" +source = { git = "https://github.com/virchau13/tree-sitter-astro", rev = "5f5c3e73c45967df9aa42f861fad2d77cd4e0900" } diff --git a/runtime/queries/astro/highlights.scm b/runtime/queries/astro/highlights.scm new file mode 100644 index 00000000..3d0792b8 --- /dev/null +++ b/runtime/queries/astro/highlights.scm @@ -0,0 +1,3 @@ +; inherits: html + +["---"] @punctuation.delimiter diff --git a/runtime/queries/astro/injections.scm b/runtime/queries/astro/injections.scm new file mode 100644 index 00000000..e3cff178 --- /dev/null +++ b/runtime/queries/astro/injections.scm @@ -0,0 +1,9 @@ +; inherits: html + +((frontmatter + (raw_text) @injection.content) + (#set! injection.language "typescript")) + +((interpolation + (raw_text) @injection.content) + (#set! injection.language "tsx")) From ac460ac8371e2d7cfe99b9e06be9b8f5edac1c44 Mon Sep 17 00:00:00 2001 From: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Date: Tue, 13 Sep 2022 12:14:16 +0300 Subject: [PATCH 56/64] Render html tags as code in markdown (#3425) --- helix-term/src/ui/markdown.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index a0b299e7..923dd73a 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -178,6 +178,21 @@ impl Markdown { .map(|key| get_theme(key)) .collect(); + // Transform text in `` blocks into `Event::Code` + let mut in_code = false; + let parser = parser.filter_map(|event| match event { + Event::Html(tag) if *tag == *"" => { + in_code = true; + None + } + Event::Html(tag) if *tag == *"" => { + in_code = false; + None + } + Event::Text(text) if in_code => Some(Event::Code(text)), + _ => Some(event), + }); + for event in parser { match event { Event::Start(Tag::List(list)) => { From d38950bdf9ac786dc518fa723b92a3f189f2b960 Mon Sep 17 00:00:00 2001 From: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Date: Tue, 13 Sep 2022 12:24:48 +0300 Subject: [PATCH 57/64] Remove border from code actions popup (#3444) --- helix-term/src/commands/lsp.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 61eed638..1113b44e 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -491,8 +491,7 @@ pub fn code_action(cx: &mut Context) { }); picker.move_down(); // pre-select the first item - let popup = - Popup::new("code-action", picker).margin(helix_view::graphics::Margin::all(1)); + let popup = Popup::new("code-action", picker); compositor.replace_or_push("code-action", popup); }, ) From ec81ec1e8d26e3a99ed713b79381a77daf817d34 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 13 Sep 2022 08:50:53 -0500 Subject: [PATCH 58/64] flake: Fix devShell on aarch64-darwin (#3810) LLDB is marked broken on all arches except for x86_64-linux. With this change, I can use `nix develop` on aarch64-darwin. --- flake.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index abcb2cb2..8cb4b663 100644 --- a/flake.nix +++ b/flake.nix @@ -92,8 +92,9 @@ prev.packages ++ ( with common.pkgs; - [lld_13 lldb cargo-flamegraph rust-analyzer] + [lld_13 cargo-flamegraph rust-analyzer] ++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin) + ++ (lib.optional stdenv.isLinux lldb) ); env = prev.env From b5be72bff79075ef4b5b51922da15e003c274b9b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 11 Sep 2022 09:13:45 +0200 Subject: [PATCH 59/64] Canonicalize executable path When looking up the runtime/ directory relative to the executable path, canonicalize the path first in case the executable is a symbolic link. Fixes #3768 --- helix-loader/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index 015b39a5..3c9905f5 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -42,8 +42,10 @@ pub fn runtime_dir() -> PathBuf { } // fallback to location of the executable being run + // canonicalize the path in case the executable is symlinked std::env::current_exe() .ok() + .and_then(|path| std::fs::canonicalize(path).ok()) .and_then(|path| path.parent().map(|path| path.to_path_buf().join(RT_DIR))) .unwrap() } From 73f8e9902b02d30a5194d52fa8a3f65001608141 Mon Sep 17 00:00:00 2001 From: Kristoffer Flottorp <2630397+krfl@users.noreply.github.com> Date: Fri, 16 Sep 2022 04:38:54 +0200 Subject: [PATCH 60/64] improve fleetish theme (#3844) Co-authored-by: krfl --- runtime/themes/fleetish.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/themes/fleetish.toml b/runtime/themes/fleetish.toml index 70de2f8a..a5b09fe4 100644 --- a/runtime/themes/fleetish.toml +++ b/runtime/themes/fleetish.toml @@ -64,11 +64,12 @@ "ui.window" = { fg = "dark", bg = "darkest" } "ui.help" = { fg = "light", bg = "dark" } "ui.text" = { fg = "light" } # .focus / .info -# "ui.virtual" = {} # .ruler / .whitespace +"ui.virtual" = { fg = "dark" } # .ruler / .whitespace "ui.virtual.ruler" = { bg = "darker"} "ui.menu" = { fg = "light", bg = "dark" } # .selected "ui.menu.selected" = { fg = "lightest", bg = "blue_accent" } # .selected -"ui.selection" = { bg = "select" } # .primary +"ui.selection" = { bg = "darker" } # .primary +"ui.selection.primary" = { bg = "select" } # .primary "hint" = { fg = "blue_accent"} "info" = { fg = "yellow_accent" } "warning" = { fg = "orange_accent" } From 111d2dafd3bbbacff68e1f9f21e4106db560b28f Mon Sep 17 00:00:00 2001 From: Kristoffer Flottorp <2630397+krfl@users.noreply.github.com> Date: Fri, 16 Sep 2022 04:39:06 +0200 Subject: [PATCH 61/64] Improve flatwhite theme (#3843) Co-authored-by: krfl --- runtime/themes/flatwhite.toml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/runtime/themes/flatwhite.toml b/runtime/themes/flatwhite.toml index 030947e6..d4c837b6 100644 --- a/runtime/themes/flatwhite.toml +++ b/runtime/themes/flatwhite.toml @@ -1,30 +1,30 @@ -# Author: Alexander Brevig +# Author: Alexander Brevig , krfl # Adopted from https://github.com/biletskyy/flatwhite-syntax "attribute" = { fg = "blue_text", bg = "blue_bg" } -"comment" = { fg = "base3", bg = "base7", modifiers = ["italic"] } +"comment" = { fg = "base3", modifiers = ["italic"] } "comment.line" = {} "comment.block" = {} "comment.block.documentation" = { fg = "base2" } "constant" = { fg = "blue_text", bg = "blue_bg" } -"constructor" = { fg = "base1", bg = "base7" } -"function" = { fg = "base1", bg = "base7", modifiers = ["bold"] } +"constructor" = { fg = "base1" } +"function" = { fg = "base1", modifiers = ["bold"] } "keyword" = { fg = "purple_text", bg = "purple_bg" } "label" = { modifiers = ["bold"] } "namespace" = { fg = "teal_text", bg = "teal_bg" } -"operator" = { fg = "base1", bg = "base7" } +"operator" = { fg = "base1" } "punctuation.bracket" = { modifiers = ["bold"] } "special" = { fg = "blue_text", bg = "blue_bg" } "string" = { fg = "green_text", bg = "green_bg" } -"type" = { fg = "base1", bg = "base7" } -"variable" = { fg = "base1", bg = "base7" } +"type" = { fg = "base1" } +"variable" = { fg = "base1" } "variable.parameter" = { fg = "blue_text", bg = "blue_bg" } "diagnostic" = { modifiers = ["underlined"] } "info" = { fg = "orange_text", bg = "orange_bg" } "hint" = { modifiers = ["bold"] } "warning" = { fg = "orange_text", bg = "orange_bg" } -"error" = { fg = "diff_delete", bg = "base7" } +"error" = { fg = "diff_delete" } "markup.heading" = { fg = "purple_text", bg = "purple_bg", modifiers = [ "bold", @@ -47,11 +47,12 @@ "ui.cursor" = { fg = "base1", bg = "base7", modifiers = ["reversed"] } "ui.cursor.primary" = { fg = "base1", bg = "base7", modifiers = ["reversed"] } "ui.cursor.match" = { fg = "base5", bg = "base3", modifiers = ["reversed"] } -"ui.selection" = { bg = "base3" } -"ui.selection.primary" = { fg = "base5", bg = "base3" } +"ui.selection" = { bg = "base4" } +"ui.selection.primary" = { fg = "base6", bg = "base2" } -"ui.virtual" = { bg = "base6" } -"ui.virtual.whitespace" = { bg = "base7" } +"ui.virtual" = { fg = "base5", bg = "base6" } +"ui.virtual.whitespace" = { fg = "base5" } +"ui.virtual.ruler" = { bg = "base6" } "ui.linenr" = { bg = "base6" } "ui.linenr.selected" = { bg = "base6", modifiers = ["reversed"] } @@ -66,15 +67,15 @@ "bold", ] } -"ui.text" = { fg = "base1", bg = "base7" } -"ui.text.focus" = { fg = "base1", bg = "base6", modifiers = ["bold"] } +"ui.text" = { fg = "base1" } +"ui.text.focus" = { fg = "base1", modifiers = ["bold"] } "ui.menu" = { fg = "base1", bg = "base6" } "ui.menu.selected" = { fg = "base1", bg = "base6", modifiers = ["reversed"] } "ui.menu.scroll" = { fg = "base1", bg = "base6" } -"ui.help" = { fg = "base1", bg = "base7" } -"ui.popup" = { fg = "base1", bg = "base7" } -"ui.window" = { fg = "base1", bg = "base7" } +"ui.help" = { fg = "base1", bg = "base6" } +"ui.popup" = { fg = "base1", bg = "base6" } +"ui.window" = { fg = "base1", bg = "base6" } "diff.plus" = { bg = "diff_add" } "diff.delta" = { bg = "diff_change" } From 714db9c66665133e599c6d494b7fb46fcaee1da1 Mon Sep 17 00:00:00 2001 From: Benjamin Streit Date: Fri, 16 Sep 2022 02:51:19 -0500 Subject: [PATCH 62/64] fix: Improving JSX and TSX indents (#3853) --- languages.toml | 4 ++-- runtime/queries/jsx/indents.scm | 8 ++++++++ runtime/queries/tsx/indents.scm | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/languages.toml b/languages.toml index 5e563178..0b46cc49 100644 --- a/languages.toml +++ b/languages.toml @@ -332,7 +332,7 @@ source = { git = "https://github.com/omertuc/tree-sitter-go-work", rev = "6dd9dd name = "javascript" scope = "source.js" injection-regex = "(js|javascript)" -file-types = ["js", "jsx", "mjs", "cjs"] +file-types = ["js", "mjs", "cjs"] shebangs = ["node"] roots = [] comment-token = "//" @@ -363,7 +363,7 @@ injection-regex = "jsx" file-types = ["jsx"] roots = [] comment-token = "//" -language-server = { command = "typescript-language-server", args = ["--stdio"], language-id = "javascript" } +language-server = { command = "typescript-language-server", args = ["--stdio"], language-id = "javascriptreact" } indent = { tab-width = 2, unit = " " } grammar = "javascript" diff --git a/runtime/queries/jsx/indents.scm b/runtime/queries/jsx/indents.scm index 04328f09..6cb82545 100644 --- a/runtime/queries/jsx/indents.scm +++ b/runtime/queries/jsx/indents.scm @@ -1 +1,9 @@ +[ + (jsx_fragment) + (jsx_element) + (jsx_self_closing_element) +] @indent + +(parenthesized_expression) @indent + ; inherits: ecma diff --git a/runtime/queries/tsx/indents.scm b/runtime/queries/tsx/indents.scm index 1b61e36d..07391231 100644 --- a/runtime/queries/tsx/indents.scm +++ b/runtime/queries/tsx/indents.scm @@ -1 +1 @@ -; inherits: typescript +; inherits: typescript,jsx From 19384cc3a18ad56e3f06ecc43cf91c1641f36f90 Mon Sep 17 00:00:00 2001 From: Nick Ogden Date: Fri, 16 Sep 2022 17:21:56 +0100 Subject: [PATCH 63/64] Add darcula theme based upon Intelij Darcula (#3739) --- runtime/themes/darcula.toml | 91 +++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 runtime/themes/darcula.toml diff --git a/runtime/themes/darcula.toml b/runtime/themes/darcula.toml new file mode 100644 index 00000000..00176ff2 --- /dev/null +++ b/runtime/themes/darcula.toml @@ -0,0 +1,91 @@ +# Author : Nick Ogden + +"ui.background" = { bg = "grey01" } +"ui.menu" = { fg = "grey05", bg = "grey00" } +"ui.menu.selected" = { fg = "grey01", bg = "grey04" } +"ui.linenr" = { fg = "grey03", bg = "grey01" } +"ui.linenr.selected" = { fg = "grey04", bg = "grey01", modifiers = ["bold"] } +"ui.gutter" = { bg = "grey01" } +"ui.popup" = { fg = "grey05", bg = "grey00" } +"ui.window" = { bg = "grey01" } +"ui.selection" = { bg = "grey03" } +"ui.statusline" = { fg = "grey04", bg = "grey02" } +"ui.statusline.insert" = { bg = "white", fg = "grey01" } +"ui.statusline.select" = { bg = "orange", fg = "grey01" } +"ui.help" = { fg = "grey04", bg = "grey01" } +"ui.cursor" = { fg = "grey04", modifiers = ["reversed"] } +"ui.cursor.primary" = { fg = "grey05", modifiers = ["reversed"] } +"ui.cursor.match" = { fg = "white", modifiers = ["underlined"] } +"ui.cursorline.primary" = { bg = "grey02" } +"ui.cursorline.secondary" = { bg = "grey02" } +"ui.text" = "white" +"ui.text.focus" = "grey05" +"ui.virtual.ruler" = { bg = "grey02" } +"ui.virtual.indent-guide" = "grey02" +"ui.virtual.whitespace" = "grey03" + +"operator" = "grey05" +"variable" = "white" +"variable.other.member" = "yellow" +"constant" = "lightblue" +"constant.numeric" = "lightblue" +"constant.character.escape" = "white" +"attribute" = "yellow" +"type" = "orange" +"string" = "darkgreen" +"function" = "yellow" +"function.macro" = "green" +"constructor" = "yellow" +"special" = "green" +"keyword" = "orange" +"comment" = { fg = "grey", modifiers = ["italic"] } +"label" = "purple" +"namespace" = { fg = "purple", modifiers = ["italic"] } + +# HTML +"tag" = "orange" + +"markup.heading.1" = "orange" +"markup.heading.2" = "yellow" +"markup.heading.3" = "darkred" +"markup.heading.4" = "grey" +"markup.heading.5" = "purple" +"markup.heading.6" = "darkgreen" +"markup.list" = "white" +"markup.bold" = { fg = "white", modifiers = ["bold"] } +"markup.italic" = { fg = "white", modifiers = ["italic"] } +"markup.link.url" = { fg = "lightblue", modifiers = ["underlined"] } +"markup.link.text" = "white" +"markup.quote" = "darkgreen" +"markup.raw" = "white" + +"diff.plus" = "green" +"diff.delta" = "grey" +"diff.minus" = "red" + +"diagnostic" = { modifiers = ["underlined"] } +"info" = "grey05" +"hint" = "grey05" +"debug" = "grey05" +"warning" = "orange" +"error" = "red" + +[palette] +grey00 = "#181818" # Default Background +grey01 = "#282828" # Lighter Background (Used for status bars, line number and folding marks) +grey02 = "#383838" # Selection Background +grey03 = "#585858" # Comments, Invisibles, Line Highlighting +grey04 = "#b8b8b8" # Dark Foreground (Used for status bars) +grey05 = "#d8d8d8" # Default Foreground, Caret, Delimiters, Operators +grey06 = "#e8e8e8" # Light Foreground (Not often used) +grey07 = "#f8f8f8" # Light Background (Not often used) + +white = "#d0d0d0" +yellow = "#eedd82" +orange = "#cc7832" +darkred = "#a34a27" +purple = "#9876aa" +green = "#32cd32" +grey = "#808080" +darkgreen = "#629755" +lightblue = "#6897bb" From a73e83ef4df18e2b70bf9b409928f5eb2fc26a99 Mon Sep 17 00:00:00 2001 From: taupiqueur <93834534+taupiqueur@users.noreply.github.com> Date: Sat, 17 Sep 2022 13:34:48 +0200 Subject: [PATCH 64/64] Fix typos (#3858) --- CHANGELOG.md | 6 +++--- README.md | 8 ++++---- book/src/commands.md | 2 +- book/src/from-vim.md | 4 ++-- book/src/guides/adding_languages.md | 2 +- book/src/keymap.md | 4 ++-- book/src/usage.md | 4 ++-- helix-core/src/movement.rs | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d37a57..56d85751 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -684,7 +684,7 @@ Usability improvements and fixes: - File picker configuration ([#988](https://github.com/helix-editor/helix/pull/988)) - Fix surround cursor position calculation ([#1183](https://github.com/helix-editor/helix/pull/1183)) - Accept count for goto_window ([#1033](https://github.com/helix-editor/helix/pull/1033)) -- Make kill_to_line_end behave like emacs ([#1235](https://github.com/helix-editor/helix/pull/1235)) +- Make kill_to_line_end behave like Emacs ([#1235](https://github.com/helix-editor/helix/pull/1235)) - Only use a single documentation popup ([#1241](https://github.com/helix-editor/helix/pull/1241)) - ui: popup: Don't allow scrolling past the end of content ([`3307f44c`](https://github.com/helix-editor/helix/commit/3307f44c)) - Open files with spaces in filename, allow opening multiple files ([#1231](https://github.com/helix-editor/helix/pull/1231)) @@ -922,7 +922,7 @@ to distinguish it in bug reports.. on cargo run. `~/.config/helix/runtime` can also be used. - Registers can now be selected via " (for example `"ay`) - Support for Nix files was added -- Movement is now fully tested and matches kakoune implementation +- Movement is now fully tested and matches Kakoune implementation - A per-file LSP symbol picker was added to space+s - Selection can be replaced with yanked text via R @@ -946,7 +946,7 @@ Keymaps: - The runtime/ can now optionally be embedded in the binary - Haskell syntax added - Window mode (ctrl-w) added -- Show matching bracket (vim's matchbrackets) +- Show matching bracket (Vim's matchbrackets) - Themes now support style modifiers - First user contributed theme - Create a document if it doesn't exist yet on save diff --git a/README.md b/README.md index 98ec7822..ff0699c6 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ ![Screenshot](./screenshot.png) -A kakoune / neovim inspired editor, written in Rust. +A Kakoune / Neovim inspired editor, written in Rust. -The editing model is very heavily based on kakoune; during development I found -myself agreeing with most of kakoune's design decisions. +The editing model is very heavily based on Kakoune; during development I found +myself agreeing with most of Kakoune's design decisions. For more information, see the [website](https://helix-editor.com) or [documentation](https://docs.helix-editor.com/). @@ -24,7 +24,7 @@ All shortcuts/keymaps can be found [in the documentation on the website](https:/ - Smart, incremental syntax highlighting and code editing via tree-sitter It's a terminal-based editor first, but I'd like to explore a custom renderer -(similar to emacs) in wgpu or skulpin. +(similar to Emacs) in wgpu or skulpin. Note: Only certain languages have indentation definitions at the moment. Check `runtime/queries//` for `indents.scm`. diff --git a/book/src/commands.md b/book/src/commands.md index 4c4a5c05..d9a11386 100644 --- a/book/src/commands.md +++ b/book/src/commands.md @@ -1,5 +1,5 @@ # Commands -Command mode can be activated by pressing `:`, similar to vim. Built-in commands: +Command mode can be activated by pressing `:`, similar to Vim. Built-in commands: {{#include ./generated/typable-cmd.md}} diff --git a/book/src/from-vim.md b/book/src/from-vim.md index 54f8d3b1..6ace9102 100644 --- a/book/src/from-vim.md +++ b/book/src/from-vim.md @@ -1,7 +1,7 @@ # Migrating from Vim -Helix's editing model is strongly inspired from vim and kakoune, and a notable -difference from vim (and the most striking similarity to kakoune) is that Helix +Helix's editing model is strongly inspired from Vim and Kakoune, and a notable +difference from Vim (and the most striking similarity to Kakoune) is that Helix follows the `selection → action` model. This means that the whatever you are going to act on (a word, a paragraph, a line, etc) is selected first and the action itself (delete, change, yank, etc) comes second. A cursor is simply a diff --git a/book/src/guides/adding_languages.md b/book/src/guides/adding_languages.md index 5be7a264..6598b9bf 100644 --- a/book/src/guides/adding_languages.md +++ b/book/src/guides/adding_languages.md @@ -29,7 +29,7 @@ language with the path `runtime/queries//`. The tree-sitter gives more info on how to write queries. > NOTE: When evaluating queries, the first matching query takes -precedence, which is different from other editors like neovim where +precedence, which is different from other editors like Neovim where the last matching query supersedes the ones before it. See [this issue][neovim-query-precedence] for an example. diff --git a/book/src/keymap.md b/book/src/keymap.md index 5a506ba0..99b0f0ba 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -27,7 +27,7 @@ ### Movement -> NOTE: Unlike vim, `f`, `F`, `t` and `T` are not confined to the current line. +> NOTE: Unlike Vim, `f`, `F`, `t` and `T` are not confined to the current line. | Key | Description | Command | | ----- | ----------- | ------- | @@ -229,7 +229,7 @@ TODO: Mappings for selecting syntax nodes (a superset of `[`). #### Window mode -This layer is similar to vim keybindings as kakoune does not support window. +This layer is similar to Vim keybindings as Kakoune does not support window. | Key | Description | Command | | ----- | ------------- | ------- | diff --git a/book/src/usage.md b/book/src/usage.md index 600a514f..fc3a83ee 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -128,8 +128,8 @@ will move the selection over to the "func" `identifier`. ![textobject-demo](https://user-images.githubusercontent.com/23398472/124231131-81a4bb00-db2d-11eb-9d10-8e577ca7b177.gif) ![textobject-treesitter-demo](https://user-images.githubusercontent.com/23398472/132537398-2a2e0a54-582b-44ab-a77f-eb818942203d.gif) -- `ma` - Select around the object (`va` in vim, `` in kakoune) -- `mi` - Select inside the object (`vi` in vim, `` in kakoune) +- `ma` - Select around the object (`va` in Vim, `` in Kakoune) +- `mi` - Select inside the object (`vi` in Vim, `` in Kakoune) | Key after `mi` or `ma` | Textobject selected | | --- | --- | diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs index fa8cdf3a..c232484c 100644 --- a/helix-core/src/movement.rs +++ b/helix-core/src/movement.rs @@ -270,7 +270,7 @@ pub enum WordMotionTarget { NextWordEnd, PrevWordStart, PrevWordEnd, - // A "Long word" (also known as a WORD in vim/kakoune) is strictly + // A "Long word" (also known as a WORD in Vim/Kakoune) is strictly // delimited by whitespace, and can consist of punctuation as well // as alphanumerics. NextLongWordStart,