From 70bbbd7d193a7928c9b621af9a7e192ef8251f6b Mon Sep 17 00:00:00 2001 From: Joey Hain Date: Fri, 3 Nov 2023 14:21:01 -0700 Subject: [PATCH 001/480] add highlight scope for type parameters (#8660) * rust: add highlight scope for type parameters * handle optional type parameters --- book/src/themes.md | 1 + runtime/queries/rust/highlights.scm | 7 +++++++ runtime/queries/rust/locals.scm | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/book/src/themes.md b/book/src/themes.md index 661210765..a62c07fee 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -155,6 +155,7 @@ We use a similar set of scopes as - `type` - Types - `builtin` - Primitive types provided by the language (`int`, `usize`) + - `parameter` - Generic type parameters (`T`) - `enum` - `variant` - `constructor` diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index bf2fde499..47e57e800 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -9,6 +9,13 @@ ; Types ; ------- +(type_parameters + (type_identifier) @type.parameter) +(constrained_type_parameter + left: (type_identifier) @type.parameter) +(optional_type_parameter + name: (type_identifier) @type.parameter) + ; --- ; Primitives ; --- diff --git a/runtime/queries/rust/locals.scm b/runtime/queries/rust/locals.scm index 75e5d181c..cb75d1557 100644 --- a/runtime/queries/rust/locals.scm +++ b/runtime/queries/rust/locals.scm @@ -2,6 +2,12 @@ [ (function_item) + (struct_item) + (enum_item) + (union_item) + (type_item) + (trait_item) + (impl_item) (closure_expression) (block) ] @local.scope @@ -11,8 +17,15 @@ (parameter (identifier) @local.definition) +(type_parameters + (type_identifier) @local.definition) +(constrained_type_parameter + left: (type_identifier) @local.definition) +(optional_type_parameter + name: (type_identifier) @local.definition) + (closure_parameters (identifier) @local.definition) ; References (identifier) @local.reference - +(type_identifier) @local.reference From 5c325fe342c26f31df495ec478a1d427270e8e42 Mon Sep 17 00:00:00 2001 From: cgahr Date: Fri, 3 Nov 2023 22:21:54 +0100 Subject: [PATCH 002/480] replace kdl tree-sitter to fix highlighting (#8652) * replace kdl tree-sitter * kdl: adopt highlights for new tree-sitter * kdl: add indent queries * kdl: add textobjects * kdl: improve syntax highlighting * kdl: update lang-support * kdl: make indents more concise --------- Co-authored-by: Constantin Gahr --- book/src/generated/lang-support.md | 2 +- languages.toml | 2 +- runtime/queries/kdl/highlights.scm | 8 ++++---- runtime/queries/kdl/indents.scm | 3 +++ runtime/queries/kdl/textobjects.scm | 27 +++++++++++++++++++++++++++ 5 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 runtime/queries/kdl/indents.scm create mode 100644 runtime/queries/kdl/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index c879a9677..3b2a115f2 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -81,7 +81,7 @@ | jsx | ✓ | ✓ | ✓ | `typescript-language-server` | | julia | ✓ | ✓ | ✓ | `julia` | | just | ✓ | ✓ | ✓ | | -| kdl | ✓ | | | | +| kdl | ✓ | ✓ | ✓ | | | kotlin | ✓ | | | `kotlin-language-server` | | latex | ✓ | ✓ | | `texlab` | | lean | ✓ | | | `lean` | diff --git a/languages.toml b/languages.toml index 24e20654d..6e637be78 100644 --- a/languages.toml +++ b/languages.toml @@ -2340,7 +2340,7 @@ injection-regex = "kdl" [[grammar]] name = "kdl" -source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d15df6610484e1d4b5c987ecad52373" } +source = { git = "https://github.com/amaanq/tree-sitter-kdl", rev = "3ca569b9f9af43593c24f9e7a21f02f43a13bb88" } [[language]] name = "xml" diff --git a/runtime/queries/kdl/highlights.scm b/runtime/queries/kdl/highlights.scm index d83bde19c..78e5acf49 100644 --- a/runtime/queries/kdl/highlights.scm +++ b/runtime/queries/kdl/highlights.scm @@ -1,12 +1,12 @@ -(comment) @comment (single_line_comment) @comment +(multi_line_comment) @comment (node - name: (identifier) @function) + (identifier) @variable) + (prop (identifier) @attribute) -(type) @type -(bare_identifier) @variable.other.member +(type (_) @type) @punctuation.bracket (keyword) @keyword diff --git a/runtime/queries/kdl/indents.scm b/runtime/queries/kdl/indents.scm new file mode 100644 index 000000000..bc2ffc15d --- /dev/null +++ b/runtime/queries/kdl/indents.scm @@ -0,0 +1,3 @@ +(node_children) @indent + + "}" @outdent diff --git a/runtime/queries/kdl/textobjects.scm b/runtime/queries/kdl/textobjects.scm new file mode 100644 index 000000000..7f9a562cc --- /dev/null +++ b/runtime/queries/kdl/textobjects.scm @@ -0,0 +1,27 @@ +(type (_) @test.inside) @test.around + +(node + children: (node_children)? @class.inside) @class.around + +(node + children: (node_children)? @function.inside) @function.around + +(node (identifier) @function.movement) + +[ + (single_line_comment) + (multi_line_comment) +] @comment.inside + +[ + (single_line_comment)+ + (multi_line_comment)+ +] @comment.around + +[ + (prop) + (value) +] @parameter.inside + +(value (type) ? (_) @parameter.inside @parameter.movement . ) @parameter.around + From 8dc197721bd6e7bb68e57ddeff0abf1aac067a1f Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 3 Nov 2023 19:34:54 -0500 Subject: [PATCH 003/480] Add an installation method field to the bug report template (#8711) We can guess the installation method from the version tag and platform in some cases but it would be useful to have this be explicit for the sake of debugging packager-specific problems. --- .github/ISSUE_TEMPLATE/bug_report.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 47fd3fe8a..52a4619fb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -55,6 +55,16 @@ body: placeholder: wezterm 20220101-133340-7edc5b5a validations: required: true + - type: input + id: installation-method + attributes: + label: Installation Method + description: > + How you installed Helix - from a package manager like Homebrew or the + AUR, built from source, downloaded a binary from the releases page, etc. + placeholder: "source / brew / nixpkgs / flake / releases page" + validations: + required: true - type: input id: helix-version attributes: From 10b178e94b0d3c44c56f5cd573ff65b3249aea78 Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Fri, 3 Nov 2023 20:35:38 -0400 Subject: [PATCH 004/480] swap yank command registers (#8708) #8703 swapped the `+` and `*` registers, but did not swap them in the corresponding yank commands. --- book/src/usage.md | 4 ++-- helix-term/src/commands.rs | 24 ++++++++++++------------ helix-term/src/commands/typed.rs | 20 ++++++++++---------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/book/src/usage.md b/book/src/usage.md index e392e5e67..e01482193 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -59,8 +59,8 @@ Some registers have special behavior when read from and written to. | `#` | Selection indices (first selection is `1`, second is `2`, etc.) | This register is not writable | | `.` | Contents of the current selections | This register is not writable | | `%` | Name of the current file | This register is not writable | -| `*` | Reads from the system clipboard | Joins and yanks to the system clipboard | -| `+` | Reads from the primary clipboard | Joins and yanks to the primary clipboard | +| `+` | Reads from the system clipboard | Joins and yanks to the system clipboard | +| `*` | Reads from the primary clipboard | Joins and yanks to the primary clipboard | When yanking multiple selections to the clipboard registers, the selections are joined with newlines. Pasting from these registers will paste multiple diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 75df430a3..648aa96e8 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3897,12 +3897,12 @@ fn yank(cx: &mut Context) { } fn yank_to_clipboard(cx: &mut Context) { - yank_impl(cx.editor, '*'); + yank_impl(cx.editor, '+'); exit_select_mode(cx); } fn yank_to_primary_clipboard(cx: &mut Context) { - yank_impl(cx.editor, '+'); + yank_impl(cx.editor, '*'); exit_select_mode(cx); } @@ -3959,13 +3959,13 @@ fn yank_joined(cx: &mut Context) { fn yank_joined_to_clipboard(cx: &mut Context) { let line_ending = doc!(cx.editor).line_ending; - yank_joined_impl(cx.editor, line_ending.as_str(), '*'); + yank_joined_impl(cx.editor, line_ending.as_str(), '+'); exit_select_mode(cx); } fn yank_joined_to_primary_clipboard(cx: &mut Context) { let line_ending = doc!(cx.editor).line_ending; - yank_joined_impl(cx.editor, line_ending.as_str(), '+'); + yank_joined_impl(cx.editor, line_ending.as_str(), '*'); exit_select_mode(cx); } @@ -3982,12 +3982,12 @@ fn yank_primary_selection_impl(editor: &mut Editor, register: char) { } fn yank_main_selection_to_clipboard(cx: &mut Context) { - yank_primary_selection_impl(cx.editor, '*'); + yank_primary_selection_impl(cx.editor, '+'); exit_select_mode(cx); } fn yank_main_selection_to_primary_clipboard(cx: &mut Context) { - yank_primary_selection_impl(cx.editor, '+'); + yank_primary_selection_impl(cx.editor, '*'); exit_select_mode(cx); } @@ -4088,19 +4088,19 @@ pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) { } fn paste_clipboard_after(cx: &mut Context) { - paste(cx.editor, '*', Paste::After, cx.count()); + paste(cx.editor, '+', Paste::After, cx.count()); } fn paste_clipboard_before(cx: &mut Context) { - paste(cx.editor, '*', Paste::Before, cx.count()); + paste(cx.editor, '+', Paste::Before, cx.count()); } fn paste_primary_clipboard_after(cx: &mut Context) { - paste(cx.editor, '+', Paste::After, cx.count()); + paste(cx.editor, '*', Paste::After, cx.count()); } fn paste_primary_clipboard_before(cx: &mut Context) { - paste(cx.editor, '+', Paste::Before, cx.count()); + paste(cx.editor, '*', Paste::Before, cx.count()); } fn replace_with_yanked(cx: &mut Context) { @@ -4138,11 +4138,11 @@ fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) { } fn replace_selections_with_clipboard(cx: &mut Context) { - replace_with_yanked_impl(cx.editor, '*', cx.count()); + replace_with_yanked_impl(cx.editor, '+', cx.count()); } fn replace_selections_with_primary_clipboard(cx: &mut Context) { - replace_with_yanked_impl(cx.editor, '+', cx.count()); + replace_with_yanked_impl(cx.editor, '*', cx.count()); } fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) { diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index abe6dd97e..e73433080 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -921,7 +921,7 @@ fn yank_main_selection_to_clipboard( return Ok(()); } - yank_primary_selection_impl(cx.editor, '*'); + yank_primary_selection_impl(cx.editor, '+'); Ok(()) } @@ -956,7 +956,7 @@ fn yank_joined_to_clipboard( let doc = doc!(cx.editor); let default_sep = Cow::Borrowed(doc.line_ending.as_str()); let separator = args.first().unwrap_or(&default_sep); - yank_joined_impl(cx.editor, separator, '*'); + yank_joined_impl(cx.editor, separator, '+'); Ok(()) } @@ -969,7 +969,7 @@ fn yank_main_selection_to_primary_clipboard( return Ok(()); } - yank_primary_selection_impl(cx.editor, '+'); + yank_primary_selection_impl(cx.editor, '*'); Ok(()) } @@ -985,7 +985,7 @@ fn yank_joined_to_primary_clipboard( let doc = doc!(cx.editor); let default_sep = Cow::Borrowed(doc.line_ending.as_str()); let separator = args.first().unwrap_or(&default_sep); - yank_joined_impl(cx.editor, separator, '+'); + yank_joined_impl(cx.editor, separator, '*'); Ok(()) } @@ -998,7 +998,7 @@ fn paste_clipboard_after( return Ok(()); } - paste(cx.editor, '*', Paste::After, 1); + paste(cx.editor, '+', Paste::After, 1); Ok(()) } @@ -1011,7 +1011,7 @@ fn paste_clipboard_before( return Ok(()); } - paste(cx.editor, '*', Paste::Before, 1); + paste(cx.editor, '+', Paste::Before, 1); Ok(()) } @@ -1024,7 +1024,7 @@ fn paste_primary_clipboard_after( return Ok(()); } - paste(cx.editor, '+', Paste::After, 1); + paste(cx.editor, '*', Paste::After, 1); Ok(()) } @@ -1037,7 +1037,7 @@ fn paste_primary_clipboard_before( return Ok(()); } - paste(cx.editor, '+', Paste::Before, 1); + paste(cx.editor, '*', Paste::Before, 1); Ok(()) } @@ -1050,7 +1050,7 @@ fn replace_selections_with_clipboard( return Ok(()); } - replace_with_yanked_impl(cx.editor, '*', 1); + replace_with_yanked_impl(cx.editor, '+', 1); Ok(()) } @@ -1063,7 +1063,7 @@ fn replace_selections_with_primary_clipboard( return Ok(()); } - replace_with_yanked_impl(cx.editor, '+', 1); + replace_with_yanked_impl(cx.editor, '*', 1); Ok(()) } From 2fddc2a4fcd3b8d9415e35994af3049d6960b23a Mon Sep 17 00:00:00 2001 From: MDeiml Date: Sun, 5 Nov 2023 13:04:20 +0100 Subject: [PATCH 005/480] Update markdown grammar to v0.1.6 --- languages.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/languages.toml b/languages.toml index 6e637be78..e3f9395bf 100644 --- a/languages.toml +++ b/languages.toml @@ -1383,7 +1383,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "markdown" -source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "fa6bfd51727e4bef99f7eec5f43947f73d64ea7d", subpath = "tree-sitter-markdown" } +source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "aaf76797aa8ecd9a5e78e0ec3681941de6c945ee", subpath = "tree-sitter-markdown" } [[language]] name = "markdown.inline" @@ -1395,7 +1395,7 @@ grammar = "markdown_inline" [[grammar]] name = "markdown_inline" -source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "fa6bfd51727e4bef99f7eec5f43947f73d64ea7d", subpath = "tree-sitter-markdown-inline" } +source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "aaf76797aa8ecd9a5e78e0ec3681941de6c945ee", subpath = "tree-sitter-markdown-inline" } [[language]] name = "dart" From a98ad137f9b0678ce9770aaa56a8bf8ca7c51d17 Mon Sep 17 00:00:00 2001 From: postsolar <120750161+postsolar@users.noreply.github.com> Date: Sun, 5 Nov 2023 15:16:25 +0200 Subject: [PATCH 006/480] Update PureScript grammar (#8712) --- languages.toml | 2 +- runtime/queries/purescript/highlights.scm | 38 ++++++++++++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/languages.toml b/languages.toml index e3f9395bf..9b7d93ed2 100644 --- a/languages.toml +++ b/languages.toml @@ -1142,7 +1142,7 @@ formatter = { command = "purs-tidy", args = ["format"] } [[grammar]] name = "purescript" -source = { git = "https://github.com/maskhjarna/tree-sitter-purescript", rev = "0e36a885a941078bf40e559026be425764dc27bf" } +source = { git = "https://github.com/postsolar/tree-sitter-purescript", rev = "593193b9bf0f46d5eee708a4e53044d2a9054897" } [[language]] name = "zig" diff --git a/runtime/queries/purescript/highlights.scm b/runtime/queries/purescript/highlights.scm index f559fd1ea..b110f3e01 100644 --- a/runtime/queries/purescript/highlights.scm +++ b/runtime/queries/purescript/highlights.scm @@ -3,15 +3,13 @@ (integer) @constant.numeric.integer (exp_negation) @constant.numeric.integer - (exp_literal (float)) @constant.numeric.float + (exp_literal (number)) @constant.numeric.float (char) @constant.character [ (string) (triple_quote_string) ] @string - (con_unit) @constant.builtin ; unit, as in () - (comment) @comment @@ -36,6 +34,10 @@ ; ---------------------------------------------------------------------------- ; Keywords, operators, includes + ; This needs to come before the other "else" in + ; order to be highlighted correctly + (class_instance "else" @keyword) + [ "if" "then" @@ -53,15 +55,20 @@ (operator) (constructor_operator) (type_operator) - (tycon_arrow) (qualified_module) ; grabs the `.` (dot), ex: import System.IO (all_names) + + ; `_` wildcards in if-then-else and case-of expressions, + ; as well as record updates and operator sections + (wildcard) "=" "|" "::" "∷" "=>" "⇒" + "<=" + "⇐" "->" "→" "<-" @@ -89,6 +96,7 @@ "newtype" "type" "as" + "hiding" "do" "ado" "forall" @@ -98,24 +106,40 @@ "infixr" ] @keyword + (type_role_declaration + "role" @keyword + role: (type_role) @keyword) + + (hole) @label ; ---------------------------------------------------------------------------- ; Functions and variables + (row_field (field_name) @variable.other.member) + (record_field (field_name) @variable.other.member) + (record_accessor (variable) @variable.other.member) + (exp_record_access (variable) @variable.other.member) + (signature name: (variable) @type) (function name: (variable) @function) + (class_instance (instance_name) @function) + (derive_declaration (instance_name) @function) ; true or false ((variable) @constant.builtin.boolean (#match? @constant.builtin.boolean "^(true|false)$")) - (variable) @variable + ; The former one works for `tree-sitter highlight` but not in Helix/Kakoune. + ; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all + ; as an operator and leaving it to the child nodes, and highlighting everything as an operator. + (exp_ticked (_) @operator) + (exp_ticked (exp_name (variable) @operator)) + (exp_ticked (exp_name (qualified_variable (variable) @operator))) - (exp_infix (variable) @operator) ; consider infix functions as operators + (variable) @variable ("@" @namespace) ; "as" pattern operator, e.g. x@Constructor - ; ---------------------------------------------------------------------------- ; Types From f73e9a8d15fd5a87d472a49808baf42ba403f9bf Mon Sep 17 00:00:00 2001 From: Joey Hain Date: Sun, 5 Nov 2023 17:54:25 -0800 Subject: [PATCH 007/480] highlights: add type.parameter scope to several more languages (#8718) * typescript * go * haskell * ocaml * kotlin (+ bugfix) --- runtime/queries/_typescript/highlights.scm | 2 ++ runtime/queries/_typescript/locals.scm | 17 +++++++++++++++++ runtime/queries/go/highlights.scm | 16 ++++++++++++---- runtime/queries/go/locals.scm | 12 ++++++++++-- runtime/queries/haskell/highlights.scm | 2 +- runtime/queries/kotlin/highlights.scm | 5 ++++- runtime/queries/kotlin/locals.scm | 15 +++++++++++++++ runtime/queries/ocaml/highlights.scm | 2 ++ 8 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 runtime/queries/kotlin/locals.scm diff --git a/runtime/queries/_typescript/highlights.scm b/runtime/queries/_typescript/highlights.scm index a83b43475..f9a672667 100644 --- a/runtime/queries/_typescript/highlights.scm +++ b/runtime/queries/_typescript/highlights.scm @@ -107,6 +107,8 @@ ; Types ; ----- +(type_parameter + name: (type_identifier) @type.parameter) (type_identifier) @type (predefined_type) @type.builtin diff --git a/runtime/queries/_typescript/locals.scm b/runtime/queries/_typescript/locals.scm index fe13f21d3..041ad59d1 100644 --- a/runtime/queries/_typescript/locals.scm +++ b/runtime/queries/_typescript/locals.scm @@ -1,6 +1,18 @@ +; Scopes +;------- + +[ + (type_alias_declaration) + (class_declaration) + (interface_declaration) +] @local.scope + ; Definitions ;------------ +(type_parameter + name: (type_identifier) @local.definition) + ; Javascript and Typescript Treesitter grammars deviate when defining the ; tree structure for parameters, so we need to address them in each specific ; language instead of ecma. @@ -14,3 +26,8 @@ ; (i?: t = 1) // Invalid but still posible to hihglight. (optional_parameter (identifier) @local.definition) + +; References +;----------- + +(type_identifier) @local.reference diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm index b45a11bee..fba2df99e 100644 --- a/runtime/queries/go/highlights.scm +++ b/runtime/queries/go/highlights.scm @@ -11,6 +11,18 @@ function: (selector_expression field: (field_identifier) @function.method)) + +; Types + +(type_parameter_list + (parameter_declaration + name: (identifier) @type.parameter)) + +((type_identifier) @type.builtin + (match? @type.builtin "^(any|bool|byte|comparable|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$")) + +(type_identifier) @type + ; Function definitions (function_declaration @@ -30,10 +42,6 @@ (parameter_declaration (identifier) @variable.parameter) (variadic_parameter_declaration (identifier) @variable.parameter) -((type_identifier) @type.builtin - (match? @type.builtin "^(any|bool|byte|comparable|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$")) - -(type_identifier) @type (type_spec name: (type_identifier) @constructor) (field_identifier) @variable.other.member diff --git a/runtime/queries/go/locals.scm b/runtime/queries/go/locals.scm index aae562571..14a6f3e43 100644 --- a/runtime/queries/go/locals.scm +++ b/runtime/queries/go/locals.scm @@ -1,9 +1,17 @@ ; Scopes -(block) @local.scope +[ + (function_declaration) + (type_declaration) + (block) +] @local.scope ; Definitions +(type_parameter_list + (parameter_declaration + name: (identifier) @local.definition)) + (parameter_declaration (identifier) @local.definition) (variadic_parameter_declaration (identifier) @local.definition) @@ -27,4 +35,4 @@ (identifier) @local.reference (field_identifier) @local.reference - +(type_identifier) @local.reference diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm index 18c57c930..3d416de8d 100644 --- a/runtime/queries/haskell/highlights.scm +++ b/runtime/queries/haskell/highlights.scm @@ -124,7 +124,7 @@ ;; Types (type) @type -(type_variable) @type +(type_variable) @type.parameter (constructor) @constructor diff --git a/runtime/queries/kotlin/highlights.scm b/runtime/queries/kotlin/highlights.scm index 208a673f3..5b19f849e 100644 --- a/runtime/queries/kotlin/highlights.scm +++ b/runtime/queries/kotlin/highlights.scm @@ -244,7 +244,10 @@ . (identifier)) @namespace ((type_identifier) @type.builtin - (#match? @function.builtin "^(Byte|Short|Int|Long|UByte|UShort|UInt|ULong|Float|Double|Boolean|Char|String|Array|ByteArray|ShortArray|IntArray|LongArray|UByteArray|UShortArray|UIntArray|ULongArray|FloatArray|DoubleArray|BooleanArray|CharArray|Map|Set|List|EmptyMap|EmptySet|EmptyList|MutableMap|MutableSet|MutableList)$")) + (#match? @type.builtin "^(Byte|Short|Int|Long|UByte|UShort|UInt|ULong|Float|Double|Boolean|Char|String|Array|ByteArray|ShortArray|IntArray|LongArray|UByteArray|UShortArray|UIntArray|ULongArray|FloatArray|DoubleArray|BooleanArray|CharArray|Map|Set|List|EmptyMap|EmptySet|EmptyList|MutableMap|MutableSet|MutableList)$")) + +(type_parameter + (type_identifier) @type.parameter) (type_identifier) @type diff --git a/runtime/queries/kotlin/locals.scm b/runtime/queries/kotlin/locals.scm new file mode 100644 index 000000000..752ed995e --- /dev/null +++ b/runtime/queries/kotlin/locals.scm @@ -0,0 +1,15 @@ +; Scopes + +[ + (class_declaration) + (function_declaration) +] @local.scope + +; Definitions + +(type_parameter + (type_identifier) @local.definition) + +; References + +(type_identifier) @local.reference diff --git a/runtime/queries/ocaml/highlights.scm b/runtime/queries/ocaml/highlights.scm index a08b12670..9d3bf4c8b 100644 --- a/runtime/queries/ocaml/highlights.scm +++ b/runtime/queries/ocaml/highlights.scm @@ -8,6 +8,8 @@ [(class_name) (class_type_name) (type_constructor)] @type +(type_variable) @type.parameter + [(constructor_name) (tag)] @constructor ; Functions From 7bc564d3dcdee69555578bbec75d08e6ce227a9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Mon, 6 Nov 2023 22:33:18 +0100 Subject: [PATCH 008/480] Theme: Papercolor: Add type.parameter (#8735) --- runtime/themes/papercolor-light.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/themes/papercolor-light.toml b/runtime/themes/papercolor-light.toml index ae104e17e..5c59d6f51 100644 --- a/runtime/themes/papercolor-light.toml +++ b/runtime/themes/papercolor-light.toml @@ -52,6 +52,7 @@ "type" = { fg = "bright2", modifiers = ["bold"] } "type.builtin" = { fg = "bright2", modifiers = ["bold"] } +"type.parameter" = { fg = "foreground" } "type.enum" = { fg = "foreground" } "type.enum.variant" = { fg = "foreground" } From e868678139bc8f4f5b14236c3c3c3f6aa4aab47b Mon Sep 17 00:00:00 2001 From: Yomain <40139584+yo-main@users.noreply.github.com> Date: Wed, 8 Nov 2023 19:38:17 +0100 Subject: [PATCH 009/480] Add command to move files with LSP support (#8584) * Added rename command * Added an error if the new path already exists * Fixed wrong command name being used * fixed clippy suggestions * removed didRenameFiles call, fixed early return due to path Err * added ':rnm' alias to ':rename' * code cleanup * formatting * removed debug line * cargo fmt * Improved new buffer error message Co-authored-by: Pascal Kuthe * Removed unnecessary path normalizing Co-authored-by: Pascal Kuthe * Update helix-term/src/commands/typed.rs Co-authored-by: Pascal Kuthe * Update helix-term/src/commands/typed.rs Co-authored-by: Pascal Kuthe * Update helix-term/src/commands/typed.rs Co-authored-by: Pascal Kuthe * Update helix-term/src/commands/typed.rs Co-authored-by: Pascal Kuthe * feat: change `rename` command to `move` * feat: add multi lsp support when moving files * feat: allow lsp calls with a custom timeout * feat: sending lsp file_changed event once file has moved --------- Co-authored-by: ontley Co-authored-by: ontley <67148677+ontley@users.noreply.github.com> Co-authored-by: Pascal Kuthe --- book/src/generated/typable-cmd.md | 1 + helix-lsp/src/client.rs | 76 +++++++++++++++++++++++++++- helix-term/src/commands/typed.rs | 84 ++++++++++++++++++++++++++++++- 3 files changed, 159 insertions(+), 2 deletions(-) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 4b737893d..6280d3c72 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -85,3 +85,4 @@ | `:reset-diff-change`, `:diffget`, `:diffg` | Reset the diff change at the cursor position. | | `:clear-register` | Clear given register. If no argument is provided, clear all registers. | | `:redraw` | Clear and re-render the whole UI | +| `:move` | Move the current buffer and its corresponding file to a different path | diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 341702c37..e6e1f8a03 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -401,12 +401,22 @@ impl Client { &self, params: R::Params, ) -> impl Future> + where + R::Params: serde::Serialize, + { + self.call_with_timeout::(params, self.req_timeout) + } + + fn call_with_timeout( + &self, + params: R::Params, + timeout_secs: u64, + ) -> impl Future> where R::Params: serde::Serialize, { let server_tx = self.server_tx.clone(); let id = self.next_request_id(); - let timeout_secs = self.req_timeout; async move { use std::time::Duration; @@ -548,6 +558,11 @@ impl Client { dynamic_registration: Some(true), relative_pattern_support: Some(false), }), + file_operations: Some(lsp::WorkspaceFileOperationsClientCapabilities { + will_rename: Some(true), + did_rename: Some(true), + ..Default::default() + }), ..Default::default() }), text_document: Some(lsp::TextDocumentClientCapabilities { @@ -700,6 +715,65 @@ impl Client { }) } + pub fn prepare_file_rename( + &self, + old_uri: &lsp::Url, + new_uri: &lsp::Url, + ) -> Option>> { + let capabilities = self.capabilities.get().unwrap(); + + // Return early if the server does not support willRename feature + match &capabilities.workspace { + Some(workspace) => match &workspace.file_operations { + Some(op) => { + op.will_rename.as_ref()?; + } + _ => return None, + }, + _ => return None, + } + + let files = vec![lsp::FileRename { + old_uri: old_uri.to_string(), + new_uri: new_uri.to_string(), + }]; + let request = self.call_with_timeout::( + lsp::RenameFilesParams { files }, + 5, + ); + + Some(async move { + let json = request.await?; + let response: Option = serde_json::from_value(json)?; + Ok(response.unwrap_or_default()) + }) + } + + pub fn did_file_rename( + &self, + old_uri: &lsp::Url, + new_uri: &lsp::Url, + ) -> Option>> { + let capabilities = self.capabilities.get().unwrap(); + + // Return early if the server does not support DidRename feature + match &capabilities.workspace { + Some(workspace) => match &workspace.file_operations { + Some(op) => { + op.did_rename.as_ref()?; + } + _ => return None, + }, + _ => return None, + } + + let files = vec![lsp::FileRename { + old_uri: old_uri.to_string(), + new_uri: new_uri.to_string(), + }]; + Some(self.notify::(lsp::RenameFilesParams { files })) + } + // ------------------------------------------------------------------------------------------- // Text document // ------------------------------------------------------------------------------------------- diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index e73433080..4148257fc 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -6,7 +6,8 @@ use crate::job::Job; use super::*; use helix_core::fuzzy::fuzzy_match; -use helix_core::{encoding, line_ending, shellwords::Shellwords}; +use helix_core::{encoding, line_ending, path::get_canonicalized_path, shellwords::Shellwords}; +use helix_lsp::{OffsetEncoding, Url}; use helix_view::document::DEFAULT_LANGUAGE_NAME; use helix_view::editor::{Action, CloseError, ConfigEvent}; use serde_json::Value; @@ -2408,6 +2409,80 @@ fn redraw( Ok(()) } +fn move_buffer( + cx: &mut compositor::Context, + args: &[Cow], + event: PromptEvent, +) -> anyhow::Result<()> { + if event != PromptEvent::Validate { + return Ok(()); + } + + ensure!(args.len() == 1, format!(":move takes one argument")); + let doc = doc!(cx.editor); + + let new_path = get_canonicalized_path(&PathBuf::from(args.first().unwrap().to_string())); + let old_path = doc + .path() + .ok_or_else(|| anyhow!("Scratch buffer cannot be moved. Use :write instead"))? + .clone(); + let old_path_as_url = doc.url().unwrap(); + let new_path_as_url = Url::from_file_path(&new_path).unwrap(); + + let edits: Vec<( + helix_lsp::Result, + OffsetEncoding, + String, + )> = doc + .language_servers() + .map(|lsp| { + ( + lsp.prepare_file_rename(&old_path_as_url, &new_path_as_url), + lsp.offset_encoding(), + lsp.name().to_owned(), + ) + }) + .filter(|(f, _, _)| f.is_some()) + .map(|(f, encoding, name)| (helix_lsp::block_on(f.unwrap()), encoding, name)) + .collect(); + + for (lsp_reply, encoding, name) in edits { + match lsp_reply { + Ok(edit) => { + if let Err(e) = apply_workspace_edit(cx.editor, encoding, &edit) { + log::error!( + ":move command failed to apply edits from lsp {}: {:?}", + name, + e + ); + }; + } + Err(e) => { + log::error!("LSP {} failed to treat willRename request: {:?}", name, e); + } + }; + } + + let doc = doc_mut!(cx.editor); + + doc.set_path(Some(new_path.as_path())); + if let Err(e) = std::fs::rename(&old_path, &new_path) { + doc.set_path(Some(old_path.as_path())); + bail!("Could not move file: {}", e); + }; + + doc.language_servers().for_each(|lsp| { + lsp.did_file_rename(&old_path_as_url, &new_path_as_url); + }); + + cx.editor + .language_servers + .file_event_handler + .file_changed(new_path); + + Ok(()) +} + pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "quit", @@ -3008,6 +3083,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: redraw, signature: CommandSignature::none(), }, + TypableCommand { + name: "move", + aliases: &[], + doc: "Move the current buffer and its corresponding file to a different path", + fun: move_buffer, + signature: CommandSignature::positional(&[completers::filename]), + }, ]; pub static TYPABLE_COMMAND_MAP: Lazy> = From cb0bc25a9fc00c2b5c7450754d096bec39cd26e6 Mon Sep 17 00:00:00 2001 From: Triton171 Date: Wed, 8 Nov 2023 20:53:07 +0100 Subject: [PATCH 010/480] Add indent queries for scheme (and reuse them for common-lisp & racket). (#8720) --- book/src/generated/lang-support.md | 6 ++-- languages.toml | 1 + runtime/queries/common-lisp/indents.scm | 1 + runtime/queries/racket/indents.scm | 1 + runtime/queries/scheme/indents.scm | 43 +++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 runtime/queries/common-lisp/indents.scm create mode 100644 runtime/queries/racket/indents.scm create mode 100644 runtime/queries/scheme/indents.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 3b2a115f2..9c55b4a05 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -16,7 +16,7 @@ | clojure | ✓ | | | `clojure-lsp` | | cmake | ✓ | ✓ | ✓ | `cmake-language-server` | | comment | ✓ | | | | -| common-lisp | ✓ | | | `cl-lsp` | +| common-lisp | ✓ | | ✓ | `cl-lsp` | | cpon | ✓ | | ✓ | | | cpp | ✓ | ✓ | ✓ | `clangd` | | crystal | ✓ | ✓ | | `crystalline` | @@ -128,7 +128,7 @@ | python | ✓ | ✓ | ✓ | `pylsp` | | qml | ✓ | | ✓ | `qmlls` | | r | ✓ | | | `R` | -| racket | ✓ | | | `racket` | +| racket | ✓ | | ✓ | `racket` | | regex | ✓ | | | | | rego | ✓ | | | `regols` | | rescript | ✓ | ✓ | | `rescript-language-server` | @@ -140,7 +140,7 @@ | rust | ✓ | ✓ | ✓ | `rust-analyzer` | | sage | ✓ | ✓ | | | | scala | ✓ | | ✓ | `metals` | -| scheme | ✓ | | | | +| scheme | ✓ | | ✓ | | | scss | ✓ | | | `vscode-css-language-server` | | slint | ✓ | | ✓ | `slint-lsp` | | smithy | ✓ | | | `cs` | diff --git a/languages.toml b/languages.toml index 9b7d93ed2..11df7d247 100644 --- a/languages.toml +++ b/languages.toml @@ -1278,6 +1278,7 @@ roots = [] file-types = ["rkt", "rktd", "rktl", "scrbl"] shebangs = ["racket"] comment-token = ";" +indent = { tab-width = 2, unit = " " } language-servers = [ "racket" ] grammar = "scheme" diff --git a/runtime/queries/common-lisp/indents.scm b/runtime/queries/common-lisp/indents.scm new file mode 100644 index 000000000..e11eb7881 --- /dev/null +++ b/runtime/queries/common-lisp/indents.scm @@ -0,0 +1 @@ +; inherits: scheme diff --git a/runtime/queries/racket/indents.scm b/runtime/queries/racket/indents.scm new file mode 100644 index 000000000..e11eb7881 --- /dev/null +++ b/runtime/queries/racket/indents.scm @@ -0,0 +1 @@ +; inherits: scheme diff --git a/runtime/queries/scheme/indents.scm b/runtime/queries/scheme/indents.scm new file mode 100644 index 000000000..b00b29652 --- /dev/null +++ b/runtime/queries/scheme/indents.scm @@ -0,0 +1,43 @@ +; This roughly follows the description at: https://github.com/ds26gte/scmindent#how-subforms-are-indented + +; Exclude literals in the first patterns, since different rules apply for them. +; Similarly, exclude certain keywords (detected by a regular expression). +; If a list has 2 elements on the first line, it is aligned to the second element. +(list . (_) @first . (_) @anchor + (#same-line? @first @anchor) + (#set! "scope" "tail") + (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number") + (#not-match? @first "def.*|let.*|set!")) @align +; If the first element in a list is also a list and on a line by itself, the outer list is aligned to it +(list . (list) @anchor . + (#set! "scope" "tail") + (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number")) @align +(list . (list) @anchor . (_) @second + (#not-same-line? @anchor @second) + (#set! "scope" "tail") + (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number") + (#not-match? @first "def.*|let.*|set!")) @align +; If the first element in a list is not a list and on a line by itself, the outer list is aligned to +; it plus 1 additional space. This cannot currently be modelled exactly by our indent queries, +; but the following is equivalent, assuming that: +; - the indent width is 2 (the default for scheme) +; - There is no space between the opening parenthesis of the list and the first element +(list . (_) @first . + (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number") + (#not-match? @first "def.*|let.*|set!")) @indent +(list . (_) @first . (_) @second + (#not-same-line? @first @second) + (#not-kind-eq? @first "boolean") (#not-kind-eq? @first "character") (#not-kind-eq? @first "string") (#not-kind-eq? @first "number") + (#not-match? @first "def.*|let.*|set!")) @indent + +; If the first element in a list is a literal, align the list to it +(list . [(boolean) (character) (string) (number)] @anchor + (#set! "scope" "tail")) @align + +; If the first element is among a set of predefined keywords, align the list to this element +; plus 1 space (using the same workaround as above for now). This is a simplification since actually +; the second line of the list should be indented by 2 spaces more in some cases. Supporting this would +; be possible but require significantly more patterns. +(list . (symbol) @first + (#match? @first "def.*|let.*|set!")) @indent + From 676ab0c1f392888a3dd44e3c6b84ac4b15dde59e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 11:12:45 +0900 Subject: [PATCH 011/480] build(deps): bump serde from 1.0.190 to 1.0.191 (#8740) 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 b5f25da4b..ea167d3ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1869,18 +1869,18 @@ checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "serde" -version = "1.0.190" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd" dependencies = [ "proc-macro2", "quote", From 91bdceb8b607300516c041977881f94014ae7cde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 11:12:54 +0900 Subject: [PATCH 012/480] build(deps): bump serde_json from 1.0.107 to 1.0.108 (#8744) 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 ea167d3ce..2c83a0997 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1889,9 +1889,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", From aac7bd9b08c72af161684cefc56fc1a3e59b5b1d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 11:13:03 +0900 Subject: [PATCH 013/480] build(deps): bump libc from 0.2.149 to 0.2.150 (#8741) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- helix-term/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c83a0997..82bb2e6ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1433,9 +1433,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libloading" diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index a84d372fd..c6374de54 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -69,7 +69,7 @@ grep-searcher = "0.1.11" [target.'cfg(not(windows))'.dependencies] # https://github.com/vorner/signal-hook/issues/100 signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] } -libc = "0.2.149" +libc = "0.2.150" [target.'cfg(target_os = "macos")'.dependencies] crossterm = { version = "0.27", features = ["event-stream", "use-dev-tty"] } From 4229583631e0aedf6571e0479f574b5efd2eb98a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 11:13:32 +0900 Subject: [PATCH 014/480] build(deps): bump futures-executor from 0.3.28 to 0.3.29 (#8743) 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 82bb2e6ee..e1df49f49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -534,9 +534,9 @@ checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", From 6ab774da0b473c36a437d90abcdac3558353d32e Mon Sep 17 00:00:00 2001 From: mydumpfire <134539278+mydumpfire@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:56:57 +0700 Subject: [PATCH 015/480] grammars.nix: allow the user to apply overlays (#8749) You can now apply overlays to the grammar derivations via `grammarOverlays`. Also, the `src` in the derivation is now properly unpacked to the build directory, allowing the user to mutate the source files if they want to. --- grammars.nix | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/grammars.nix b/grammars.nix index 9ca0cf3d6..843fa02ad 100644 --- a/grammars.nix +++ b/grammars.nix @@ -5,6 +5,7 @@ runCommand, yj, includeGrammarIf ? _: true, + grammarOverlays ? [], ... }: let # HACK: nix < 2.6 has a bug in the toml parser, so we convert to JSON @@ -48,22 +49,22 @@ then sourceGitHub else sourceGit; in - stdenv.mkDerivation rec { + stdenv.mkDerivation { # see https://github.com/NixOS/nixpkgs/blob/fbdd1a7c0bc29af5325e0d7dd70e804a972eb465/pkgs/development/tools/parsing/tree-sitter/grammar.nix pname = "helix-tree-sitter-${grammar.name}"; version = grammar.source.rev; - src = - if builtins.hasAttr "subpath" grammar.source - then "${source}/${grammar.source.subpath}" - else source; + src = source; + sourceRoot = if builtins.hasAttr "subpath" grammar.source then + "source/${grammar.source.subpath}" + else + "source"; - dontUnpack = true; dontConfigure = true; FLAGS = [ - "-I${src}/src" + "-Isrc" "-g" "-O3" "-fPIC" @@ -76,13 +77,13 @@ buildPhase = '' runHook preBuild - if [[ -e "$src/src/scanner.cc" ]]; then - $CXX -c "$src/src/scanner.cc" -o scanner.o $FLAGS - elif [[ -e "$src/src/scanner.c" ]]; then - $CC -c "$src/src/scanner.c" -o scanner.o $FLAGS + if [[ -e src/scanner.cc ]]; then + $CXX -c src/scanner.cc -o scanner.o $FLAGS + elif [[ -e src/scanner.c ]]; then + $CC -c src/scanner.c -o scanner.o $FLAGS fi - $CC -c "$src/src/parser.c" -o parser.o $FLAGS + $CC -c src/parser.c -o parser.o $FLAGS $CXX -shared -o $NAME.so *.o ls -al @@ -105,15 +106,17 @@ ''; }; grammarsToBuild = builtins.filter includeGrammarIf gitGrammars; - builtGrammars = - builtins.map (grammar: { - inherit (grammar) name; - artifact = buildGrammar grammar; - }) - grammarsToBuild; - grammarLinks = - builtins.map (grammar: "ln -s ${grammar.artifact}/${grammar.name}.so $out/${grammar.name}.so") - builtGrammars; + builtGrammars = builtins.map (grammar: { + inherit (grammar) name; + value = buildGrammar grammar; + }) grammarsToBuild; + extensibleGrammars = + lib.makeExtensible (self: builtins.listToAttrs builtGrammars); + overlayedGrammars = lib.pipe extensibleGrammars + (builtins.map (overlay: grammar: grammar.extend overlay) grammarOverlays); + grammarLinks = lib.mapAttrsToList + (name: artifact: "ln -s ${artifact}/${name}.so $out/${name}.so") + (lib.filterAttrs (n: v: lib.isDerivation v) overlayedGrammars); in runCommand "consolidated-helix-grammars" {} '' mkdir -p $out From 172ef2fa9f2322b3a82729c584ede6cb84879b91 Mon Sep 17 00:00:00 2001 From: blt__ <63462729+blt-r@users.noreply.github.com> Date: Mon, 13 Nov 2023 02:04:03 +0400 Subject: [PATCH 016/480] Highlight meson_options.txt as a meson file (#8794) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 11df7d247..7d4326a1d 100644 --- a/languages.toml +++ b/languages.toml @@ -1943,7 +1943,7 @@ source = { git = "https://github.com/ap29600/tree-sitter-odin", rev = "b219207e4 name = "meson" scope = "source.meson" injection-regex = "meson" -file-types = ["meson.build"] +file-types = ["meson.build", "meson_options.txt"] roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } From 23fea46815371a8e1a0fa340be34d80624cd9bcc Mon Sep 17 00:00:00 2001 From: Ambuj Singh <97109381+that-ambuj@users.noreply.github.com> Date: Mon, 13 Nov 2023 03:34:36 +0530 Subject: [PATCH 017/480] theme: Add Theme poimandres (#8759) * theme: Add Theme poimandres * theme: inherit `poimandres_storm` from `poimandres` with minor tweaks * fix(theme): rename `crossed-out` to `crossed_out` * fix(theme:poimandres): improve contrast of selection color for regular variant --- runtime/themes/poimandres.toml | 113 +++++++++++++++++++++++++++ runtime/themes/poimandres_storm.toml | 19 +++++ 2 files changed, 132 insertions(+) create mode 100644 runtime/themes/poimandres.toml create mode 100644 runtime/themes/poimandres_storm.toml diff --git a/runtime/themes/poimandres.toml b/runtime/themes/poimandres.toml new file mode 100644 index 000000000..5dbc799d5 --- /dev/null +++ b/runtime/themes/poimandres.toml @@ -0,0 +1,113 @@ +# Author: Ambuj Kumar +# Ported from: https://github.com/drcmda/poimandres-theme + +attribute = { fg = "desaturatedBlue", modifiers = ["italic"] } +keyword = "brightMint" +"keyword.directive" = "gray" +"keyword.storage.type" = "desaturatedBlue" +"keyword.storage.modifier" = "lowerMint" +"keyword.other" = "brightMint" +"keyword.operator" = "desaturatedBlue" +namespace = "lightBlue" +punctuation = "gray" +"punctuation.bracket" = "desaturatedBlue" +operator = "desaturatedBlue" +special = "desaturatedBlue" +variable = "offWhite" +"variable.parameter" = { fg = "offWhite" } +"variable.builtin" = { fg = "lightBlue", modifiers = ["italic"] } +"variable.other" = "offWhite" +type = { fg = "gray.c0" } +"type.builtin" = { fg = "desaturatedBlue" } +constructor = "lightBlue" +function = "lightBlue" +"function.method" = { fg = "lightBlue" } +tag = "brightMint" +comment = { fg = "darkerGray.b0", modifiers = ["italic"] } +constant = "brightMint" +"constant.character.escape" = { fg = "offWhite" } +"constant.numeric" = { fg = "brightMint" } +"constant.builtin" = { fg = "hotRed" } +label = { fg = "gray.c0" } +string = { fg = "brightMint" } + +# Markup +"markup.heading" = { fg = "brightMint" } +"markup.bold" = { fg = "bluishGrayBrighter", modifiers = ["bold"] } +"markup.italic" = { fg = "bluishGrayBrighter", modifiers = ["italic"] } +"markup.strikethrough" = { modifiers = ["italic", "crossed_out"] } + +# UI +"markup.link.url" = { fg = "lightBlue", modifiers = ["underlined"] } +"markup.link.text" = { fg = "lightBlue", modifiers = ["underlined"] } +"markup.raw" = { fg = "lightBlue" } + +"ui.background" = { bg = "bg" } +"ui.background.separator" = { fg = "darkerGray" } +"ui.linenr" = "darkerGray.50" +"ui.linenr.selected" = "offWhite" +"ui.cursor" = { bg = "gray", fg = "bg" } +"ui.cursor.match" = { bg = "focus" } +"ui.cursorline" = { bg = "#242837" } + +"ui.popup" = { bg = "#20232d" } +"ui.window" = "gray" + +"ui.text" = "gray" +"ui.text.focus" = { fg = "offWhite", bg = "focus", modifiers = ["bold"] } +"ui.text.inactive" = "darkerGray" +"ui.virtual" = { fg = "darkerGray.b0" } +"ui.virtual.indent-guide" = "#303442" + +"ui.selection" = { bg = "focus" } +"ui.selection.primary" = { bg = "selection" } + +"ui.menu" = { fg = "offWhite", bg = "bg" } +"ui.menu.selected" = { fg = "bg", bg = "gray" } +"ui.menu.scroll" = { fg = "gray", bg = "bg" } + +"ui.statusline" = { fg = "offWhite", bg = "selection" } +"ui.statusline.inactive" = { fg = "lightBlue", bg = "bg" } +"ui.statusline.normal" = { bg = "lightBlue", fg = "bg", modifiers = ["bold"] } +"ui.statusline.insert" = { bg = "brightMint", fg = "bg", modifiers = ["bold"] } +"ui.statusline.select" = { bg = "hotRed", fg = "bg", modifiers = ["bold"] } + +"diagnostic.hint" = { underline = { color = "lowerMint", style = "curl" } } +"diagnostic.info" = { underline = { color = "lightBlue", style = "curl" } } +"diagnostic.warning" = { underline = { color = "brightYellow", style = "curl" } } +"diagnostic.error" = { underline = { color = "hotRed", style = "curl" } } + +hint = "lowerMint" +info = "lightBlue" +warning = "brightYellow" +error = "hotRed" + +# Version Control +"diff.plus" = "lowerMint" +"diff.minus" = "hotRed" +"diff.delta" = "lightBlue" + +[palette] +brightYellow = "#fffac2" +brightMint = "#5DE4c7" +lowerMint = "#5fb3a1" +blueishGreen = "#42675A" +lowerBlue = "#89ddff" +lightBlue = "#ADD7FF" +desaturatedBlue = "#91B4D5" +bluishGrayBrighter = "#7390AA" +hotRed = "#d0679d" +pink = "#f087bd" +gray = "#a6accd" +"gray.c0" = "#98a0c2" +darkerGray = "#767c9d" +"darkerGray.50" = "#404559" +"darkerGray.b0" = "#6c7494" +bluishGray = "#506477" +focus = "#303340" +bg = "#1b1e28" +offWhite = "#e4f0fb" +selection = "#30354a" +white = "#ffffff" +black = "#000000" +transparent = "#00000000" diff --git a/runtime/themes/poimandres_storm.toml b/runtime/themes/poimandres_storm.toml new file mode 100644 index 000000000..123122070 --- /dev/null +++ b/runtime/themes/poimandres_storm.toml @@ -0,0 +1,19 @@ +# Author: Ambuj Kumar +# Ported from: https://github.com/drcmda/poimandres-theme + +inherits = "poimandres" + +"ui.cursorline" = { bg = "#303747" } +"ui.popup" = { bg = "#2a303c" } +"ui.virtual.indent-guide" = "#3a4151" + +[palette] +"gray.c0" = "#98a2c4" +darkerGray = "#868cad" +"darkerGray.50" = "#4f576d" +"darkerGray.b0" = "#818cae" +bluishGray = "#607487" +focus = "#404350" +bg = "#252b37" +selection = "#3d455c" +black = "#101010" From 5ec53c02224557935a0e955c99e021943a372fd1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:55:57 +0900 Subject: [PATCH 018/480] build(deps): bump tokio from 1.33.0 to 1.34.0 (#8811) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 18 +++++++++--------- helix-lsp/Cargo.toml | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e1df49f49..1f4c04020 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1535,14 +1535,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "log", "wasi", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2009,9 +2009,9 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -2184,9 +2184,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -2203,9 +2203,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index 0b181a845..50b296b37 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -25,7 +25,7 @@ lsp-types = { version = "0.94" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" -tokio = { version = "1.33", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } +tokio = { version = "1.34", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } tokio-stream = "0.1.14" which = "4.4" parking_lot = "0.12.1" From 13386a47865f7cf857dbd78dbfd107e0e2fa9bd8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:56:13 +0900 Subject: [PATCH 019/480] build(deps): bump smallvec from 1.11.1 to 1.11.2 (#8808) 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 1f4c04020..6d8c7166d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1986,9 +1986,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "smartstring" From 8b2d97eb56d6cffcc6ce235d6a6bf2d56055fe4b Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 13 Nov 2023 09:24:24 -0500 Subject: [PATCH 020/480] Default 'roots' field of language config Previously roots needed to be specified by every language and `[]` was used as an explicit default. Root files don't make sense for every language (for example TOML) so I think we should allow languages to not explicitly mention the key and have the `[]` default automatically. --- helix-core/src/syntax.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 881b45098..36a1e5c97 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -101,7 +101,8 @@ pub struct LanguageConfiguration { pub file_types: Vec, // filename extension or ends_with? #[serde(default)] pub shebangs: Vec, // interpreter(s) associated with language - pub roots: Vec, // these indicate project roots <.git, Cargo.toml> + #[serde(default)] + pub roots: Vec, // these indicate project roots <.git, Cargo.toml> pub comment_token: Option, pub text_width: Option, pub soft_wrap: Option, From 69a0df929a1cfbe0a313e328b90ebcfa7c655be4 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 13 Nov 2023 10:13:54 -0500 Subject: [PATCH 021/480] Remove 'roots' keys with default value from languages.toml --- languages.toml | 142 ------------------------------------------------- 1 file changed, 142 deletions(-) diff --git a/languages.toml b/languages.toml index 7d4326a1d..8761f90ad 100644 --- a/languages.toml +++ b/languages.toml @@ -249,7 +249,6 @@ name = "toml" scope = "source.toml" injection-regex = "toml" file-types = ["toml", "poetry.lock", "Cargo.lock"] -roots = [] comment-token = "#" language-servers = [ "taplo" ] indent = { tab-width = 2, unit = " " } @@ -263,7 +262,6 @@ name = "awk" scope = "source.awk" injection-regex = "awk" file-types = ["awk", "gawk", "nawk", "mawk"] -roots = [] comment-token = "#" language-servers = [ "awk-language-server" ] indent = { tab-width = 2, unit = " " } @@ -278,7 +276,6 @@ scope = "source.proto" injection-regex = "protobuf" file-types = ["proto"] language-servers = [ "bufls", "pbkit" ] -roots = [] comment-token = "//" indent = { tab-width = 2, unit = " " } @@ -307,7 +304,6 @@ scope = "source.fish" injection-regex = "fish" file-types = ["fish"] shebangs = ["fish"] -roots = [] comment-token = "#" indent = { tab-width = 4, unit = " " } @@ -321,7 +317,6 @@ scope = "source.mint" injection-regex = "mint" file-types = ["mint"] shebangs = [] -roots = [] comment-token = "//" language-servers = [ "mint" ] indent = { tab-width = 2, unit = " " } @@ -351,7 +346,6 @@ file-types = [ "composer.lock", ".watchmanconfig" ] -roots = [] language-servers = [ "vscode-json-language-server" ] auto-format = true indent = { tab-width = 2, unit = " " } @@ -366,7 +360,6 @@ name = "json5" scope = "source.json5" injection-regex = "json5" file-types = ["json5"] -roots = [] language-servers = [] comment-token = "//" indent = { tab-width = 4, unit = " " } @@ -381,7 +374,6 @@ name = "c" scope = "source.c" injection-regex = "c" file-types = ["c"] # TODO: ["h"] -roots = [] comment-token = "//" language-servers = [ "clangd" ] indent = { tab-width = 2, unit = " " } @@ -418,7 +410,6 @@ name = "cpp" scope = "source.cpp" injection-regex = "cpp" file-types = ["cc", "hh", "c++", "cpp", "hpp", "h", "ipp", "tpp", "cxx", "hxx", "ixx", "txx", "ino", "C", "H", "cu", "cuh", "cppm", "h++", "ii", "inl", { suffix = ".hpp.in" }, { suffix = ".h.in" }] -roots = [] comment-token = "//" language-servers = [ "clangd" ] indent = { tab-width = 2, unit = " " } @@ -551,7 +542,6 @@ name = "gomod" scope = "source.gomod" injection-regex = "gomod" file-types = ["go.mod"] -roots = [] auto-format = true comment-token = "//" language-servers = [ "gopls" ] @@ -566,7 +556,6 @@ name = "gotmpl" scope = "source.gotmpl" injection-regex = "gotmpl" file-types = ["gotmpl"] -roots = [] comment-token = "//" language-servers = [ "gopls" ] indent = { tab-width = 2, unit = " " } @@ -580,7 +569,6 @@ name = "gowork" scope = "source.gowork" injection-regex = "gowork" file-types = ["go.work"] -roots = [] auto-format = true comment-token = "//" language-servers = [ "gopls" ] @@ -597,7 +585,6 @@ injection-regex = "(js|javascript)" language-id = "javascript" file-types = ["js", "mjs", "cjs", "rules", "es6", "pac", "jakefile"] shebangs = ["node"] -roots = [] comment-token = "//" language-servers = [ "typescript-language-server" ] indent = { tab-width = 2, unit = " " } @@ -624,7 +611,6 @@ scope = "source.jsx" injection-regex = "jsx" language-id = "javascriptreact" file-types = ["jsx"] -roots = [] comment-token = "//" language-servers = [ "typescript-language-server" ] indent = { tab-width = 2, unit = " " } @@ -637,7 +623,6 @@ injection-regex = "(ts|typescript)" file-types = ["ts", "mts", "cts"] language-id = "typescript" shebangs = ["deno", "ts-node"] -roots = [] language-servers = [ "typescript-language-server" ] indent = { tab-width = 2, unit = " " } @@ -651,7 +636,6 @@ scope = "source.tsx" injection-regex = "(tsx)" # |typescript language-id = "typescriptreact" file-types = ["tsx"] -roots = [] language-servers = [ "typescript-language-server" ] indent = { tab-width = 2, unit = " " } @@ -664,7 +648,6 @@ name = "css" scope = "source.css" injection-regex = "css" file-types = ["css", "scss"] -roots = [] language-servers = [ "vscode-css-language-server" ] auto-format = true indent = { tab-width = 2, unit = " " } @@ -678,7 +661,6 @@ name = "scss" scope = "source.scss" injection-regex = "scss" file-types = ["scss"] -roots = [] language-servers = [ "vscode-css-language-server" ] auto-format = true indent = { tab-width = 2, unit = " " } @@ -692,7 +674,6 @@ name = "html" scope = "text.html.basic" injection-regex = "html" file-types = ["html", "htm", "shtml", "xhtml", "xht", "jsp", "asp", "aspx", "jshtm", "volt", "rhtml"] -roots = [] language-servers = [ "vscode-html-language-server" ] auto-format = true indent = { tab-width = 2, unit = " " } @@ -723,7 +704,6 @@ scope = "source.nickel" injection-regex = "nickel" file-types = ["ncl"] shebangs = [] -roots = [] comment-token = "#" language-servers = [ "nls" ] indent = { tab-width = 2, unit = " " } @@ -744,7 +724,6 @@ scope = "source.nix" injection-regex = "nix" file-types = ["nix"] shebangs = [] -roots = [] comment-token = "#" language-servers = [ "nil" ] indent = { tab-width = 2, unit = " " } @@ -794,7 +773,6 @@ file-types = [ "Gymfile" ] shebangs = ["ruby"] -roots = [] comment-token = "#" language-servers = [ "solargraph" ] indent = { tab-width = 2, unit = " " } @@ -849,7 +827,6 @@ file-types = [ "zshrc_Apple_Terminal" ] shebangs = ["sh", "bash", "dash", "zsh"] -roots = [] comment-token = "#" language-servers = [ "bash-language-server" ] indent = { tab-width = 2, unit = " " } @@ -877,7 +854,6 @@ name = "twig" scope = "source.twig" injection-regex = "twig" file-types = ["twig"] -roots = [] indent = { tab-width = 2, unit = " " } [[grammar]] @@ -889,7 +865,6 @@ name = "latex" scope = "source.tex" injection-regex = "tex" file-types = ["tex", "sty", "cls", "Rd", "bbx", "cbx"] -roots = [] comment-token = "%" language-servers = [ "texlab" ] indent = { tab-width = 4, unit = "\t" } @@ -903,7 +878,6 @@ name = "bibtex" scope = "source.bib" injection-regex = "bib" file-types = ["bib"] -roots = [] comment-token = "%" language-servers = [ "texlab" ] indent = { tab-width = 4, unit = "\t" } @@ -946,7 +920,6 @@ name = "lpf" comment-token = "#" scope = "source.lpf" file-types = ["lpf"] -roots = [] [[grammar]] name = "lpf" @@ -985,7 +958,6 @@ name = "ledger" scope = "source.ledger" injection-regex = "ledger" file-types = ["ldg", "ledger", "journal"] -roots = [] comment-token = ";" indent = { tab-width = 4, unit = " " } @@ -998,7 +970,6 @@ name = "beancount" scope = "source.beancount" injection-regex = "beancount" file-types = ["beancount", "bean"] -roots = [] comment-token = ";" indent = { tab-width = 2, unit = " " } @@ -1012,7 +983,6 @@ scope = "source.ocaml" injection-regex = "ocaml" file-types = ["ml"] shebangs = ["ocaml", "ocamlrun", "ocamlscript"] -roots = [] comment-token = "(**)" language-servers = [ "ocamllsp" ] indent = { tab-width = 2, unit = " " } @@ -1032,7 +1002,6 @@ name = "ocaml-interface" scope = "source.ocaml.interface" file-types = ["mli"] shebangs = [] -roots = [] comment-token = "(**)" language-servers = [ "ocamllsp" ] indent = { tab-width = 2, unit = " " } @@ -1067,7 +1036,6 @@ name = "svelte" scope = "source.svelte" injection-regex = "svelte" file-types = ["svelte"] -roots = [] indent = { tab-width = 2, unit = " " } language-servers = [ "svelteserver" ] @@ -1092,7 +1060,6 @@ source = { git = "https://github.com/ikatyang/tree-sitter-vue", rev = "91fe27547 name = "yaml" scope = "source.yaml" file-types = ["yml", "yaml"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } language-servers = [ "yaml-language-server", "ansible-language-server" ] @@ -1120,7 +1087,6 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-haskell", rev = "d7 name = "haskell-persistent" scope = "source.persistentmodels" file-types = ["persistentmodels"] -roots = [] comment-token = "--" indent = { tab-width = 2, unit = " " } @@ -1186,7 +1152,6 @@ source = { git = "https://github.com/maxxnino/tree-sitter-zig", rev = "0d08703e4 [[language]] name = "prolog" scope = "source.prolog" -roots = [] file-types = ["pl", "prolog"] shebangs = ["swipl"] comment-token = "%" @@ -1196,7 +1161,6 @@ language-servers = [ "swipl" ] name = "tsq" scope = "source.tsq" file-types = ["tsq"] -roots = [] comment-token = ";" injection-regex = "tsq" indent = { tab-width = 2, unit = " " } @@ -1209,7 +1173,6 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-tsq", rev = "48b5 name = "cmake" scope = "source.cmake" file-types = ["cmake", "CMakeLists.txt"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } language-servers = [ "cmake-language-server" ] @@ -1225,7 +1188,6 @@ scope = "source.make" file-types = ["Makefile", "makefile", "make", "mk", "mak", "GNUmakefile", "OCamlMakefile"] shebangs = ["make", "gmake"] injection-regex = "(make|makefile|Makefile|mk)" -roots = [] comment-token = "#" indent = { tab-width = 4, unit = "\t" } @@ -1237,7 +1199,6 @@ source = { git = "https://github.com/alemuller/tree-sitter-make", rev = "a4b9187 name = "glsl" scope = "source.glsl" file-types = ["glsl", "vert", "tesc", "tese", "geom", "frag", "comp" ] -roots = [] comment-token = "//" indent = { tab-width = 4, unit = " " } injection-regex = "glsl" @@ -1251,7 +1212,6 @@ name = "perl" scope = "source.perl" file-types = ["pl", "pm", "t", "psgi", "raku", "rakumod", "rakutest", "rakudoc", "nqp", "p6", "pl6", "pm6"] shebangs = ["perl"] -roots = [] comment-token = "#" language-servers = [ "perlnavigator" ] indent = { tab-width = 2, unit = " " } @@ -1264,7 +1224,6 @@ source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = " name = "pod" scope = "source.pod" injection-regex = "pod" -roots = [] file-types = ["pod"] [[grammar]] @@ -1274,7 +1233,6 @@ source = { git = "https://github.com/tree-sitter-perl/tree-sitter-pod", rev = "d [[language]] name = "racket" scope = "source.racket" -roots = [] file-types = ["rkt", "rktd", "rktl", "scrbl"] shebangs = ["racket"] comment-token = ";" @@ -1285,7 +1243,6 @@ grammar = "scheme" [[language]] name = "common-lisp" scope = "source.lisp" -roots = [] file-types = ["lisp", "asd", "cl", "l", "lsp", "ny", "podsl", "sexp"] shebangs = ["lisp", "sbcl", "ccl", "clisp", "ecl"] comment-token = ";" @@ -1302,7 +1259,6 @@ grammar = "scheme" [[language]] name = "comment" scope = "scope.comment" -roots = [] file-types = [] injection-regex = "comment" @@ -1314,7 +1270,6 @@ source = { git = "https://github.com/stsewd/tree-sitter-comment", rev = "5dd3c62 name = "wgsl" scope = "source.wgsl" file-types = ["wgsl"] -roots = [] comment-token = "//" language-servers = [ "wgsl_analyzer" ] indent = { tab-width = 4, unit = " " } @@ -1326,7 +1281,6 @@ source = { git = "https://github.com/szebniok/tree-sitter-wgsl", rev = "272e89ef [[language]] name = "llvm" scope = "source.llvm" -roots = [] file-types = ["ll"] comment-token = ";" indent = { tab-width = 2, unit = " " } @@ -1339,7 +1293,6 @@ source = { git = "https://github.com/benwilliamgraham/tree-sitter-llvm", rev = " [[language]] name = "llvm-mir" scope = "source.llvm_mir" -roots = [] file-types = [] comment-token = ";" indent = { tab-width = 2, unit = " " } @@ -1355,7 +1308,6 @@ name = "llvm-mir-yaml" # # grammar = "yaml" scope = "source.yaml" -roots = [] file-types = ["mir"] comment-token = "#" indent = { tab-width = 2, unit = " " } @@ -1363,7 +1315,6 @@ indent = { tab-width = 2, unit = " " } [[language]] name = "tablegen" scope = "source.tablegen" -roots = [] file-types = ["td"] comment-token = "//" indent = { tab-width = 2, unit = " " } @@ -1391,7 +1342,6 @@ name = "markdown.inline" scope = "source.markdown.inline" injection-regex = "markdown\\.inline" file-types = [] -roots = [] grammar = "markdown_inline" [[grammar]] @@ -1442,7 +1392,6 @@ source = { git = "https://github.com/camdencheek/tree-sitter-dockerfile", rev = [[language]] name = "git-commit" scope = "git.commitmsg" -roots = [] file-types = ["COMMIT_EDITMSG"] comment-token = "#" indent = { tab-width = 2, unit = " " } @@ -1456,7 +1405,6 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-git-commit", rev [[language]] name = "diff" scope = "source.diff" -roots = [] file-types = ["diff", "patch", "rej"] injection-regex = "diff" comment-token = "#" @@ -1469,7 +1417,6 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-diff", rev = "fd7 [[language]] name = "git-rebase" scope = "source.gitrebase" -roots = [] file-types = ["git-rebase-todo"] injection-regex = "git-rebase" comment-token = "#" @@ -1484,7 +1431,6 @@ name = "regex" scope = "source.regex" injection-regex = "regex" file-types = ["regex", ".Rbuildignore"] -roots = [] [[grammar]] name = "regex" @@ -1493,7 +1439,6 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-regex", rev = "e1cf [[language]] name = "git-config" scope = "source.gitconfig" -roots = [] file-types = [".gitmodules", ".gitconfig", { suffix = ".git/config" }, { suffix = ".config/git/config" }] injection-regex = "git-config" comment-token = "#" @@ -1506,7 +1451,6 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-git-config", rev [[language]] name = "git-attributes" scope = "source.gitattributes" -roots = [] file-types = [".gitattributes"] injection-regex = "git-attributes" comment-token = "#" @@ -1519,7 +1463,6 @@ source = { git = "https://github.com/mtoohey31/tree-sitter-gitattributes", rev = [[language]] name = "git-ignore" scope = "source.gitignore" -roots = [] file-types = [".gitignore", ".gitignore_global", ".ignore", ".prettierignore", ".eslintignore", ".npmignore", "CODEOWNERS"] injection-regex = "git-ignore" comment-token = "#" @@ -1534,7 +1477,6 @@ name = "graphql" scope = "source.graphql" injection-regex = "graphql" file-types = ["gql", "graphql", "graphqls"] -roots = [] language-servers = [ "graphql-language-service" ] indent = { tab-width = 2, unit = " " } @@ -1562,7 +1504,6 @@ name = "iex" scope = "source.iex" injection-regex = "iex" file-types = ["iex"] -roots = [] [[grammar]] name = "iex" @@ -1625,7 +1566,6 @@ scope = "source.hcl" injection-regex = "(hcl|tf|nomad)" language-id = "terraform" file-types = ["hcl", "tf", "nomad"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } language-servers = [ "terraform-ls" ] @@ -1640,7 +1580,6 @@ name = "tfvars" scope = "source.tfvars" language-id = "terraform-vars" file-types = ["tfvars"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } language-servers = [ "terraform-ls" ] @@ -1652,7 +1591,6 @@ name = "org" scope = "source.org" injection-regex = "org" file-types = ["org"] -roots = [] indent = { tab-width = 2, unit = " " } [[grammar]] @@ -1664,7 +1602,6 @@ name = "solidity" scope = "source.sol" injection-regex = "(sol|solidity)" file-types = ["sol"] -roots = [] comment-token = "//" indent = { tab-width = 4, unit = " " } language-servers = [ "solc" ] @@ -1693,7 +1630,6 @@ name = "ron" scope = "source.ron" injection-regex = "ron" file-types = ["ron"] -roots = [] comment-token = "//" indent = { tab-width = 4, unit = " " } @@ -1707,7 +1643,6 @@ scope = "source.robot" injection-regex = "robot" file-types = ["robot", "resource"] comment-token = "#" -roots = [] indent = { tab-width = 4, unit = " " } language-servers = [ "robotframework_ls" ] @@ -1721,7 +1656,6 @@ scope = "source.r" injection-regex = "(r|R)" file-types = ["r", "R", ".Rprofile", "Rprofile.site", ".RHistory"] shebangs = ["r", "R"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } language-servers = [ "r" ] @@ -1735,7 +1669,6 @@ name = "rmarkdown" scope = "source.rmd" injection-regex = "(r|R)md" file-types = ["rmd", "Rmd"] -roots = [] indent = { tab-width = 2, unit = " " } grammar = "markdown" language-servers = [ "r" ] @@ -1759,7 +1692,6 @@ name = "erb" scope = "text.html.erb" injection-regex = "erb" file-types = ["erb"] -roots = [] indent = { tab-width = 2, unit = " " } grammar = "embedded-template" @@ -1768,7 +1700,6 @@ name = "ejs" scope = "text.html.ejs" injection-regex = "ejs" file-types = ["ejs"] -roots = [] indent = { tab-width = 2, unit = " " } grammar = "embedded-template" @@ -1805,7 +1736,6 @@ source = { git = "https://github.com/phoenixframework/tree-sitter-heex", rev = " name = "sql" scope = "source.sql" file-types = ["sql", "dsql"] -roots = [] comment-token = "--" indent = { tab-width = 4, unit = " " } injection-regex = "sql" @@ -1851,7 +1781,6 @@ scope = "source.nu" injection-regex = "nu" file-types = ["nu"] shebangs = ["nu"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } @@ -1864,7 +1793,6 @@ name = "vala" scope = "source.vala" injection-regex = "vala" file-types = ["vala", "vapi"] -roots = [] comment-token = "//" indent = { tab-width = 2, unit = " " } language-servers = [ "vala-language-server" ] @@ -1878,7 +1806,6 @@ name = "hare" scope = "source.hare" injection-regex = "hare" file-types = ["ha"] -roots = [] comment-token = "//" indent = { tab-width = 8, unit = "\t" } @@ -1891,7 +1818,6 @@ name = "devicetree" scope = "source.devicetree" injection-regex = "(dtsi?|devicetree|fdt)" file-types = ["dts", "dtsi"] -roots = [] comment-token = "//" indent = { tab-width = 4, unit = "\t" } @@ -1904,7 +1830,6 @@ name = "cairo" scope = "source.cairo" injection-regex = "cairo" file-types = ["cairo"] -roots = [] comment-token = "//" indent = { tab-width = 4, unit = " " } # auto-format = true @@ -1916,7 +1841,6 @@ name = "cpon" scope = "scope.cpon" injection-regex = "cpon" file-types = ["cpon", "cp"] -roots = [] auto-format = true comment-token = "//" indent = { tab-width = 2, unit = " " } @@ -1944,7 +1868,6 @@ name = "meson" scope = "source.meson" injection-regex = "meson" file-types = ["meson.build", "meson_options.txt"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } @@ -1956,7 +1879,6 @@ source = { git = "https://github.com/staysail/tree-sitter-meson", rev = "32a83e8 name = "sshclientconfig" scope = "source.sshclientconfig" file-types = [{ suffix = ".ssh/config" }, { suffix = "/etc/ssh/ssh_config" }] -roots = [] comment-token = "#" [[grammar]] @@ -1969,7 +1891,6 @@ scope = "source.scheme" injection-regex = "scheme" file-types = ["ss", "scm"] shebangs = ["scheme", "guile", "chicken"] -roots = [] comment-token = ";" indent = { tab-width = 2, unit = " " } @@ -1996,7 +1917,6 @@ source = {git = "https://github.com/v-analyzer/v-analyzer", subpath = "tree_sitt name = "verilog" scope = "source.verilog" file-types = ["v", "vh", "sv", "svh"] -roots = [] comment-token = "//" language-servers = [ "svlangserver" ] indent = { tab-width = 2, unit = " " } @@ -2011,7 +1931,6 @@ name = "edoc" scope = "source.edoc" file-types = ["edoc", "edoc.in"] injection-regex = "edoc" -roots = [] indent = { tab-width = 4, unit = " " } [[grammar]] @@ -2023,7 +1942,6 @@ name = "jsdoc" scope = "source.jsdoc" injection-regex = "jsdoc" file-types = ["jsdoc"] -roots = [] indent = { tab-width = 2, unit = " " } [[grammar]] @@ -2035,7 +1953,6 @@ name = "openscad" scope = "source.openscad" injection-regex = "openscad" file-types = ["scad"] -roots = [] comment-token = "//" language-servers = [ "openscad-lsp" ] indent = { tab-width = 2, unit = "\t" } @@ -2077,7 +1994,6 @@ name = "starlark" scope = "source.starlark" injection-regex = "(starlark|bzl|bazel)" file-types = ["bzl", "bazel", "BUILD", "star"] -roots = [] comment-token = "#" indent = { tab-width = 4, unit = " " } grammar = "python" @@ -2086,7 +2002,6 @@ grammar = "python" name = "elvish" scope = "source.elvish" file-types = ["elv"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } language-servers = [ "elvish" ] @@ -2102,7 +2017,6 @@ scope = "source.idr" injection-regex = "idr" file-types = ["idr"] shebangs = [] -roots = [] comment-token = "--" indent = { tab-width = 2, unit = " " } language-servers = [ "idris2-lsp" ] @@ -2126,7 +2040,6 @@ name = "ungrammar" scope = "source.ungrammar" injection-regex = "ungrammar" file-types = ["ungram", "ungrammar"] -roots = [] comment-token = "//" indent = { tab-width = 2, unit = " " } @@ -2139,7 +2052,6 @@ name = "dot" scope = "source.dot" injection-regex = "dot" file-types = ["dot"] -roots = [] comment-token = "//" indent = { tab-width = 4, unit = " " } language-servers = [ "dot-language-server" ] @@ -2169,7 +2081,6 @@ name = "slint" scope = "source.slint" injection-regex = "slint" file-types = ["slint"] -roots = [] comment-token = "//" indent = { tab-width = 4, unit = " " } language-servers = [ "slint-lsp" ] @@ -2183,7 +2094,6 @@ name = "task" scope = "source.task" injection-regex = "task" file-types = ["task"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } @@ -2196,7 +2106,6 @@ name = "xit" scope = "source.xit" injection-regex = "xit" file-types = ["xit"] -roots = [] indent = { tab-width = 4, unit = " " } [[grammar]] @@ -2221,7 +2130,6 @@ name = "pascal" scope = "source.pascal" injection-regex = "pascal" file-types = ["pas", "pp", "inc", "lpr", "lfm"] -roots = [] comment-token = "//" indent = { tab-width = 2, unit = " " } language-servers = [ "pasls" ] @@ -2236,7 +2144,6 @@ scope = "source.sml" injection-regex = "sml" file-types = ["sml"] comment-token = "(*" -roots = [] [[grammar]] name = "sml" @@ -2260,7 +2167,6 @@ name = "astro" scope = "source.astro" injection-regex = "astro" file-types = ["astro"] -roots = [] indent = { tab-width = 2, unit = " " } [[grammar]] @@ -2272,7 +2178,6 @@ name = "bass" scope = "source.bass" injection-regex = "bass" file-types = ["bass"] -roots = [] comment-token = ";" indent = { tab-width = 2, unit = " " } language-servers = [ "bass" ] @@ -2286,7 +2191,6 @@ name = "wat" scope = "source.wat" comment-token = ";;" file-types = ["wat"] -roots = [] [[grammar]] name = "wat" @@ -2297,7 +2201,6 @@ name = "wast" scope = "source.wast" comment-token = ";;" file-types = ["wast"] -roots = [] [[grammar]] name = "wast" @@ -2307,7 +2210,6 @@ source = { git = "https://github.com/wasm-lsp/tree-sitter-wasm", rev = "2ca28a9f name = "d" scope = "source.d" file-types = [ "d", "dd" ] -roots = [] comment-token = "//" injection-regex = "d" indent = { tab-width = 4, unit = " "} @@ -2322,7 +2224,6 @@ source = { git = "https://github.com/gdamore/tree-sitter-d", rev="601c4a1e8310fb name = "vhs" scope = "source.vhs" file-types = ["tape"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } grammar = "vhs" @@ -2335,7 +2236,6 @@ source = { git = "https://github.com/charmbracelet/tree-sitter-vhs", rev = "c6d8 name = "kdl" scope = "source.kdl" file-types = ["kdl"] -roots = [] comment-token = "//" injection-regex = "kdl" @@ -2404,7 +2304,6 @@ file-types = [ "xoml" ] indent = { tab-width = 2, unit = " " } -roots = [] [language.auto-pairs] '(' = ')' @@ -2425,7 +2324,6 @@ scope = "source.dtd" injection-regex = "dtd" file-types = ["dtd", "ent"] indent = {tab-width = 2, unit = " "} -roots = [] [language.auto-pairs] '(' = ')' @@ -2443,7 +2341,6 @@ name = "wit" scope = "source.wit" injection-regex = "wit" file-types = ["wit"] -roots = [] comment-token = "//" indent = { tab-width = 2, unit = " " } @@ -2466,7 +2363,6 @@ file-types = [".env", ".env.local", ".env.development", ".env.production", ".env injection-regex = "env" comment-token = "#" indent = { tab-width = 4, unit = "\t" } -roots = [] grammar = "bash" [[language]] @@ -2499,7 +2395,6 @@ file-types = [ injection-regex = "ini" comment-token = "#" indent = { tab-width = 4, unit = "\t" } -roots = [] [[grammar]] name = "ini" @@ -2509,7 +2404,6 @@ source = { git = "https://github.com/justinmk/tree-sitter-ini", rev = "4d247fb87 name = "bicep" scope = "source.bicep" file-types = ["bicep"] -roots = [] auto-format = true comment-token = "//" indent = { tab-width = 2, unit = " "} @@ -2523,7 +2417,6 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-bicep", rev = "d8 name = "qml" scope = "source.qml" file-types = ["qml"] -roots = [] language-servers = [ "qmlls" ] indent = { tab-width = 4, unit = " " } grammar = "qmljs" @@ -2537,7 +2430,6 @@ name = "mermaid" scope = "source.mermaid" injection-regex = "mermaid" file-types = ["mermaid"] -roots = [] comment-token = "%%" indent = { tab-width = 4, unit = " " } @@ -2551,7 +2443,6 @@ scope = "source.m" file-types = ["m"] comment-token = "%" shebangs = ["octave-cli", "matlab"] -roots = [] indent = { tab-width = 2, unit = " " } [[grammar]] @@ -2576,7 +2467,6 @@ name = "dhall" scope = "source.dhall" injection-regex = "dhall" file-types = ["dhall"] -roots = [] comment-token = "--" indent = { tab-width = 2, unit = " " } language-servers = [ "dhall-lsp-server" ] @@ -2591,7 +2481,6 @@ name = "sage" scope = "source.sage" file-types = ["sage"] injection-regex = "sage" -roots = [] comment-token = "#" indent = { tab-width = 4, unit = " " } grammar = "python" @@ -2602,7 +2491,6 @@ scope = "source.msbuild" injection-regex = "msbuild" file-types = ["proj", "vbproj", "csproj", "fsproj", "targets", "props"] indent = { tab-width = 2, unit = " " } -roots = [] grammar = "xml" [language.auto-pairs] @@ -2618,7 +2506,6 @@ name = "pem" scope = "source.pem" file-types = ["pem", "cert", "crt"] injection-regex = "pem" -roots = [] grammar = "pem" [[grammar]] @@ -2629,7 +2516,6 @@ source = { git = "https://github.com/mtoohey31/tree-sitter-pem", rev = "be67a433 name = "passwd" scope = "source.passwd" file-types = ["passwd"] -roots = [] [[grammar]] name = "passwd" @@ -2639,7 +2525,6 @@ source = { git = "https://github.com/ath3/tree-sitter-passwd", rev = "20239395ea name = "hosts" scope = "source.hosts" file-types = ["hosts"] -roots = [] comment-token = "#" [[grammar]] @@ -2651,7 +2536,6 @@ name = "uxntal" scope = "source.tal" injection-regex = "tal" file-types = ["tal"] -roots = [] auto-format = false comment-token = "(" @@ -2664,7 +2548,6 @@ name = "yuck" scope = "source.yuck" injection-regex = "yuck" file-types = ["yuck"] -roots = [] comment-token = ";" indent = { tab-width = 2, unit = " " } @@ -2677,7 +2560,6 @@ name = "prql" scope = "source.prql" injection-regex = "prql" file-types = ["prql"] -roots = [] comment-token = "#" indent = { tab-width = 4, unit = " " } @@ -2689,7 +2571,6 @@ source = { git = "https://github.com/PRQL/tree-sitter-prql", rev = "09e158cd3650 name = "po" scope = "source.po" file-types = ["po", "pot"] -roots = [] comment-token = "#" [[grammar]] @@ -2701,7 +2582,6 @@ name = "nasm" scope = "source.nasm" file-types = ["asm", "S", "nasm"] injection-regex = "n?asm" -roots = [] comment-token = ";" indent = { tab-width = 8, unit = " " } @@ -2714,7 +2594,6 @@ name = "gas" scope = "source.gas" file-types = ["s"] injection-regex = "gas" -roots = [] comment-token = "#" indent = { tab-width = 8, unit = " " } @@ -2727,7 +2606,6 @@ name = "rst" scope = "source.rst" comment-token = ".." file-types = ["rst"] -roots = [] [[grammar]] name = "rst" @@ -2738,7 +2616,6 @@ name = "capnp" scope = "source.capnp" injection-regex = "capnp" file-types = ["capnp"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } @@ -2764,7 +2641,6 @@ source = { git = "https://github.com/indoorvivants/tree-sitter-smithy", rev = "c name = "vhdl" scope = "source.vhdl" file-types = ["vhd", "vhdl"] -roots = [] comment-token = "--" language-servers = [ "vhdl_ls" ] indent = { tab-width = 2, unit = " " } @@ -2776,7 +2652,6 @@ source = { git = "https://github.com/teburd/tree-sitter-vhdl", rev = "c57313adee [[language]] name = "rego" -roots = [] scope = "source.rego" injection-regex = "rego" file-types = ["rego"] @@ -2795,7 +2670,6 @@ scope = "source.nim" injection-regex = "nim" file-types = ["nim", "nims", "nimble"] shebangs = [] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } language-servers = [ "nimlangserver" ] @@ -2825,7 +2699,6 @@ name = "hurl" scope = "source.hurl" injection-regex = "hurl" file-types = ["hurl"] -roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } @@ -2836,7 +2709,6 @@ source = { git = "https://github.com/pfeiferj/tree-sitter-hurl", rev = "264c4206 [[language]] name = "markdoc" scope = "text.markdoc" -roots = [] file-types = ["mdoc"] language-servers = [ "markdoc-ls" ] @@ -2849,7 +2721,6 @@ name = "opencl" scope = "source.cl" injection-regex = "(cl|opencl)" file-types = ["cl"] -roots = [] comment-token = "//" language-servers = [ "clangd" ] @@ -2862,7 +2733,6 @@ name = "just" scope = "source.just" file-types = ["justfile", "Justfile", ".justfile", ".Justfile"] injection-regex = "just" -roots = [] comment-token = "#" indent = { tab-width = 4, unit = "\t" } @@ -2875,7 +2745,6 @@ name = "blueprint" scope = "source.blueprint" injection-regex = "blueprint" file-types = ["blp"] -roots = [] comment-token = "//" language-servers = [ "blueprint-compiler" ] indent = { tab-width = 4, unit = " " } @@ -2889,7 +2758,6 @@ name = "forth" scope = "source.forth" injection-regex = "forth" file-types = ["fs", "forth", "fth", "4th"] -roots = [] comment-token = "\\" language-servers = [ "forth-lsp" ] indent = { tab-width = 3, unit = " " } @@ -2918,7 +2786,6 @@ name = "t32" scope = "source.t32" injection-regex = "t32" file-types = ["cmm", "t32"] -roots = [] comment-token = ";" indent = { tab-width = 2, unit = " " } @@ -2931,7 +2798,6 @@ name = "webc" scope = "text.html.webc" injection-regex = "webc" file-types = ["webc"] -roots = [] indent = { tab-width = 2, unit = " " } grammar = "html" @@ -2940,7 +2806,6 @@ name = "typst" scope = "source.typst" injection-regex = "typst" file-types = ["typst", "typ"] -roots = [] comment-token = "//" language-servers = ["typst-lsp"] indent = { tab-width = 2, unit = " " } @@ -2961,7 +2826,6 @@ name = "nunjucks" scope = "text.html.nunjucks" injection-regex = "nunjucks" file-types = ["njk"] -roots = [] indent = { tab-width = 2, unit = " " } grammar = "jinja2" @@ -2970,7 +2834,6 @@ name = "jinja" scope = "text.html.jinja" injection-regex = "jinja" file-types = ["jinja", "jinja2", "j2"] -roots = [] indent = { tab-width = 2, unit = " " } grammar = "jinja2" @@ -2987,7 +2850,6 @@ name = "wren" scope = "source.wren" injection-regex = "wren" file-types = ["wren"] -roots = [] indent = { tab-width = 2, unit = " "} [[language]] @@ -2996,7 +2858,6 @@ scope = "source.unison" injection-regex = "unison" file-types = ["u"] shebangs = [] -roots = [] auto-format = false comment-token = "--" indent = { tab-width = 4, unit = " " } @@ -3016,7 +2877,6 @@ source = { git = "https://github.com/kylegoetz/tree-sitter-unison", rev = "98c4e name = "todotxt" scope = "text.todotxt" file-types = [{ suffix = ".todo.txt" }, "todotxt"] -roots = [] formatter = { command = "sort" } auto-format = true @@ -3028,7 +2888,6 @@ source = { git = "https://github.com/arnarg/tree-sitter-todotxt", rev = "0207f6a name = "strace" scope = "source.strace" file-types = ["strace"] -roots = [] [[grammar]] name = "strace" @@ -3038,7 +2897,6 @@ source = { git = "https://github.com/sigmaSd/tree-sitter-strace", rev = "2b18fdf name = "gemini" scope = "source.gmi" file-types = ["gmi"] -roots = [] [[grammar]] name = "gemini" From e5d02cd4bd19c9db7825c969d3c2660e3bee93c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 12:15:37 +0900 Subject: [PATCH 022/480] build(deps): bump serde from 1.0.191 to 1.0.192 (#8810) 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 6d8c7166d..d44f952cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1869,18 +1869,18 @@ checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "serde" -version = "1.0.191" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.191" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", From 40959bb449ec9dfbff9249332853a02b50f483fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 12:15:50 +0900 Subject: [PATCH 023/480] build(deps): bump cc from 1.0.83 to 1.0.84 (#8809) 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 d44f952cf..1e85dd86b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,9 +160,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "0f8e7c90afad890484a21653d08b6e209ae34770fb5ee298f9c699fcc1e5c856" dependencies = [ "libc", ] From 2040444da9eb3a9b2438bf98c0568ce06ec4c1e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 20:21:00 +0100 Subject: [PATCH 024/480] build(deps): bump rustix from 0.38.21 to 0.38.22 (#8807) 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 1e85dd86b..f7361d0ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1458,9 +1458,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "lock_api" @@ -1829,9 +1829,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "80109a168d9bc0c7f483083244543a6eb0dba02295d33ca268145e6190d6df0c" dependencies = [ "bitflags 2.4.1", "errno", From 3c8bf9df4adc88b3e81b2955813098b873dde44a Mon Sep 17 00:00:00 2001 From: Eemil Haapanen <70660230+eemilhaa@users.noreply.github.com> Date: Fri, 17 Nov 2023 02:34:56 +0200 Subject: [PATCH 025/480] theme: add starlight (#8787) --- runtime/themes/starlight.toml | 113 ++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 runtime/themes/starlight.toml diff --git a/runtime/themes/starlight.toml b/runtime/themes/starlight.toml new file mode 100644 index 000000000..09db90fd6 --- /dev/null +++ b/runtime/themes/starlight.toml @@ -0,0 +1,113 @@ +# Author : eemilhaa +# Palette from : https://github.com/CosmicToast/starlight + +# Syntax +"function" = "green" +"constructor" = "green" + +"type" = "cyan" +"string.special" = "cyan" +"string.regexp" = "cyan" +"constant" = "cyan" +"punctuation.special" = "cyan" + +"namespace" = "white" +"module" = "white" +"variable" = "white" + +"attribute" = "magenta" +"variable.parameter" = "magenta" +"variable.other.member" = "magenta" +"type.parameter" = "magenta" + +"keyword" = "blue" +"variable.builtin" = "blue" +"label" = "blue" +"tag" = "blue" +"operator" = "blue" +"special" = "blue" + +"string" = "yellow" + +"punctuation" = "punct" + +"comment" = "dark-fg" + +# Markup +"markup.heading.marker" = { fg = "blue", modifiers = ["bold"] } +"markup.heading" = { fg = "white", modifiers = ["bold"] } +"markup.list" = "blue" +"markup.bold" = { fg = "magenta", modifiers = ["bold"] } +"markup.italic" = { fg = "magenta", modifiers = ["italic"] } +"markup.strikethrough" = "red" +"markup.link" = "cyan" +"markup.link.text" = "yellow" +"markup.quote" = "magenta" +"markup.raw" = "green" + +# UI +"diff.plus" = "green" +"diff.minus" = "red" +"diff.delta" = "blue" + +"ui.background" = { fg = "dark-fg", bg = "dark-bg" } +"ui.cursor" = { fg = "black", bg = "light-fg" } +"ui.cursor.primary" = { fg = "black", bg = "yellow" } +"ui.cursor.match" = { fg = "black", bg = "dark-blue", modifiers = ["bold"] } +"ui.linenr" = "dark-fg" +"ui.linenr.selected" = "yellow" +"ui.statusline" = { fg = "light-fg", bg = "light-bg" } +"ui.statusline.inactive" = { fg = "dark-fg", bg = "light-bg" } +"ui.statusline.insert" = { fg = "black", bg = "green" } +"ui.statusline.select" = { fg = "black", bg = "magenta" } +"ui.statusline.normal" = { fg = "black", bg = "blue" } +"ui.popup" = { fg = "dark-fg", bg = "light-bg" } +"ui.window" = { fg = "light-bg", bg = "dark-bg" } +"ui.help" = { fg = "light-fg", bg = "light-bg" } +"ui.text" = "light-fg" +"ui.text.focus" = { fg = "white", bg = "light-bg", modifiers = ["bold"] } +"ui.virtual" = "dark-fg" +"ui.virtual.ruler" = { bg = "medium-bg" } +"ui.virtual.indent-guide" = "indent" +"ui.virtual.whitespace" = "indent" +"ui.menu" = { fg = "light-fg", bg = "light-bg" } +"ui.menu.selected" = { fg = "white", bg = "dark-fg", modifiers = ["bold"] } +"ui.selection" = { fg = "light-fg", bg = "dark-fg" } +"ui.selection.primary" = { fg = "white", bg = "dark-blue" } +"ui.highlight" = { bg = "light-bg" } +"ui.cursorline.primary" = { bg = "black" } +"ui.cursorcolumn.primary" = { bg = "black" } +"ui.bufferline.background" = { bg = "dark-bg" } +"ui.bufferline" = { fg = "light-fg", bg = "light-bg" } +"ui.bufferline.active" = { fg = "white", bg = "dark-fg" } + +"diagnostic.error" = { underline = { color = "red", style = "curl" } } +"diagnostic.warning" = { underline = { color = "yellow", style = "curl" } } +"diagnostic.info" = { underline = { color = "blue", style = "curl" } } +"diagnostic.hint" = { underline = { color = "blue", style = "curl" } } + +"info" = "blue" +"hint" = "blue" +"warning" = "yellow" +"error" = "red" + +[palette] +# Colors +red = "#FF4D51" +green = "#35D450" +yellow = "#E9E836" +blue = "#5DC5F8" +dark-blue = "#24ACD4" +magenta = "#FEABF2" +cyan = "#24DFC4" +white = "#ffffff" +punct = "#C9C9C9" + +# Grays +black = "#1e1e1e" +dark-bg = "#242424" +medium-bg = "#2D2D2D" +light-bg = "#353535" +indent = "#616161" +dark-fg = "#929292" +light-fg = "#E6E6E6" From 73ca2d5f84c5728712c00135ff82a42ae3487b8c Mon Sep 17 00:00:00 2001 From: Seth Maurice-Brant <37915796+iSaluki@users.noreply.github.com> Date: Fri, 17 Nov 2023 21:54:30 +0000 Subject: [PATCH 026/480] Change Fedora installation to the new official Helix package (#8762) Remove COPR install in favour of official Helix package --- book/src/install.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/book/src/install.md b/book/src/install.md index dc028625b..897985013 100644 --- a/book/src/install.md +++ b/book/src/install.md @@ -65,10 +65,7 @@ sudo apt install helix ### Fedora/RHEL -Enable the `COPR` repository for Helix: - ```sh -sudo dnf copr enable varlad/helix sudo dnf install helix ``` From 5889b81fc7a7da25352f47240aa6d665ce6b8773 Mon Sep 17 00:00:00 2001 From: Luca Saccarola <96259932+saccarosium@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:57:15 +0100 Subject: [PATCH 027/480] docs: add docs for soft-wrap in languages.toml (#8836) --- book/src/languages.md | 1 + 1 file changed, 1 insertion(+) diff --git a/book/src/languages.md b/book/src/languages.md index 778489f8d..632a9146c 100644 --- a/book/src/languages.md +++ b/book/src/languages.md @@ -66,6 +66,7 @@ These configuration keys are available: | `language-servers` | The Language Servers used for this language. See below for more information in the section [Configuring Language Servers for a language](#configuring-language-servers-for-a-language) | | `grammar` | The tree-sitter grammar to use (defaults to the value of `name`) | | `formatter` | The formatter for the language, it will take precedence over the lsp when defined. The formatter must be able to take the original file as input from stdin and write the formatted file to stdout | +| `soft-wrap` | [editor.softwrap](./configuration.md#editorsoft-wrap-section) | `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap-at-text-width` is set, defaults to `editor.text-width` | | `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml`. Overwrites the setting of the same name in `config.toml` if set. | From 7868136a18aefc2c611d667b344dacacb4b9e8e1 Mon Sep 17 00:00:00 2001 From: crozbo <35157367+crozbo@users.noreply.github.com> Date: Sat, 18 Nov 2023 00:32:06 +0100 Subject: [PATCH 028/480] Theme: Papercolor: Add inlay-hint style (#8827) --- runtime/themes/papercolor-light.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/themes/papercolor-light.toml b/runtime/themes/papercolor-light.toml index 5c59d6f51..279fa2429 100644 --- a/runtime/themes/papercolor-light.toml +++ b/runtime/themes/papercolor-light.toml @@ -26,6 +26,9 @@ "ui.virtual.whitespace" = { fg = "regular5" } "ui.virtual.indent-guide" = { fg = "bright0" } "ui.virtual.ruler" = { bg = "cursorline_secondary_bg", fg = "regular4" } +"ui.virtual.inlay-hint" = { fg = "regular5", modifiers = ["italic"] } +"ui.virtual.inlay-hint.parameter" = { fg = "regular5", modifiers = ["italic"] } +"ui.virtual.inlay-hint.type" = { fg = "regular5", modifiers = ["bold", "italic"] } "ui.cursor.match" = { bg = "matchparen_bg", fg = "matchparen_fg" } "ui.cursor" = { bg = "regular5", fg = "background" } "ui.cursor.primary" = { bg = "foreground", fg = "background" } From 2579bca21c250050e59ef782380ca3f3ed44fbb0 Mon Sep 17 00:00:00 2001 From: WuerfelDev Date: Fri, 17 Nov 2023 23:34:17 +0000 Subject: [PATCH 029/480] Book: fix formatting of some default values (#8837) --- book/src/configuration.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/book/src/configuration.md b/book/src/configuration.md index f8796245f..f067038a5 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -166,14 +166,14 @@ All git related options are only enabled in a git repository. | Key | Description | Default | |--|--|---------| -|`hidden` | Enables ignoring hidden files | true -|`follow-symlinks` | Follow symlinks instead of ignoring them | true -|`deduplicate-links` | Ignore symlinks that point at files already shown in the picker | true -|`parents` | Enables reading ignore files from parent directories | true -|`ignore` | Enables reading `.ignore` files | true -|`git-ignore` | Enables reading `.gitignore` files | true -|`git-global` | Enables reading global `.gitignore`, whose path is specified in git's config: `core.excludefile` option | true -|`git-exclude` | Enables reading `.git/info/exclude` files | true +|`hidden` | Enables ignoring hidden files | `true` +|`follow-symlinks` | Follow symlinks instead of ignoring them | `true` +|`deduplicate-links` | Ignore symlinks that point at files already shown in the picker | `true` +|`parents` | Enables reading ignore files from parent directories | `true` +|`ignore` | Enables reading `.ignore` files | `true` +|`git-ignore` | Enables reading `.gitignore` files | `true` +|`git-global` | Enables reading global `.gitignore`, whose path is specified in git's config: `core.excludefile` option | `true` +|`git-exclude` | Enables reading `.git/info/exclude` files | `true` |`max-depth` | Set with an integer value for maximum depth to recurse | Defaults to `None`. ### `[editor.auto-pairs]` Section From 39aa6fa646aeae08f4156558af199df1ecba4638 Mon Sep 17 00:00:00 2001 From: blinxen Date: Sat, 18 Nov 2023 02:24:59 +0100 Subject: [PATCH 030/480] Update some grammars to a commit where the license file is included (#8691) --- languages.toml | 24 ++++++------ runtime/queries/purescript/highlights.scm | 23 ++++++++++-- runtime/queries/sql/highlights.scm | 46 +++++++++++++++++++++-- 3 files changed, 73 insertions(+), 20 deletions(-) diff --git a/languages.toml b/languages.toml index 8761f90ad..3456209ae 100644 --- a/languages.toml +++ b/languages.toml @@ -95,7 +95,7 @@ command = "ansible-language-server" args = ["--stdio"] [language-server.lua-language-server] -command = "lua-language-server" +command = "lua-language-server" [language-server.lua-language-server.config.Lua.hint] enable = true @@ -975,7 +975,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "beancount" -source = { git = "https://github.com/polarmutex/tree-sitter-beancount", rev = "4cbd1f09cd07c1f1fabf867c2cf354f9da53cc4c" } +source = { git = "https://github.com/polarmutex/tree-sitter-beancount", rev = "f3741a3a68ade59ec894ed84a64673494d2ba8f3" } [[language]] name = "ocaml" @@ -1108,7 +1108,7 @@ formatter = { command = "purs-tidy", args = ["format"] } [[grammar]] name = "purescript" -source = { git = "https://github.com/postsolar/tree-sitter-purescript", rev = "593193b9bf0f46d5eee708a4e53044d2a9054897" } +source = { git = "https://github.com/postsolar/tree-sitter-purescript", rev = "5ef5592674ea42de75fc2792972e4ea0b6e3da6c" } [[language]] name = "zig" @@ -1218,7 +1218,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "perl" -source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "9f3166800d40267fa68ed8273e96baf74f390517" } +source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "e99bb5283805db4cb86c964722d709df21b0ac16" } [[language]] name = "pod" @@ -1264,7 +1264,7 @@ injection-regex = "comment" [[grammar]] name = "comment" -source = { git = "https://github.com/stsewd/tree-sitter-comment", rev = "5dd3c62f1bbe378b220fe16b317b85247898639e" } +source = { git = "https://github.com/stsewd/tree-sitter-comment", rev = "a37ca370310ac6f89b6e0ebf2b86b2219780494e" } [[language]] name = "wgsl" @@ -1288,7 +1288,7 @@ injection-regex = "llvm" [[grammar]] name = "llvm" -source = { git = "https://github.com/benwilliamgraham/tree-sitter-llvm", rev = "3b213925b9c4f42c1acfe2e10bfbb438d9c6834d" } +source = { git = "https://github.com/benwilliamgraham/tree-sitter-llvm", rev = "e9948edc41e9e5869af99dddb2b5ff5cc5581af6" } [[language]] name = "llvm-mir" @@ -1742,7 +1742,7 @@ injection-regex = "sql" [[grammar]] name = "sql" -source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "eeab7240a11098724e6f95bc57cc3ceaf5487d5f" } +source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "25be0b8f17e9189ad9e1b875869d025c5aec1286" } [[language]] name = "gdscript" @@ -2045,7 +2045,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "ungrammar" -source = { git = "https://github.com/Philipp-M/tree-sitter-ungrammar", rev = "0113de880a58ea14f2a75802e9b99fcc25003d9c" } +source = { git = "https://github.com/Philipp-M/tree-sitter-ungrammar", rev = "a7e104629cff5a8b7367187610631e8f5eb7c6ea" } [[language]] name = "dot" @@ -2171,7 +2171,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "astro" -source = { git = "https://github.com/virchau13/tree-sitter-astro", rev = "5f5c3e73c45967df9aa42f861fad2d77cd4e0900" } +source = { git = "https://github.com/virchau13/tree-sitter-astro", rev = "947e93089e60c66e681eba22283f4037841451e7" } [[language]] name = "bass" @@ -2541,7 +2541,7 @@ comment-token = "(" [[grammar]] name = "uxntal" -source = { git = "https://github.com/Jummit/tree-sitter-uxntal", rev = "9297e95ef74380b0ad84c4fd98f91e9f6e4319e6" } +source = { git = "https://github.com/Jummit/tree-sitter-uxntal", rev = "d68406066648cd6db4c6a2f11ec305af02079884" } [[language]] name = "yuck" @@ -2662,7 +2662,7 @@ grammar = "rego" [[grammar]] name = "rego" -source = { git = "https://github.com/FallenAngel97/tree-sitter-rego", rev = "b2667c975f07b33be3ceb83bea5cfbad88095866" } +source = { git = "https://github.com/FallenAngel97/tree-sitter-rego", rev = "9ac75e71b2d791e0aadeef68098319d86a2a14cf" } [[language]] name = "nim" @@ -2764,7 +2764,7 @@ indent = { tab-width = 3, unit = " " } [[grammar]] name = "forth" -source = { git = "https://github.com/alexanderbrevig/tree-sitter-forth", rev = "304ed77beb113e37af38b20ff14e3c37bf350d10" } +source = { git = "https://github.com/alexanderbrevig/tree-sitter-forth", rev = "90189238385cf636b9ee99ce548b9e5b5e569d48" } [[language]] name = "fsharp" diff --git a/runtime/queries/purescript/highlights.scm b/runtime/queries/purescript/highlights.scm index b110f3e01..b7868e6e7 100644 --- a/runtime/queries/purescript/highlights.scm +++ b/runtime/queries/purescript/highlights.scm @@ -1,3 +1,19 @@ +; ---------------------------------------------------------------------------- +; Record fields would need to come before literal strings in order to be captured correctly + + (record_accessor + field: [ (variable) + (string) + (triple_quote_string) + ] @variable.other.member) + + (exp_record_access + field: [ (variable) + (string) + (triple_quote_string) + ] @variable.other.member) + + ; ---------------------------------------------------------------------------- ; Literals and comments @@ -117,8 +133,7 @@ (row_field (field_name) @variable.other.member) (record_field (field_name) @variable.other.member) - (record_accessor (variable) @variable.other.member) - (exp_record_access (variable) @variable.other.member) + (record_field (field_pun) @variable.other.member) (signature name: (variable) @type) (function name: (variable) @function) @@ -126,8 +141,8 @@ (derive_declaration (instance_name) @function) ; true or false -((variable) @constant.builtin.boolean - (#match? @constant.builtin.boolean "^(true|false)$")) + ((variable) @constant.builtin.boolean + (#match? @constant.builtin.boolean "^(true|false)$")) ; The former one works for `tree-sitter highlight` but not in Helix/Kakoune. ; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all diff --git a/runtime/queries/sql/highlights.scm b/runtime/queries/sql/highlights.scm index 1041cc2fc..09b07489e 100644 --- a/runtime/queries/sql/highlights.scm +++ b/runtime/queries/sql/highlights.scm @@ -131,6 +131,7 @@ (keyword_partition) (keyword_group) (keyword_with) + (keyword_without) (keyword_as) (keyword_having) (keyword_limit) @@ -227,6 +228,7 @@ (keyword_input) (keyword_name) (keyword_oid) + (keyword_oids) (keyword_options) (keyword_plpgsql) (keyword_precision) @@ -264,6 +266,44 @@ (keyword_user) (keyword_valid) (keyword_action) + (keyword_definer) + (keyword_invoker) + (keyword_security) + (keyword_extension) + (keyword_version) + (keyword_out) + (keyword_inout) + (keyword_variadic) + (keyword_session) + (keyword_isolation) + (keyword_level) + (keyword_serializable) + (keyword_repeatable) + (keyword_read) + (keyword_write) + (keyword_committed) + (keyword_uncommitted) + (keyword_deferrable) + (keyword_names) + (keyword_zone) + (keyword_immediate) + (keyword_deferred) + (keyword_constraints) + (keyword_snapshot) + (keyword_characteristics) + (keyword_off) + (keyword_follows) + (keyword_precedes) + (keyword_each) + (keyword_instead) + (keyword_of) + (keyword_initially) + (keyword_old) + (keyword_new) + (keyword_referencing) + (keyword_statement) + (keyword_execute) + (keyword_procedure) ] @keyword [ @@ -373,10 +413,8 @@ ">=" ">" "<>" - "->" - "->>" - "#>" - "#>>" + (op_other) + (op_unary_other) ] @operator [ From 2acf5e365e3a24ef244665435824ccb1abbef80a Mon Sep 17 00:00:00 2001 From: Niklas Alexander Shern <90867839+nshern@users.noreply.github.com> Date: Sat, 18 Nov 2023 02:44:01 +0100 Subject: [PATCH 031/480] theme: show active selection and buffer for naysayer theme (#8838) --- runtime/themes/naysayer.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/themes/naysayer.toml b/runtime/themes/naysayer.toml index 8922b3e22..41530d141 100644 --- a/runtime/themes/naysayer.toml +++ b/runtime/themes/naysayer.toml @@ -20,13 +20,13 @@ "ui.help" = { fg = "text", bg = "bg" } "ui.popup" = { fg = "text", bg = "bg" } "ui.menu" = { fg = "text", bg = "bg" } -"ui.menu.selected" = { fg = "text", bg = "bg" } +"ui.menu.selected" = { fg = "text", bg = "bg", modifiers = ['underlined'] } "ui.window" = { bg = "bg" } "diagnostic.error" = { bg = "error", fg = "text", modifiers = ["bold"] } "diagnostic.warning" = { bg = "warning", fg = "text", modifiers = ["bold"] } "diagnostic.hint" = { bg = "cyan", modifiers = ["bold"] } "ui.bufferline" = { fg = "text", bg = "bg" } -"ui.bufferline.active" = { fg = "text", bg = "bg" } +"ui.bufferline.active" = { fg = "text", bg = "bg", modifiers = ['underlined'] } "ui.gutter.selected" = { bg = "highlight-line", modifiers = ["bold"] } "ui.highlight" = { bg = "highlight-line" } From 34de1cab623c03b2ffdafb54714bc67cbabcf9e9 Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Wed, 1 Nov 2023 08:14:17 -0700 Subject: [PATCH 032/480] make indent/unindent exit select mode --- helix-term/src/commands.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 648aa96e8..7f9e9d018 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4207,6 +4207,7 @@ fn indent(cx: &mut Context) { }), ); doc.apply(&transaction, view.id); + exit_select_mode(cx); } fn unindent(cx: &mut Context) { @@ -4246,6 +4247,7 @@ fn unindent(cx: &mut Context) { let transaction = Transaction::change(doc.text(), changes.into_iter()); doc.apply(&transaction, view.id); + exit_select_mode(cx); } fn format_selections(cx: &mut Context) { From 1271a50a82b596fda0fe33a9cdec7b0c3fb92654 Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:12:21 -0800 Subject: [PATCH 033/480] make paste commands exit select mode --- helix-term/src/commands.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 7f9e9d018..4e73568b1 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4085,22 +4085,27 @@ pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) { }; let (view, doc) = current!(cx.editor); paste_impl(&[contents], doc, view, paste, count, cx.editor.mode); + exit_select_mode(cx); } fn paste_clipboard_after(cx: &mut Context) { paste(cx.editor, '+', Paste::After, cx.count()); + exit_select_mode(cx); } fn paste_clipboard_before(cx: &mut Context) { paste(cx.editor, '+', Paste::Before, cx.count()); + exit_select_mode(cx); } fn paste_primary_clipboard_after(cx: &mut Context) { paste(cx.editor, '*', Paste::After, cx.count()); + exit_select_mode(cx); } fn paste_primary_clipboard_before(cx: &mut Context) { paste(cx.editor, '*', Paste::Before, cx.count()); + exit_select_mode(cx); } fn replace_with_yanked(cx: &mut Context) { @@ -4160,6 +4165,7 @@ fn paste_after(cx: &mut Context) { Paste::After, cx.count(), ); + exit_select_mode(cx); } fn paste_before(cx: &mut Context) { @@ -4169,6 +4175,7 @@ fn paste_before(cx: &mut Context) { Paste::Before, cx.count(), ); + exit_select_mode(cx); } fn get_lines(doc: &Document, view_id: ViewId) -> Vec { From 5913073733b8724d97589ec9999252256708cf3c Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:14:39 -0800 Subject: [PATCH 034/480] make replace with clipboard commands exit select mode --- helix-term/src/commands.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 4e73568b1..d300f848d 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4144,10 +4144,12 @@ fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) { fn replace_selections_with_clipboard(cx: &mut Context) { replace_with_yanked_impl(cx.editor, '+', cx.count()); + exit_select_mode(cx); } fn replace_selections_with_primary_clipboard(cx: &mut Context) { replace_with_yanked_impl(cx.editor, '*', cx.count()); + exit_select_mode(cx); } fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) { From d4a0eba1a7de3961a321e5220376c61634ec8cc4 Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:18:58 -0800 Subject: [PATCH 035/480] make align exit select mode --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index d300f848d..e73fe2ed6 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -984,6 +984,7 @@ fn align_selections(cx: &mut Context) { let transaction = Transaction::change(doc.text(), changes.into_iter()); doc.apply(&transaction, view.id); + exit_select_mode(cx); } fn goto_window(cx: &mut Context, align: Align) { From 09c78e8b4e36cff0a4c00a0de3fc691dbf0e4873 Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:15:49 -0800 Subject: [PATCH 036/480] make switch case commands exit select mode --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index e73fe2ed6..a783fc683 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1528,6 +1528,7 @@ where }); doc.apply(&transaction, view.id); + exit_select_mode(cx); } fn switch_case(cx: &mut Context) { From 6bf5548dbdfd1df6abe6323bd46b6e051168d94e Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sun, 5 Nov 2023 08:07:22 -0800 Subject: [PATCH 037/480] make increment/decrement exit select mode --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index a783fc683..f1d1df063 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -5684,6 +5684,7 @@ fn increment_impl(cx: &mut Context, increment_direction: IncrementDirection) { let transaction = Transaction::change(doc.text(), changes.into_iter()); let transaction = transaction.with_selection(new_selection); doc.apply(&transaction, view.id); + exit_select_mode(cx); } } From b306b25e82a33b4704846ab4fce9b10b2ee7f67c Mon Sep 17 00:00:00 2001 From: Dan Field Date: Sat, 18 Nov 2023 00:11:18 -0800 Subject: [PATCH 038/480] GN language support (#6969) Co-authored-by: Michael Davis --- book/src/generated/lang-support.md | 1 + languages.toml | 14 ++++++++++ runtime/queries/gn/highlights.scm | 42 ++++++++++++++++++++++++++++++ runtime/queries/gn/injections.scm | 15 +++++++++++ runtime/queries/gn/locals.scm | 16 ++++++++++++ 5 files changed, 88 insertions(+) create mode 100644 runtime/queries/gn/highlights.scm create mode 100644 runtime/queries/gn/injections.scm create mode 100644 runtime/queries/gn/locals.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 9c55b4a05..a7d45a461 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -54,6 +54,7 @@ | git-rebase | ✓ | | | | | gleam | ✓ | ✓ | | `gleam` | | glsl | ✓ | ✓ | ✓ | | +| gn | ✓ | | | | | go | ✓ | ✓ | ✓ | `gopls`, `golangci-lint-langserver` | | godot-resource | ✓ | | | | | gomod | ✓ | | | `gopls` | diff --git a/languages.toml b/languages.toml index 3456209ae..3dedf6715 100644 --- a/languages.toml +++ b/languages.toml @@ -2740,6 +2740,20 @@ indent = { tab-width = 4, unit = "\t" } name = "just" source = { git = "https://github.com/IndianBoy42/tree-sitter-just", rev = "8af0aab79854aaf25b620a52c39485849922f766" } +[[language]] +name = "gn" +scope = "source.gn" +injection-regex = "gn" +file-types = ["gn", "gni"] +roots = [] +comment-token = "#" +indent = { tab-width = 2, unit = " " } +formatter = { command = "gn", args = ["format", "--stdin"] } + +[[grammar]] +name = "gn" +source = { git = "https://github.com/willcassella/tree-sitter-gn", rev = "e18d6e36a79b20dafb58f19d407bd38b0e60260e" } + [[language]] name = "blueprint" scope = "source.blueprint" diff --git a/runtime/queries/gn/highlights.scm b/runtime/queries/gn/highlights.scm new file mode 100644 index 000000000..ff619db11 --- /dev/null +++ b/runtime/queries/gn/highlights.scm @@ -0,0 +1,42 @@ +; Copyright (C) 2021 Will Cassella (github@willcassella.com) +; +; Licensed under the Apache License, Version 2.0 (the "License"); +; you may not use this file except in compliance with the License. +; You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. + +(identifier) @variable.builtin + +(scope_access field: (_) @variable.other.member) + +(call target: (_) @function) + +[ "if" "else" ] @keyword.control.conditional + +[ + (assign_op) + (arithmetic_binary_op) + (comparison_binary_op) + (equivalence_binary_op) + (logical_and_binary_op) + (logical_or_binary_op) + (negation_unary_op) +] @operator + +[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket +[ "." "," ] @punctuation.delimiter + +(string) @string +(string_escape) @constant.character.escape +(string_expansion [ "$" "${" "}" ] @constant.character.escape) +[ (integer) (hex) ] @constant.numeric +(boolean) @constant.builtin.boolean + +(comment) @comment diff --git a/runtime/queries/gn/injections.scm b/runtime/queries/gn/injections.scm new file mode 100644 index 000000000..55864c293 --- /dev/null +++ b/runtime/queries/gn/injections.scm @@ -0,0 +1,15 @@ +; Copyright (C) 2021 Will Cassella (github@willcassella.com) +; +; Licensed under the Apache License, Version 2.0 (the "License"); +; you may not use this file except in compliance with the License. +; You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. + +((comment) @injection.content (#set! injection.language "comment")) diff --git a/runtime/queries/gn/locals.scm b/runtime/queries/gn/locals.scm new file mode 100644 index 000000000..e8bd995c3 --- /dev/null +++ b/runtime/queries/gn/locals.scm @@ -0,0 +1,16 @@ +; Copyright (C) 2021 Will Cassella (github@willcassella.com) +; +; Licensed under the Apache License, Version 2.0 (the "License"); +; you may not use this file except in compliance with the License. +; You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. + +(source_file) @local.scope +(assignment target: (identifier) @local.definition) From b16752306cf6799b30a5bd5cde743a8cf4c395f4 Mon Sep 17 00:00:00 2001 From: blinxen Date: Mon, 13 Nov 2023 22:10:09 +0100 Subject: [PATCH 039/480] [themes] Mention license files in README --- runtime/themes/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runtime/themes/README.md b/runtime/themes/README.md index 1c9c5ae9b..302ba34cf 100644 --- a/runtime/themes/README.md +++ b/runtime/themes/README.md @@ -6,4 +6,12 @@ If you submit a theme, please include a comment at the top with your name and em # Author : Name ``` +If you are submitting a theme that is already published somewhere, then please +add the corresponding license file for it under `licenses/` with the following +name `theme_name.license` and add a comment at the top of the theme file: + +```toml +# License: +``` + We have a preview page for themes on our [wiki](https://github.com/helix-editor/helix/wiki/Themes)! From a0e5bb8520b4461417e171e4b8146f02d04ffdc1 Mon Sep 17 00:00:00 2001 From: blinxen Date: Sun, 19 Nov 2023 14:08:05 +0100 Subject: [PATCH 040/480] [themes] Add missing license files for recently added themes --- runtime/themes/licenses/poimandres.LICENSE | 21 +++++++++++++++++++ runtime/themes/licenses/starlight.LICENSE | 24 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 runtime/themes/licenses/poimandres.LICENSE create mode 100644 runtime/themes/licenses/starlight.LICENSE diff --git a/runtime/themes/licenses/poimandres.LICENSE b/runtime/themes/licenses/poimandres.LICENSE new file mode 100644 index 000000000..bc8d1cf48 --- /dev/null +++ b/runtime/themes/licenses/poimandres.LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 drcmda + +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. diff --git a/runtime/themes/licenses/starlight.LICENSE b/runtime/themes/licenses/starlight.LICENSE new file mode 100644 index 000000000..fdddb29aa --- /dev/null +++ b/runtime/themes/licenses/starlight.LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +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 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. + +For more information, please refer to From bfd60a5b39c468055f03a3339ac60546cceefc48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Nov 2023 09:31:12 +0900 Subject: [PATCH 041/480] build(deps): bump rustix from 0.38.22 to 0.38.25 (#8874) 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 f7361d0ec..fda89964c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1829,9 +1829,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.22" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80109a168d9bc0c7f483083244543a6eb0dba02295d33ca268145e6190d6df0c" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", From 3052050ee0388207048318fed0909e63a2c865f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Tue, 21 Nov 2023 12:04:20 +0100 Subject: [PATCH 042/480] open urls with goto_file command (#5820) * feat(commands): open urls with goto_file command Add capability for `goto_file` command to open an URL under cursor. Fixes: https://github.com/helix-editor/helix/issues/1472 Superseds: https://github.com/helix-editor/helix/pull/4398 * open files inside helix * address code review * bump deps * fix based on code review comments --- Cargo.lock | 38 +++++++++++++++++++ helix-term/Cargo.toml | 4 ++ helix-term/src/commands.rs | 76 +++++++++++++++++++++++++++++++++++--- helix-view/Cargo.toml | 2 +- 4 files changed, 114 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fda89964c..544a13bb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1237,6 +1237,7 @@ dependencies = [ "log", "nucleo", "once_cell", + "open", "pulldown-cmark", "serde", "serde_json", @@ -1247,6 +1248,7 @@ dependencies = [ "tokio", "tokio-stream", "toml", + "url", "which", ] @@ -1410,6 +1412,25 @@ version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + [[package]] name = "itoa" version = "1.0.6" @@ -1610,6 +1631,17 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "open" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfabf1927dce4d6fdf563d63328a0a506101ced3ec780ca2135747336c98cef8" +dependencies = [ + "is-wsl", + "libc", + "pathdiff", +] + [[package]] name = "option-ext" version = "0.2.0" @@ -1639,6 +1671,12 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "percent-encoding" version = "2.3.0" diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index c6374de54..378f25f87 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -57,6 +57,10 @@ pulldown-cmark = { version = "0.9", default-features = false } # file type detection content_inspector = "0.2.4" +# opening URLs +open = "5.0.0" +url = "2.4.1" + # config toml = "0.7" diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index f1d1df063..bc54abaaf 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -60,8 +60,13 @@ use crate::{ use crate::job::{self, Jobs}; use futures_util::{stream::FuturesUnordered, TryStreamExt}; -use std::{collections::HashMap, fmt, future::Future}; -use std::{collections::HashSet, num::NonZeroUsize}; +use std::{ + collections::{HashMap, HashSet}, + fmt, + future::Future, + io::Read, + num::NonZeroUsize, +}; use std::{ borrow::Cow, @@ -70,6 +75,7 @@ use std::{ use once_cell::sync::Lazy; use serde::de::{self, Deserialize, Deserializer}; +use url::Url; use grep_regex::RegexMatcherBuilder; use grep_searcher::{sinks, BinaryDetection, SearcherBuilder}; @@ -331,7 +337,7 @@ impl MappableCommand { goto_implementation, "Goto implementation", goto_file_start, "Goto line number else file start", goto_file_end, "Goto file end", - goto_file, "Goto files in selection", + goto_file, "Goto files/URLs in selection", goto_file_hsplit, "Goto files in selection (hsplit)", goto_file_vsplit, "Goto files in selection (vsplit)", goto_reference, "Goto references", @@ -1190,10 +1196,53 @@ fn goto_file_impl(cx: &mut Context, action: Action) { .to_string(), ); } + for sel in paths { let p = sel.trim(); - if !p.is_empty() { - let path = &rel_path.join(p); + if p.is_empty() { + continue; + } + + if let Ok(url) = Url::parse(p) { + return open_url(cx, url, action); + } + + let path = &rel_path.join(p); + if path.is_dir() { + let picker = ui::file_picker(path.into(), &cx.editor.config()); + cx.push_layer(Box::new(overlaid(picker))); + } else if let Err(e) = cx.editor.open(path, action) { + cx.editor.set_error(format!("Open file failed: {:?}", e)); + } + } +} + +/// Opens the given url. If the URL points to a valid textual file it is open in helix. +// Otherwise, the file is open using external program. +fn open_url(cx: &mut Context, url: Url, action: Action) { + let doc = doc!(cx.editor); + let rel_path = doc + .relative_path() + .map(|path| path.parent().unwrap().to_path_buf()) + .unwrap_or_default(); + + if url.scheme() != "file" { + return open_external_url(cx, url); + } + + let content_type = std::fs::File::open(url.path()).and_then(|file| { + // Read up to 1kb to detect the content type + let mut read_buffer = Vec::new(); + let n = file.take(1024).read_to_end(&mut read_buffer)?; + Ok(content_inspector::inspect(&read_buffer[..n])) + }); + + // we attempt to open binary files - files that can't be open in helix - using external + // program as well, e.g. pdf files or images + match content_type { + Ok(content_inspector::ContentType::BINARY) => open_external_url(cx, url), + Ok(_) | Err(_) => { + let path = &rel_path.join(url.path()); if path.is_dir() { let picker = ui::file_picker(path.into(), &cx.editor.config()); cx.push_layer(Box::new(overlaid(picker))); @@ -1204,6 +1253,23 @@ fn goto_file_impl(cx: &mut Context, action: Action) { } } +/// Opens URL in external program. +fn open_external_url(cx: &mut Context, url: Url) { + let commands = open::commands(url.as_str()); + cx.jobs.callback(async { + for cmd in commands { + let mut command = tokio::process::Command::new(cmd.get_program()); + command.args(cmd.get_args()); + if command.output().await.is_ok() { + return Ok(job::Callback::Editor(Box::new(|_| {}))); + } + } + Ok(job::Callback::Editor(Box::new(move |editor| { + editor.set_error("Opening URL in external program failed") + }))) + }); +} + fn extend_word_impl(cx: &mut Context, extend_fn: F) where F: Fn(RopeSlice, Range, usize) -> Range, diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml index 6218e9e41..a5218b9ac 100644 --- a/helix-view/Cargo.toml +++ b/helix-view/Cargo.toml @@ -26,7 +26,7 @@ helix-vcs = { version = "0.6", path = "../helix-vcs" } # Conversion traits once_cell = "1.18" -url = "2" +url = "2.4.1" arc-swap = { version = "1.6.0" } From 47b6c4bc78d449e3586f28d26507bfc8fb8608e2 Mon Sep 17 00:00:00 2001 From: Bjorn Ove Hay Andersen Date: Tue, 21 Nov 2023 12:07:00 +0100 Subject: [PATCH 043/480] Resolve args.files before changing directory (#8676) * Resolve args.files before changing directory * Removed the open_cwd work-around now that the path is full * If -w is specified, use that as the working directory * Open the remaining files in the argument list, also when the first is a directory * Use an iterator access the files argument --- helix-term/src/application.rs | 23 +++++++++++++++-------- helix-term/src/args.rs | 1 - helix-term/src/main.rs | 12 +++++++----- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 43e1cdfc9..ed085749b 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -162,14 +162,19 @@ impl Application { // Unset path to prevent accidentally saving to the original tutor file. doc_mut!(editor).set_path(None); } else if !args.files.is_empty() { - if args.open_cwd { - // NOTE: The working directory is already set to args.files[0] in main() - editor.new_file(Action::VerticalSplit); - let picker = ui::file_picker(".".into(), &config.load().editor); + let mut files_it = args.files.into_iter().peekable(); + + // If the first file is a directory, skip it and open a picker + if let Some((first, _)) = files_it.next_if(|(p, _)| p.is_dir()) { + let picker = ui::file_picker(first, &config.load().editor); compositor.push(Box::new(overlaid(picker))); - } else { - let nr_of_files = args.files.len(); - for (i, (file, pos)) in args.files.into_iter().enumerate() { + } + + // If there are any more files specified, open them + if files_it.peek().is_some() { + let mut nr_of_files = 0; + for (file, pos) in files_it { + nr_of_files += 1; if file.is_dir() { return Err(anyhow::anyhow!( "expected a path to file, found a directory. (to open a directory pass it as first argument)" @@ -181,7 +186,7 @@ impl Application { // option. If neither of those two arguments are passed // in, just load the files normally. let action = match args.split { - _ if i == 0 => Action::VerticalSplit, + _ if nr_of_files == 1 => Action::VerticalSplit, Some(Layout::Vertical) => Action::VerticalSplit, Some(Layout::Horizontal) => Action::HorizontalSplit, None => Action::Load, @@ -208,6 +213,8 @@ impl Application { // does not affect views without pos since it is at the top let (view, doc) = current!(editor); align_view(doc, view, Align::Center); + } else { + editor.new_file(Action::VerticalSplit); } } else if stdin().is_tty() || cfg!(feature = "integration") { editor.new_file(Action::VerticalSplit); diff --git a/helix-term/src/args.rs b/helix-term/src/args.rs index 99ce39926..6a49889b6 100644 --- a/helix-term/src/args.rs +++ b/helix-term/src/args.rs @@ -17,7 +17,6 @@ pub struct Args { pub log_file: Option, pub config_file: Option, pub files: Vec<(PathBuf, Position)>, - pub open_cwd: bool, pub working_directory: Option, } diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index 6411a7c5f..a62c54a40 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -116,16 +116,18 @@ FLAGS: setup_logging(args.verbosity).context("failed to initialize logging")?; + // Before setting the working directory, resolve all the paths in args.files + for (path, _) in args.files.iter_mut() { + *path = helix_core::path::get_canonicalized_path(path); + } + // NOTE: Set the working directory early so the correct configuration is loaded. Be aware that // Application::new() depends on this logic so it must be updated if this changes. if let Some(path) = &args.working_directory { helix_loader::set_current_working_dir(path)?; - } - - // If the first file is a directory, it will be the working directory and a file picker will be opened - if let Some((path, _)) = args.files.first().filter(|p| p.0.is_dir()) { + } else if let Some((path, _)) = args.files.first().filter(|p| p.0.is_dir()) { + // If the first file is a directory, it will be the working directory unless -w was specified helix_loader::set_current_working_dir(path)?; - args.open_cwd = true; // Signal Application that we want to open the picker on "." } let config = match Config::load_default() { From 41b307b673a34183123585d63746cb756c1779ed Mon Sep 17 00:00:00 2001 From: chtenb Date: Wed, 22 Nov 2023 03:42:40 +0100 Subject: [PATCH 044/480] Fix precedence of ui.virtual.whitespace (#8750) --- helix-term/src/ui/document.rs | 84 +++++++++++++++++++++--------- helix-term/src/ui/editor.rs | 96 +++++++++++++++++++++-------------- helix-term/src/ui/picker.rs | 10 ++-- 3 files changed, 125 insertions(+), 65 deletions(-) diff --git a/helix-term/src/ui/document.rs b/helix-term/src/ui/document.rs index 80da1c542..af218a840 100644 --- a/helix-term/src/ui/document.rs +++ b/helix-term/src/ui/document.rs @@ -97,7 +97,8 @@ pub fn render_document( doc: &Document, offset: ViewPosition, doc_annotations: &TextAnnotations, - highlight_iter: impl Iterator, + syntax_highlight_iter: impl Iterator, + overlay_highlight_iter: impl Iterator, theme: &Theme, line_decoration: &mut [Box], translated_positions: &mut [TranslatedPosition], @@ -109,7 +110,8 @@ pub fn render_document( offset, &doc.text_format(viewport.width, Some(theme)), doc_annotations, - highlight_iter, + syntax_highlight_iter, + overlay_highlight_iter, theme, line_decoration, translated_positions, @@ -157,7 +159,8 @@ pub fn render_text<'t>( offset: ViewPosition, text_fmt: &TextFormat, text_annotations: &TextAnnotations, - highlight_iter: impl Iterator, + syntax_highlight_iter: impl Iterator, + overlay_highlight_iter: impl Iterator, theme: &Theme, line_decorations: &mut [Box], translated_positions: &mut [TranslatedPosition], @@ -178,10 +181,16 @@ pub fn render_text<'t>( let (mut formatter, mut first_visible_char_idx) = DocumentFormatter::new_at_prev_checkpoint(text, text_fmt, text_annotations, offset.anchor); - let mut styles = StyleIter { + let mut syntax_styles = StyleIter { text_style: renderer.text_style, active_highlights: Vec::with_capacity(64), - highlight_iter, + highlight_iter: syntax_highlight_iter, + theme, + }; + let mut overlay_styles = StyleIter { + text_style: renderer.text_style, + active_highlights: Vec::with_capacity(64), + highlight_iter: overlay_highlight_iter, theme, }; @@ -193,7 +202,10 @@ pub fn render_text<'t>( }; let mut is_in_indent_area = true; let mut last_line_indent_level = 0; - let mut style_span = styles + let mut syntax_style_span = syntax_styles + .next() + .unwrap_or_else(|| (Style::default(), usize::MAX)); + let mut overlay_style_span = overlay_styles .next() .unwrap_or_else(|| (Style::default(), usize::MAX)); @@ -221,9 +233,16 @@ pub fn render_text<'t>( // skip any graphemes on visual lines before the block start if pos.row < row_off { - if char_pos >= style_span.1 { - style_span = if let Some(style_span) = styles.next() { - style_span + if char_pos >= syntax_style_span.1 { + syntax_style_span = if let Some(syntax_style_span) = syntax_styles.next() { + syntax_style_span + } else { + break; + } + } + if char_pos >= overlay_style_span.1 { + overlay_style_span = if let Some(overlay_style_span) = overlay_styles.next() { + overlay_style_span } else { break; } @@ -260,8 +279,15 @@ pub fn render_text<'t>( } // acquire the correct grapheme style - if char_pos >= style_span.1 { - style_span = styles.next().unwrap_or((Style::default(), usize::MAX)); + if char_pos >= syntax_style_span.1 { + syntax_style_span = syntax_styles + .next() + .unwrap_or((Style::default(), usize::MAX)); + } + if char_pos >= overlay_style_span.1 { + overlay_style_span = overlay_styles + .next() + .unwrap_or((Style::default(), usize::MAX)); } char_pos += grapheme.doc_chars(); @@ -275,22 +301,25 @@ pub fn render_text<'t>( pos, ); - let grapheme_style = if let GraphemeSource::VirtualText { highlight } = grapheme.source { - let style = renderer.text_style; - if let Some(highlight) = highlight { - style.patch(theme.highlight(highlight.0)) + let (syntax_style, overlay_style) = + if let GraphemeSource::VirtualText { highlight } = grapheme.source { + let mut style = renderer.text_style; + if let Some(highlight) = highlight { + style = style.patch(theme.highlight(highlight.0)) + } + (style, Style::default()) } else { - style - } - } else { - style_span.0 - }; + (syntax_style_span.0, overlay_style_span.0) + }; - let virt = grapheme.is_virtual(); + let is_virtual = grapheme.is_virtual(); renderer.draw_grapheme( grapheme.grapheme, - grapheme_style, - virt, + GraphemeStyle { + syntax_style, + overlay_style, + }, + is_virtual, &mut last_line_indent_level, &mut is_in_indent_area, pos, @@ -322,6 +351,11 @@ pub struct TextRenderer<'a> { pub viewport: Rect, } +pub struct GraphemeStyle { + syntax_style: Style, + overlay_style: Style, +} + impl<'a> TextRenderer<'a> { pub fn new( surface: &'a mut Surface, @@ -395,7 +429,7 @@ impl<'a> TextRenderer<'a> { pub fn draw_grapheme( &mut self, grapheme: Grapheme, - mut style: Style, + grapheme_style: GraphemeStyle, is_virtual: bool, last_indent_level: &mut usize, is_in_indent_area: &mut bool, @@ -405,9 +439,11 @@ impl<'a> TextRenderer<'a> { let is_whitespace = grapheme.is_whitespace(); // TODO is it correct to apply the whitespace style to all unicode white spaces? + let mut style = grapheme_style.syntax_style; if is_whitespace { style = style.patch(self.whitespace_style); } + style = style.patch(grapheme_style.overlay_style); let width = grapheme.width(); let space = if is_virtual { " " } else { &self.space }; diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 31195a4e5..6b85d9a33 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -124,16 +124,20 @@ impl EditorView { line_decorations.push(Box::new(line_decoration)); } - let mut highlights = + let syntax_highlights = Self::doc_syntax_highlights(doc, view.offset.anchor, inner.height, theme); - let overlay_highlights = Self::overlay_syntax_highlights( + + let mut overlay_highlights = + Self::empty_highlight_iter(doc, view.offset.anchor, inner.height); + let overlay_syntax_highlights = Self::overlay_syntax_highlights( doc, view.offset.anchor, inner.height, &text_annotations, ); - if !overlay_highlights.is_empty() { - highlights = Box::new(syntax::merge(highlights, overlay_highlights)); + if !overlay_syntax_highlights.is_empty() { + overlay_highlights = + Box::new(syntax::merge(overlay_highlights, overlay_syntax_highlights)); } for diagnostic in Self::doc_diagnostics_highlights(doc, theme) { @@ -142,12 +146,12 @@ impl EditorView { if diagnostic.is_empty() { continue; } - highlights = Box::new(syntax::merge(highlights, diagnostic)); + overlay_highlights = Box::new(syntax::merge(overlay_highlights, diagnostic)); } - let highlights: Box> = if is_focused { + if is_focused { let highlights = syntax::merge( - highlights, + overlay_highlights, Self::doc_selection_highlights( editor.mode(), doc, @@ -158,13 +162,11 @@ impl EditorView { ); let focused_view_elements = Self::highlight_focused_view_elements(view, doc, theme); if focused_view_elements.is_empty() { - Box::new(highlights) + overlay_highlights = Box::new(highlights) } else { - Box::new(syntax::merge(highlights, focused_view_elements)) + overlay_highlights = Box::new(syntax::merge(highlights, focused_view_elements)) } - } else { - Box::new(highlights) - }; + } let gutter_overflow = view.gutter_offset(doc) == 0; if !gutter_overflow { @@ -197,7 +199,8 @@ impl EditorView { doc, view.offset, &text_annotations, - highlights, + syntax_highlights, + overlay_highlights, theme, &mut line_decorations, &mut translated_positions, @@ -257,27 +260,39 @@ impl EditorView { .for_each(|area| surface.set_style(area, ruler_theme)) } - pub fn overlay_syntax_highlights( + fn viewport_byte_range( + text: helix_core::RopeSlice, + row: usize, + height: u16, + ) -> std::ops::Range { + // Calculate viewport byte ranges: + // Saturating subs to make it inclusive zero indexing. + let last_line = text.len_lines().saturating_sub(1); + let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line); + let start = text.line_to_byte(row.min(last_line)); + let end = text.line_to_byte(last_visible_line + 1); + + start..end + } + + pub fn empty_highlight_iter( doc: &Document, anchor: usize, height: u16, - text_annotations: &TextAnnotations, - ) -> Vec<(usize, std::ops::Range)> { + ) -> Box> { let text = doc.text().slice(..); let row = text.char_to_line(anchor.min(text.len_chars())); - let range = { - // Calculate viewport byte ranges: - // Saturating subs to make it inclusive zero indexing. - let last_line = text.len_lines().saturating_sub(1); - let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line); - let start = text.line_to_byte(row.min(last_line)); - let end = text.line_to_byte(last_visible_line + 1); - - start..end - }; - - text_annotations.collect_overlay_highlights(range) + // Calculate viewport byte ranges: + // Saturating subs to make it inclusive zero indexing. + let range = Self::viewport_byte_range(text, row, height); + Box::new( + [HighlightEvent::Source { + start: text.byte_to_char(range.start), + end: text.byte_to_char(range.end), + }] + .into_iter(), + ) } /// Get syntax highlights for a document in a view represented by the first line @@ -292,16 +307,7 @@ impl EditorView { let text = doc.text().slice(..); let row = text.char_to_line(anchor.min(text.len_chars())); - let range = { - // Calculate viewport byte ranges: - // Saturating subs to make it inclusive zero indexing. - let last_line = text.len_lines().saturating_sub(1); - let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line); - let start = text.line_to_byte(row.min(last_line)); - let end = text.line_to_byte(last_visible_line + 1); - - start..end - }; + let range = Self::viewport_byte_range(text, row, height); match doc.syntax() { Some(syntax) => { @@ -334,6 +340,20 @@ impl EditorView { } } + pub fn overlay_syntax_highlights( + doc: &Document, + anchor: usize, + height: u16, + text_annotations: &TextAnnotations, + ) -> Vec<(usize, std::ops::Range)> { + let text = doc.text().slice(..); + let row = text.char_to_line(anchor.min(text.len_chars())); + + let range = Self::viewport_byte_range(text, row, height); + + text_annotations.collect_overlay_highlights(range) + } + /// Get highlight spans for document diagnostics pub fn doc_diagnostics_highlights( doc: &Document, diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 0214a3910..9ba453357 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -736,17 +736,20 @@ impl Picker { } } - let mut highlights = EditorView::doc_syntax_highlights( + let syntax_highlights = EditorView::doc_syntax_highlights( doc, offset.anchor, area.height, &cx.editor.theme, ); + + let mut overlay_highlights = + EditorView::empty_highlight_iter(doc, offset.anchor, area.height); for spans in EditorView::doc_diagnostics_highlights(doc, &cx.editor.theme) { if spans.is_empty() { continue; } - highlights = Box::new(helix_core::syntax::merge(highlights, spans)); + overlay_highlights = Box::new(helix_core::syntax::merge(overlay_highlights, spans)); } let mut decorations: Vec> = Vec::new(); @@ -777,7 +780,8 @@ impl Picker { offset, // TODO: compute text annotations asynchronously here (like inlay hints) &TextAnnotations::default(), - highlights, + syntax_highlights, + overlay_highlights, &cx.editor.theme, &mut decorations, &mut [], From 811d62d3b3699efb7b7ceb362f537979e5911871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Wed, 22 Nov 2023 16:00:28 +0900 Subject: [PATCH 045/480] Revert "Fix precedence of ui.virtual.whitespace (#8750)" This reverts commit 41b307b673a34183123585d63746cb756c1779ed. --- helix-term/src/ui/document.rs | 84 +++++++++--------------------- helix-term/src/ui/editor.rs | 96 ++++++++++++++--------------------- helix-term/src/ui/picker.rs | 10 ++-- 3 files changed, 65 insertions(+), 125 deletions(-) diff --git a/helix-term/src/ui/document.rs b/helix-term/src/ui/document.rs index af218a840..80da1c542 100644 --- a/helix-term/src/ui/document.rs +++ b/helix-term/src/ui/document.rs @@ -97,8 +97,7 @@ pub fn render_document( doc: &Document, offset: ViewPosition, doc_annotations: &TextAnnotations, - syntax_highlight_iter: impl Iterator, - overlay_highlight_iter: impl Iterator, + highlight_iter: impl Iterator, theme: &Theme, line_decoration: &mut [Box], translated_positions: &mut [TranslatedPosition], @@ -110,8 +109,7 @@ pub fn render_document( offset, &doc.text_format(viewport.width, Some(theme)), doc_annotations, - syntax_highlight_iter, - overlay_highlight_iter, + highlight_iter, theme, line_decoration, translated_positions, @@ -159,8 +157,7 @@ pub fn render_text<'t>( offset: ViewPosition, text_fmt: &TextFormat, text_annotations: &TextAnnotations, - syntax_highlight_iter: impl Iterator, - overlay_highlight_iter: impl Iterator, + highlight_iter: impl Iterator, theme: &Theme, line_decorations: &mut [Box], translated_positions: &mut [TranslatedPosition], @@ -181,16 +178,10 @@ pub fn render_text<'t>( let (mut formatter, mut first_visible_char_idx) = DocumentFormatter::new_at_prev_checkpoint(text, text_fmt, text_annotations, offset.anchor); - let mut syntax_styles = StyleIter { + let mut styles = StyleIter { text_style: renderer.text_style, active_highlights: Vec::with_capacity(64), - highlight_iter: syntax_highlight_iter, - theme, - }; - let mut overlay_styles = StyleIter { - text_style: renderer.text_style, - active_highlights: Vec::with_capacity(64), - highlight_iter: overlay_highlight_iter, + highlight_iter, theme, }; @@ -202,10 +193,7 @@ pub fn render_text<'t>( }; let mut is_in_indent_area = true; let mut last_line_indent_level = 0; - let mut syntax_style_span = syntax_styles - .next() - .unwrap_or_else(|| (Style::default(), usize::MAX)); - let mut overlay_style_span = overlay_styles + let mut style_span = styles .next() .unwrap_or_else(|| (Style::default(), usize::MAX)); @@ -233,16 +221,9 @@ pub fn render_text<'t>( // skip any graphemes on visual lines before the block start if pos.row < row_off { - if char_pos >= syntax_style_span.1 { - syntax_style_span = if let Some(syntax_style_span) = syntax_styles.next() { - syntax_style_span - } else { - break; - } - } - if char_pos >= overlay_style_span.1 { - overlay_style_span = if let Some(overlay_style_span) = overlay_styles.next() { - overlay_style_span + if char_pos >= style_span.1 { + style_span = if let Some(style_span) = styles.next() { + style_span } else { break; } @@ -279,15 +260,8 @@ pub fn render_text<'t>( } // acquire the correct grapheme style - if char_pos >= syntax_style_span.1 { - syntax_style_span = syntax_styles - .next() - .unwrap_or((Style::default(), usize::MAX)); - } - if char_pos >= overlay_style_span.1 { - overlay_style_span = overlay_styles - .next() - .unwrap_or((Style::default(), usize::MAX)); + if char_pos >= style_span.1 { + style_span = styles.next().unwrap_or((Style::default(), usize::MAX)); } char_pos += grapheme.doc_chars(); @@ -301,25 +275,22 @@ pub fn render_text<'t>( pos, ); - let (syntax_style, overlay_style) = - if let GraphemeSource::VirtualText { highlight } = grapheme.source { - let mut style = renderer.text_style; - if let Some(highlight) = highlight { - style = style.patch(theme.highlight(highlight.0)) - } - (style, Style::default()) + let grapheme_style = if let GraphemeSource::VirtualText { highlight } = grapheme.source { + let style = renderer.text_style; + if let Some(highlight) = highlight { + style.patch(theme.highlight(highlight.0)) } else { - (syntax_style_span.0, overlay_style_span.0) - }; + style + } + } else { + style_span.0 + }; - let is_virtual = grapheme.is_virtual(); + let virt = grapheme.is_virtual(); renderer.draw_grapheme( grapheme.grapheme, - GraphemeStyle { - syntax_style, - overlay_style, - }, - is_virtual, + grapheme_style, + virt, &mut last_line_indent_level, &mut is_in_indent_area, pos, @@ -351,11 +322,6 @@ pub struct TextRenderer<'a> { pub viewport: Rect, } -pub struct GraphemeStyle { - syntax_style: Style, - overlay_style: Style, -} - impl<'a> TextRenderer<'a> { pub fn new( surface: &'a mut Surface, @@ -429,7 +395,7 @@ impl<'a> TextRenderer<'a> { pub fn draw_grapheme( &mut self, grapheme: Grapheme, - grapheme_style: GraphemeStyle, + mut style: Style, is_virtual: bool, last_indent_level: &mut usize, is_in_indent_area: &mut bool, @@ -439,11 +405,9 @@ impl<'a> TextRenderer<'a> { let is_whitespace = grapheme.is_whitespace(); // TODO is it correct to apply the whitespace style to all unicode white spaces? - let mut style = grapheme_style.syntax_style; if is_whitespace { style = style.patch(self.whitespace_style); } - style = style.patch(grapheme_style.overlay_style); let width = grapheme.width(); let space = if is_virtual { " " } else { &self.space }; diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 6b85d9a33..31195a4e5 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -124,20 +124,16 @@ impl EditorView { line_decorations.push(Box::new(line_decoration)); } - let syntax_highlights = + let mut highlights = Self::doc_syntax_highlights(doc, view.offset.anchor, inner.height, theme); - - let mut overlay_highlights = - Self::empty_highlight_iter(doc, view.offset.anchor, inner.height); - let overlay_syntax_highlights = Self::overlay_syntax_highlights( + let overlay_highlights = Self::overlay_syntax_highlights( doc, view.offset.anchor, inner.height, &text_annotations, ); - if !overlay_syntax_highlights.is_empty() { - overlay_highlights = - Box::new(syntax::merge(overlay_highlights, overlay_syntax_highlights)); + if !overlay_highlights.is_empty() { + highlights = Box::new(syntax::merge(highlights, overlay_highlights)); } for diagnostic in Self::doc_diagnostics_highlights(doc, theme) { @@ -146,12 +142,12 @@ impl EditorView { if diagnostic.is_empty() { continue; } - overlay_highlights = Box::new(syntax::merge(overlay_highlights, diagnostic)); + highlights = Box::new(syntax::merge(highlights, diagnostic)); } - if is_focused { + let highlights: Box> = if is_focused { let highlights = syntax::merge( - overlay_highlights, + highlights, Self::doc_selection_highlights( editor.mode(), doc, @@ -162,11 +158,13 @@ impl EditorView { ); let focused_view_elements = Self::highlight_focused_view_elements(view, doc, theme); if focused_view_elements.is_empty() { - overlay_highlights = Box::new(highlights) + Box::new(highlights) } else { - overlay_highlights = Box::new(syntax::merge(highlights, focused_view_elements)) + Box::new(syntax::merge(highlights, focused_view_elements)) } - } + } else { + Box::new(highlights) + }; let gutter_overflow = view.gutter_offset(doc) == 0; if !gutter_overflow { @@ -199,8 +197,7 @@ impl EditorView { doc, view.offset, &text_annotations, - syntax_highlights, - overlay_highlights, + highlights, theme, &mut line_decorations, &mut translated_positions, @@ -260,39 +257,27 @@ impl EditorView { .for_each(|area| surface.set_style(area, ruler_theme)) } - fn viewport_byte_range( - text: helix_core::RopeSlice, - row: usize, - height: u16, - ) -> std::ops::Range { - // Calculate viewport byte ranges: - // Saturating subs to make it inclusive zero indexing. - let last_line = text.len_lines().saturating_sub(1); - let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line); - let start = text.line_to_byte(row.min(last_line)); - let end = text.line_to_byte(last_visible_line + 1); - - start..end - } - - pub fn empty_highlight_iter( + pub fn overlay_syntax_highlights( doc: &Document, anchor: usize, height: u16, - ) -> Box> { + text_annotations: &TextAnnotations, + ) -> Vec<(usize, std::ops::Range)> { let text = doc.text().slice(..); let row = text.char_to_line(anchor.min(text.len_chars())); - // Calculate viewport byte ranges: - // Saturating subs to make it inclusive zero indexing. - let range = Self::viewport_byte_range(text, row, height); - Box::new( - [HighlightEvent::Source { - start: text.byte_to_char(range.start), - end: text.byte_to_char(range.end), - }] - .into_iter(), - ) + let range = { + // Calculate viewport byte ranges: + // Saturating subs to make it inclusive zero indexing. + let last_line = text.len_lines().saturating_sub(1); + let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line); + let start = text.line_to_byte(row.min(last_line)); + let end = text.line_to_byte(last_visible_line + 1); + + start..end + }; + + text_annotations.collect_overlay_highlights(range) } /// Get syntax highlights for a document in a view represented by the first line @@ -307,7 +292,16 @@ impl EditorView { let text = doc.text().slice(..); let row = text.char_to_line(anchor.min(text.len_chars())); - let range = Self::viewport_byte_range(text, row, height); + let range = { + // Calculate viewport byte ranges: + // Saturating subs to make it inclusive zero indexing. + let last_line = text.len_lines().saturating_sub(1); + let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line); + let start = text.line_to_byte(row.min(last_line)); + let end = text.line_to_byte(last_visible_line + 1); + + start..end + }; match doc.syntax() { Some(syntax) => { @@ -340,20 +334,6 @@ impl EditorView { } } - pub fn overlay_syntax_highlights( - doc: &Document, - anchor: usize, - height: u16, - text_annotations: &TextAnnotations, - ) -> Vec<(usize, std::ops::Range)> { - let text = doc.text().slice(..); - let row = text.char_to_line(anchor.min(text.len_chars())); - - let range = Self::viewport_byte_range(text, row, height); - - text_annotations.collect_overlay_highlights(range) - } - /// Get highlight spans for document diagnostics pub fn doc_diagnostics_highlights( doc: &Document, diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 9ba453357..0214a3910 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -736,20 +736,17 @@ impl Picker { } } - let syntax_highlights = EditorView::doc_syntax_highlights( + let mut highlights = EditorView::doc_syntax_highlights( doc, offset.anchor, area.height, &cx.editor.theme, ); - - let mut overlay_highlights = - EditorView::empty_highlight_iter(doc, offset.anchor, area.height); for spans in EditorView::doc_diagnostics_highlights(doc, &cx.editor.theme) { if spans.is_empty() { continue; } - overlay_highlights = Box::new(helix_core::syntax::merge(overlay_highlights, spans)); + highlights = Box::new(helix_core::syntax::merge(highlights, spans)); } let mut decorations: Vec> = Vec::new(); @@ -780,8 +777,7 @@ impl Picker { offset, // TODO: compute text annotations asynchronously here (like inlay hints) &TextAnnotations::default(), - syntax_highlights, - overlay_highlights, + highlights, &cx.editor.theme, &mut decorations, &mut [], From db83eb0c506617b39798a0e5000063459f81ce6a Mon Sep 17 00:00:00 2001 From: chtenb Date: Wed, 22 Nov 2023 14:07:26 +0100 Subject: [PATCH 046/480] Document the bufferline scopes (#8880) * Document the bufferline scopes * Update book/src/themes.md Co-authored-by: Michael Davis --------- Co-authored-by: Michael Davis --- book/src/themes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/book/src/themes.md b/book/src/themes.md index a62c07fee..495b76856 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -296,6 +296,9 @@ These scopes are used for theming the editor interface: | `ui.statusline.insert` | Statusline mode during insert mode ([only if `editor.color-modes` is enabled][editor-section]) | | `ui.statusline.select` | Statusline mode during select mode ([only if `editor.color-modes` is enabled][editor-section]) | | `ui.statusline.separator` | Separator character in statusline | +| `ui.bufferline` | Style for the buffer line | +| `ui.bufferline.active` | Style for the active buffer in buffer line | +| `ui.bufferline.background` | Style for bufferline background | | `ui.popup` | Documentation popups (e.g. Space + k) | | `ui.popup.info` | Prompt for multiple key options | | `ui.window` | Borderlines separating splits | From f1b9c19fa91ea21b81cf912c24ef11bf267d7bc7 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Wed, 22 Nov 2023 18:24:34 +0100 Subject: [PATCH 047/480] add LSP for nushell (#8878) --- book/src/generated/lang-support.md | 2 +- languages.toml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index a7d45a461..f93624f61 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -105,7 +105,7 @@ | nickel | ✓ | | ✓ | `nls` | | nim | ✓ | ✓ | ✓ | `nimlangserver` | | nix | ✓ | | | `nil` | -| nu | ✓ | | | | +| nu | ✓ | | | `nu` | | nunjucks | ✓ | | | | | ocaml | ✓ | | ✓ | `ocamllsp` | | ocaml-interface | ✓ | | | `ocamllsp` | diff --git a/languages.toml b/languages.toml index 3dedf6715..afbf34557 100644 --- a/languages.toml +++ b/languages.toml @@ -47,6 +47,7 @@ mint = { command = "mint", args = ["ls"] } nil = { command = "nil" } nimlangserver = { command = "nimlangserver" } nls = { command = "nls" } +nu-lsp = { command = "nu", args = [ "--lsp" ] } ocamllsp = { command = "ocamllsp" } ols = { command = "ols", args = [] } omnisharp = { command = "OmniSharp", args = [ "--languageserver" ] } @@ -1783,6 +1784,7 @@ file-types = ["nu"] shebangs = ["nu"] comment-token = "#" indent = { tab-width = 2, unit = " " } +language-servers = [ "nu-lsp" ] [[grammar]] name = "nu" From ff095ebd9b47bd5b06f16baca8dea9202f8d3c68 Mon Sep 17 00:00:00 2001 From: ghashy <109857267+ghashy@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:27:25 +0300 Subject: [PATCH 048/480] DBML Language support (#8860) * DBML language support * DBML language support, highlights.scm added * DBML support * Update runtime/queries/dbml/highlights.scm Co-authored-by: Michael Davis * Update runtime/queries/dbml/highlights.scm Co-authored-by: Michael Davis * Update runtime/queries/dbml/highlights.scm Co-authored-by: Michael Davis * remove unnecessary block highlight * remove unnecessary line * remove index_block query --------- Co-authored-by: Michael Davis --- book/src/generated/lang-support.md | 1 + languages.toml | 12 ++++++++ runtime/queries/dbml/highlights.scm | 44 +++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 runtime/queries/dbml/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index f93624f61..c21ca2501 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -24,6 +24,7 @@ | cue | ✓ | | | `cuelsp` | | d | ✓ | ✓ | ✓ | `serve-d` | | dart | ✓ | | ✓ | `dart` | +| dbml | ✓ | | | | | devicetree | ✓ | | | | | dhall | ✓ | ✓ | | `dhall-lsp-server` | | diff | ✓ | | | | diff --git a/languages.toml b/languages.toml index afbf34557..ef4687af8 100644 --- a/languages.toml +++ b/languages.toml @@ -2930,3 +2930,15 @@ language-servers = [ "templ" ] [[grammar]] name = "templ" source = { git = "https://github.com/vrischmann/tree-sitter-templ", rev = "ea56ac0655243490a4929a988f4eaa91dfccc995" } + +[[language]] +name = "dbml" +scope = "source.dbml" +injection-regex = "dbml" +file-types = ["dbml"] +comment-token = ";" +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "dbml" +source = { git = "https://github.com/dynamotn/tree-sitter-dbml", rev = "2e2fa5640268c33c3d3f27f7e676f631a9c68fd9" } diff --git a/runtime/queries/dbml/highlights.scm b/runtime/queries/dbml/highlights.scm new file mode 100644 index 000000000..accc65b4c --- /dev/null +++ b/runtime/queries/dbml/highlights.scm @@ -0,0 +1,44 @@ + +; comments highlighting +(comment) @comment + +; keyword highlighting +(keyword_def) @keyword +(keyword_enum) @keyword +(keyword_ref) @keyword + +; identify blocks and definitions +(definition) @function + +; for identifiers +(identifier) @variable +(type) @keyword + +; Highlight special types for database/data types +("Project" ) @type +("Table" ) @type +("TableGroup" ) @type +("database_type" ) @variable + +; string and number constants +("'''") @constant.character.escape +(string) @string +(number) @constant.numeric + +; brackets +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +; brackets +[ + ":" + "." + "," +] @punctuation.delimiter + From 090ed97e0045bfad1e5bff8b96c61707b996b85a Mon Sep 17 00:00:00 2001 From: Alexis Mousset Date: Wed, 22 Nov 2023 19:04:10 +0100 Subject: [PATCH 049/480] Add modus operandi themes (#8728) --- runtime/themes/modus_operandi.toml | 194 ++++++++++++++++++ .../themes/modus_operandi_deuteranopia.toml | 46 +++++ runtime/themes/modus_operandi_tinted.toml | 45 ++++ runtime/themes/modus_operandi_tritanopia.toml | 73 +++++++ 4 files changed, 358 insertions(+) create mode 100644 runtime/themes/modus_operandi.toml create mode 100644 runtime/themes/modus_operandi_deuteranopia.toml create mode 100644 runtime/themes/modus_operandi_tinted.toml create mode 100644 runtime/themes/modus_operandi_tritanopia.toml diff --git a/runtime/themes/modus_operandi.toml b/runtime/themes/modus_operandi.toml new file mode 100644 index 000000000..2247bb3be --- /dev/null +++ b/runtime/themes/modus_operandi.toml @@ -0,0 +1,194 @@ +# Author: Alexis Mousset +# Adapted from https://protesilaos.com/emacs/modus-themes, by Protesilaos Stavrou +# Version 4.3.0 +# + +# Syntax highlighting +# ------------------- +"type" = "cyan-cooler" +"constructor" = "cyan-cooler" + +"constant" = "blue-cooler" +"constant.character.escape" = "magenta" + +"string" = "blue-warmer" +"string.regexp" = "magenta-faint" +"string.special" = "blue-faint" # used for colors in CSS + +"comment" = "fg-dim" + +"variable.parameter" = "cyan" +"variable.builtin" = "magenta-cooler" +"label" = "fg-dim" # used for language in markdown code blocks +"keyword" = "magenta-cooler" +"keyword.directive" = "red-cooler" +"function" = "magenta" +"function.macro" = "magenta-warmer" + +punctuation = "fg-dim" +"tag" = "magenta" +"attribute" = "cyan-cooler" +"namespace" = "blue-cooler" +"special" = "red-cooler" + +"markup.heading.marker" = "fg-dim" +"markup.heading.1" = { fg = "fg-main", modifiers = ["bold"] } +"markup.heading.2" = { fg = "yellow-faint", modifiers = ["bold"] } +"markup.heading.3" = { fg = "fg-alt", modifiers = ["bold"] } +"markup.heading.4" = { fg = "magenta", modifiers = ["bold"] } +"markup.heading.5" = { fg = "green-faint", modifiers = ["bold"] } +"markup.heading.6" = { fg = "red-faint", modifiers = ["bold"] } +"markup.list" = "fg-dim" +"markup.list.checked" = { fg = "yellow-warmer" } +"markup.list.unchecked" = { fg = "yellow-warmer" } +"markup.bold" = { modifiers = ["bold"] } +"markup.italic" = { modifiers = ["italic"] } +"markup.strikethrough" = { modifiers = ["crossed_out"] } +"markup.link.url" = { fg = "cyan" } +"markup.link.text" = { fg = "blue-warmer", modifiers = ["underlined"] } +"markup.raw.block" = { bg = "bg-dim" } +"markup.raw.inline" = { fg = "green-cooler" } + +"diff.plus" = { fg = "fg-added", bg = "bg-added" } +"diff.plus.gutter" = "green-intense" +"diff.minus" = { fg = "fg-removed", bg = "bg-removed" } +"diff.minus.gutter" = "red-intense" +"diff.delta" = { fg = "fg-changed", bg = "bg-changed" } +"diff.delta.gutter" = "yellow-intense" + +# User Interface +# -------------- + +"ui.background" = { bg = "bg-main" } + +"ui.linenr" = { fg = "fg-dim", bg = "bg-dim" } +"ui.linenr.selected" = { fg = "fg-main", bg = "bg-active" } + +"ui.statusline" = { fg = "fg-mode-line-active", bg = "bg-mode-line-active" } +"ui.statusline.inactive" = { fg = "fg-mode-line-inactive", bg = "bg-mode-line-inactive" } +"ui.statusline.normal" = { fg = "blue-warmer" } +"ui.statusline.insert" = { fg = "green-warmer" } +"ui.statusline.select" = { fg = "magenta-warmer" } + +"ui.popup" = { fg = "fg-main", bg = "bg-dim" } +"ui.window" = { fg = "fg-dim" } +"ui.help" = { fg = "fg-main", bg = "bg-dim" } +"ui.gutter" = { bg = "bg-dim" } +"ui.text" = "fg-main" +"ui.text.focus" = { fg = "fg-main", bg = "bg-completion", modifiers = ["bold"] } +"ui.text.inactive" = { fg = "fg-dim" } +"ui.virtual" = "bg-active" +"ui.virtual.ruler" = { bg = "bg-dim" } +"ui.virtual.inlay-hint" = { fg = "fg-dim", modifiers = ["italic"] } + +"ui.selection" = { fg = "fg-main", bg = "bg-inactive" } +"ui.selection.primary" = { fg = "fg-main", bg = "bg-active" } + +"ui.cursor" = { fg = "bg-main", bg = "fg-main" } +"ui.cursor.primary" = { fg = "bg-main", bg = "fg-dim" } +"ui.cursor.match" = { bg = "bg-paren-match" } +"ui.cursorline.primary" = { bg = "bg-hl-line" } + +"ui.highlight" = { bg = "bg-hl-line" } + +"ui.menu" = { fg = "fg-main", bg = "bg-dim" } +"ui.menu.selected" = { fg = "fg-main", bg = "bg-completion", modifiers = ["bold"] } +"ui.menu.scroll" = { fg = "fg-dim", bg = "bg-cyan-intense" } + +"diagnostic.error" = { underline = { color = "red-intense", style = "curl" } } +"diagnostic.warning" = { underline = { color = "yellow-intense", style = "curl" } } +"diagnostic.info" = { underline = { color = "cyan-intense", style = "curl" } } +"diagnostic.hint" = { underline = { color = "blue-intense", style = "curl" } } + +error = "red" +warning = "yellow-warmer" +info = "cyan-cooler" +hint = "blue-cooler" + +[palette] +# Basic values +bg-main = "#ffffff" +bg-dim = "#f2f2f2" +fg-main = "#000000" +fg-dim = "#595959" +fg-alt = "#193668" +bg-active = "#c4c4c4" +bg-inactive = "#e0e0e0" + +# Common accent foregrounds +red = "#a60000" +red-warmer = "#972500" +red-cooler = "#a0132f" +red-faint = "#7f0000" +red-intense = "#d00000" +green = "#006800" +green-warmer = "#316500" +green-cooler = "#00663f" +green-faint = "#2a5045" +green-intense = "#008900" +yellow = "#6f5500" +yellow-warmer = "#884900" +yellow-cooler = "#7a4f2f" +yellow-faint = "#624416" +yellow-intense = "#808000" +blue = "#0031a9" +blue-warmer = "#354fcf" +blue-cooler = "#0000b0" +blue-faint = "#003497" +blue-intense = "#0000ff" +magenta = "#721045" +magenta-warmer = "#8f0075" +magenta-cooler = "#531ab6" +magenta-faint = "#7c318f" +magenta-intense = "#dd22dd" +cyan = "#005e8b" +cyan-warmer = "#3f578f" +cyan-cooler = "#005f5f" +cyan-faint = "#005077" +cyan-intense = "#008899" + +# Common accent backgrounds +bg-red-intense = "#ff8f88" +bg-green-intense = "#8adf80" +bg-yellow-intense = "#f3d000" +bg-blue-intense = "#bfc9ff" +bg-magenta-intense = "#dfa0f0" +bg-cyan-intense = "#a4d5f9" + +bg-red-subtle = "#ffcfbf" +bg-green-subtle = "#b3fabf" +bg-yellow-subtle = "#fff576" +bg-blue-subtle = "#ccdfff" +bg-magenta-subtle = "#ffddff" +bg-cyan-subtle = "#bfefff" + +bg-red-nuanced = "#fff1f0" +bg-green-nuanced = "#ecf7ed" +bg-yellow-nuanced = "#fff3da" +bg-blue-nuanced = "#f3f3ff" +bg-magenta-nuanced = "#fdf0ff" +bg-cyan-nuanced = "#ebf6fa" + +# Special purpose +bg-completion = "#c0deff" +bg-hl-line = "#dae5ec" + +bg-mode-line-active = "#c8c8c8" +fg-mode-line-active = "#000000" +bg-mode-line-inactive = "#e6e6e6" +fg-mode-line-inactive = "#585858" + +modeline-err = "#7f0000" +modeline-warning = "#5f0070" +modeline-info = "#002580" + +# Diffs +bg-added = "#c1f2d1" +fg-added = "#005000" +bg-changed = "#ffdfa9" +fg-changed = "#553d00" +bg-removed = "#ffd8d5" +fg-removed = "#8f1313" + +# Paren match +bg-paren-match = "#5fcfff" diff --git a/runtime/themes/modus_operandi_deuteranopia.toml b/runtime/themes/modus_operandi_deuteranopia.toml new file mode 100644 index 000000000..28601d37f --- /dev/null +++ b/runtime/themes/modus_operandi_deuteranopia.toml @@ -0,0 +1,46 @@ +# Author: Alexis Mousset +# modus_operandi.toml variant +# +# This variant is optimized for users with red-green color deficiency (deuteranopia) + +inherits = "modus_operandi" + +"constant.character.escape" = "magenta" +"comment" = "yellow-cooler" +"function" = "magenta" +"tag" = "magenta" + +"ui.cursor" = { fg = "bg-main", bg = "blue-intense" } +"ui.cursor.primary.normal" = { fg = "bg-main", bg = "blue-intense" } + +"diagnostic.error" = { underline = { color = "yellow-intense", style = "curl" } } +"diagnostic.warning" = { underline = { color = "magenta-faint", style = "curl" } } +"diagnostic.info" = { underline = { color = "cyan", style = "curl" } } +"diagnostic.hint" = { underline = { color = "blue", style = "curl" } } + +error = "yellow-intense" +warning = "magenta-faint" +info = "cyan" +hint = "blue" + +[palette] + +yellow = "#695500" +yellow-warmer = "#973300" +yellow-cooler = "#77492f" + +bg-mode-line-active = "#d0d6ff" +fg-mode-line-active = "#0f0f0f" +border-mode-line-active = "#4f4f74" + +modeline-err = "#603a00" +modeline-warning = "#454500" +modeline-info = "#023d92" + +# Diffs +bg-added = "#d5d7ff" +fg-added = "#303099" +bg-changed = "#eecfdf" +fg-changed = "#6f1343" +bg-removed = "#f4f099" +fg-removed = "#553d00" diff --git a/runtime/themes/modus_operandi_tinted.toml b/runtime/themes/modus_operandi_tinted.toml new file mode 100644 index 000000000..14faf0e5a --- /dev/null +++ b/runtime/themes/modus_operandi_tinted.toml @@ -0,0 +1,45 @@ +# Author: Alexis Mousset +# modus_operandi.toml variant + +inherits = "modus_operandi" + +"comment" = "red-faint" + +"ui.cursor.primary" = { fg = "bg-main", bg = "red" } + +[palette] +# Basic values +bg-main = "#fbf7f0" +bg-dim = "#efe9dd" +bg-active = "#c9b9b0" +bg-inactive = "#dfd5cf" +border = "#9f9690" + +# Common accent backgrounds +bg-red-nuanced = "#ffe8f0" +bg-green-nuanced = "#e0f5e0" +bg-yellow-nuanced = "#f9ead0" +bg-blue-nuanced = "#ebebff" +bg-magenta-nuanced = "#f6e7ff" +bg-cyan-nuanced = "#e1f3fc" + +# Special purpose +bg-completion = "#f0c1cf" +bg-hl-line = "#f1d5d0" +bg-region = "#c2bcb5" + +bg-mode-line-active = "#cab9b2" +border-mode-line-active = "#545454" +bg-mode-line-inactive = "#dfd9cf" +border-mode-line-inactive = "#a59a94" + +bg-tab-bar = "#e0d4ce" +bg-tab-current = "#fbf7f0" +bg-tab-other = "#c8b8b2" + +# Diffs +bg-added = "#c3ebc1" +bg-removed = "#f4d0cf" + +# Paren match +bg-paren-match = "#7fdfcf" diff --git a/runtime/themes/modus_operandi_tritanopia.toml b/runtime/themes/modus_operandi_tritanopia.toml new file mode 100644 index 000000000..8149f653e --- /dev/null +++ b/runtime/themes/modus_operandi_tritanopia.toml @@ -0,0 +1,73 @@ +# Author: Alexis Mousset +# modus_operandi.toml variant +# +# This variant is optimized for users with blue-yellow color deficiency (tritanopia) + +inherits = "modus_operandi" + +"type" = "blue-warmer" +"constructor" = "blue-warmer" +"constant" = "green-cooler" +"constant.character.escape" = "red-cooler" +"string" = "cyan" +"comment" = "red-faint" +"variable.parameter" = "cyan-cooler" +"keyword" = "red-cooler" +"keyword.directive" = "red-warmer" +"function" = "cyan-warmer" +"function.macro" = "magenta" +"tag" = "red-cooler" + +"markup.heading.2" = { fg = "red-faint", modifiers = ["bold"] } +"markup.heading.3" = { fg = "cyan-faint", modifiers = ["bold"] } +"markup.heading.6" = { fg = "magenta-faint", modifiers = ["bold"] } +"markup.link.url" = { fg = "cyan-cooler" } +"markup.link.text" = { fg = "cyan", modifiers = ["underlined"] } + +"ui.cursor" = { fg = "bg-main", bg = "red-intense" } +"ui.cursor.primary.normal" = { fg = "bg-main", bg = "red-intense" } + +"diagnostic.error" = { underline = { color = "red-warmer", style = "curl" } } +"diagnostic.warning" = { underline = { color = "magenta", style = "curl" } } +"diagnostic.info" = { underline = { color = "cyan", style = "curl" } } +"diagnostic.hint" = { underline = { color = "blue", style = "curl" } } + +error = "red-warmer" +warning = "magenta" +info = "cyan" +hint = "blue" + +[palette] + +# Common accent foregrounds +red-warmer = "#b21100" +red-faint = "#702000" +yellow = "#695500" +yellow-warmer = "#973300" +yellow-cooler = "#77492f" +magenta-intense = "#cd22bd" +cyan-faint = "#004f5f" + +# Special purpose +bg-completion = "#afdfef" +bg-hover = "#ffafbc" +bg-hover-secondary = "#9fdfff" +bg-hl-line = "#dfeaec" + +bg-char-0 = "#ff908f" +bg-char-1 = "#bfbfff" +bg-char-2 = "#5fcfdf" + +bg-mode-line-active = "#afe0f2" +fg-mode-line-active = "#0f0f0f" +border-mode-line-active = "#2f4f44" + +modeline-err = "#8f0000" +modeline-warning = "#6f306f" +modeline-info = "#00445f" + +# Diffs +bg-added = "#b5e7ff" +fg-added = "#005079" +bg-changed = "#eecfdf" +fg-changed = "#6f1343" From 8b0ae3d27912799d59e4948ff11d3a5428e32ce4 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Sat, 25 Nov 2023 04:55:49 -0800 Subject: [PATCH 050/480] bump MSRV to 1.70.0 (#8877) * rust-toolchain.toml: bump MSRV to 1.70.0 With Firefox 120 released on 21 November 2023, the MSRV is now 1.70.0. * Fix cargo fmt with Rust 1.70.0 * Fix cargo clippy with Rust 1.70.0 * Fix cargo doc with Rust 1.70.0 * rust-toolchain.toml: add clippy component * .github: bump dtolnay/rust-toolchain to 1.70 * helix-term: bump rust-version to 1.70 * helix-view/gutter: use checked_ilog10 to count digits * helix-core/syntax: use MAIN_SEPARATOR_STR constant * helix-view/handlers/dap: use Display impl for displaying process spawn error * WIP: helix-term/commands: use checked math to assert ranges cannot overlap --- .github/workflows/build.yml | 6 +++--- helix-core/src/syntax.rs | 5 +---- helix-term/Cargo.toml | 2 +- helix-term/src/commands.rs | 16 +++++++++++----- helix-term/src/commands/lsp.rs | 2 +- helix-tui/src/buffer.rs | 4 ++-- helix-view/src/editor.rs | 11 +++-------- helix-view/src/gutter.rs | 3 +-- helix-view/src/handlers/dap.rs | 4 +--- rust-toolchain.toml | 4 ++-- 10 files changed, 26 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e8c55fa4a..22151c378 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: uses: actions/checkout@v4 - name: Install stable toolchain - uses: dtolnay/rust-toolchain@1.65 + uses: dtolnay/rust-toolchain@1.70 - uses: Swatinem/rust-cache@v2 with: @@ -70,7 +70,7 @@ jobs: uses: actions/checkout@v4 - name: Install stable toolchain - uses: dtolnay/rust-toolchain@1.65 + uses: dtolnay/rust-toolchain@1.70 with: components: rustfmt, clippy @@ -97,7 +97,7 @@ jobs: uses: actions/checkout@v4 - name: Install stable toolchain - uses: dtolnay/rust-toolchain@1.65 + uses: dtolnay/rust-toolchain@1.70 - uses: Swatinem/rust-cache@v2 with: diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 36a1e5c97..8c7fc4e15 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -212,10 +212,7 @@ impl<'de> Deserialize<'de> for FileType { { match map.next_entry::()? { Some((key, suffix)) if key == "suffix" => Ok(FileType::Suffix({ - // FIXME: use `suffix.replace('/', std::path::MAIN_SEPARATOR_STR)` - // if MSRV is updated to 1.68 - let mut separator = [0; 1]; - suffix.replace('/', std::path::MAIN_SEPARATOR.encode_utf8(&mut separator)) + suffix.replace('/', std::path::MAIN_SEPARATOR_STR) })), Some((key, _value)) => Err(serde::de::Error::custom(format!( "unknown key in `file-types` list: {}", diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 378f25f87..672e6f847 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/helix-editor/helix" homepage = "https://helix-editor.com" include = ["src/**/*", "README.md"] default-run = "hx" -rust-version = "1.65" +rust-version = "1.70" [features] default = ["git"] diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index bc54abaaf..cd053266c 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1318,7 +1318,7 @@ fn extend_next_long_word_end(cx: &mut Context) { extend_word_impl(cx, movement::move_next_long_word_end) } -/// Separate branch to find_char designed only for char. +/// Separate branch to find_char designed only for `` char. // // This is necessary because the one document can have different line endings inside. And we // cannot predict what character to find when is pressed. On the current line it can be `lf` @@ -5606,12 +5606,18 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) { }; // These `usize`s cannot underflow because selection ranges cannot overlap. - // Once the MSRV is 1.66.0 (mixed_integer_ops is stabilized), we can use checked - // arithmetic to assert this. - let anchor = (to as isize + offset - deleted_len as isize) as usize; + let anchor = to + .checked_add_signed(offset) + .expect("Selection ranges cannot overlap") + .checked_sub(deleted_len) + .expect("Selection ranges cannot overlap"); let new_range = Range::new(anchor, anchor + output_len).with_direction(range.direction()); ranges.push(new_range); - offset = offset + output_len as isize - deleted_len as isize; + offset = offset + .checked_add_unsigned(output_len) + .expect("Selection ranges cannot overlap") + .checked_sub_unsigned(deleted_len) + .expect("Selection ranges cannot overlap"); changes.push((from, to, Some(output))); } diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 57be1267c..874004616 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -49,7 +49,7 @@ use std::{ /// If there is no configured language server that supports the feature, this displays a status message. /// Using this macro in a context where the editor automatically queries the LSP /// (instead of when the user explicitly does so via a keybind like `gd`) -/// will spam the "No configured language server supports " status message confusingly. +/// will spam the "No configured language server supports \" status message confusingly. #[macro_export] macro_rules! language_server_with_feature { ($editor:expr, $doc:expr, $feature:expr) => {{ diff --git a/helix-tui/src/buffer.rs b/helix-tui/src/buffer.rs index 93e9fcf9b..51a864f5f 100644 --- a/helix-tui/src/buffer.rs +++ b/helix-tui/src/buffer.rs @@ -213,7 +213,7 @@ impl Buffer { && y < self.area.bottom() } - /// Returns the index in the Vec for the given global (x, y) coordinates. + /// Returns the index in the `Vec` for the given global (x, y) coordinates. /// /// Global coordinates are offset by the Buffer's area offset (`x`/`y`). /// @@ -242,7 +242,7 @@ impl Buffer { ((y - self.area.y) as usize) * (self.area.width as usize) + ((x - self.area.x) as usize) } - /// Returns the index in the Vec for the given global (x, y) coordinates, + /// Returns the index in the `Vec` for the given global (x, y) coordinates, /// or `None` if the coordinates are outside the buffer's area. fn index_of_opt(&self, x: u16, y: u16) -> Option { if self.in_bounds(x, y) { diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 7af28ccc6..5a81cb5d6 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -727,7 +727,7 @@ pub struct WhitespaceCharacters { impl Default for WhitespaceCharacters { fn default() -> Self { Self { - space: '·', // U+00B7 + space: '·', // U+00B7 nbsp: '⍽', // U+237D tab: '→', // U+2192 newline: '⏎', // U+23CE @@ -755,12 +755,13 @@ impl Default for IndentGuidesConfig { } /// Line ending configuration. -#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum LineEndingConfig { /// The platform's native line ending. /// /// `crlf` on Windows, otherwise `lf`. + #[default] Native, /// Line feed. LF, @@ -777,12 +778,6 @@ pub enum LineEndingConfig { Nel, } -impl Default for LineEndingConfig { - fn default() -> Self { - LineEndingConfig::Native - } -} - impl From for LineEnding { fn from(line_ending: LineEndingConfig) -> Self { match line_ending { diff --git a/helix-view/src/gutter.rs b/helix-view/src/gutter.rs index 397dff4f4..ebdac9e23 100644 --- a/helix-view/src/gutter.rs +++ b/helix-view/src/gutter.rs @@ -9,8 +9,7 @@ use crate::{ }; fn count_digits(n: usize) -> usize { - // TODO: use checked_log10 when MSRV reaches 1.67 - std::iter::successors(Some(n), |&n| (n >= 10).then_some(n / 10)).count() + (usize::checked_ilog10(n).unwrap_or(0) + 1) as usize } pub type GutterFn<'doc> = Box Option