From 69b9db2fbbfa74342831094d6fc66be88ea3a9d9 Mon Sep 17 00:00:00 2001 From: Daniel Bowring Date: Fri, 2 May 2025 00:12:30 +1000 Subject: [PATCH 01/12] Add goto_column and extend_to_column commands (#13440) --- book/src/generated/static-cmd.md | 2 ++ book/src/keymap.md | 1 + helix-term/src/commands.rs | 24 ++++++++++++++++++++++++ helix-term/src/keymap/default.rs | 2 ++ 4 files changed, 29 insertions(+) diff --git a/book/src/generated/static-cmd.md b/book/src/generated/static-cmd.md index f6a82020f..92a1fb2a1 100644 --- a/book/src/generated/static-cmd.md +++ b/book/src/generated/static-cmd.md @@ -153,6 +153,8 @@ | `goto_last_change` | Goto last change | normal: `` ]G ``, select: `` ]G `` | | `goto_line_start` | Goto line start | normal: `` gh ``, `` ``, select: `` gh ``, insert: `` `` | | `goto_line_end` | Goto line end | normal: `` gl ``, `` ``, select: `` gl `` | +| `goto_column` | Goto column | normal: `` g\| `` | +| `extend_to_column` | Extend to column | select: `` g\| `` | | `goto_next_buffer` | Goto next buffer | normal: `` gn ``, select: `` gn `` | | `goto_previous_buffer` | Goto previous buffer | normal: `` gp ``, select: `` gp `` | | `goto_line_end_newline` | Goto newline at line end | insert: `` `` | diff --git a/book/src/keymap.md b/book/src/keymap.md index 2797eaee2..be7085351 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -213,6 +213,7 @@ Jumps to various locations. | Key | Description | Command | | ----- | ----------- | ------- | | `g` | Go to line number `` else start of file | `goto_file_start` | +| | | Go to column number `` else start of line | `goto_column` | | `e` | Go to the end of the file | `goto_last_line` | | `f` | Go to files in the selections | `goto_file` | | `h` | Go to the start of the line | `goto_line_start` | diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 2669d8dd0..86d586274 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -451,6 +451,8 @@ impl MappableCommand { goto_last_change, "Goto last change", goto_line_start, "Goto line start", goto_line_end, "Goto line end", + goto_column, "Goto column", + extend_to_column, "Extend to column", goto_next_buffer, "Goto next buffer", goto_previous_buffer, "Goto previous buffer", goto_line_end_newline, "Goto newline at line end", @@ -3829,6 +3831,28 @@ fn goto_last_line_impl(cx: &mut Context, movement: Movement) { doc.set_selection(view.id, selection); } +fn goto_column(cx: &mut Context) { + goto_column_impl(cx, Movement::Move); +} + +fn extend_to_column(cx: &mut Context) { + goto_column_impl(cx, Movement::Extend); +} + +fn goto_column_impl(cx: &mut Context, movement: Movement) { + let count = cx.count(); + let (view, doc) = current!(cx.editor); + let text = doc.text().slice(..); + let selection = doc.selection(view.id).clone().transform(|range| { + let line = range.cursor_line(text); + let line_start = text.line_to_char(line); + let line_end = line_end_char_index(&text, line); + let pos = graphemes::nth_next_grapheme_boundary(text, line_start, count - 1).min(line_end); + range.put_cursor(text, pos, movement == Movement::Extend) + }); + doc.set_selection(view.id, selection); +} + fn goto_last_accessed_file(cx: &mut Context) { let view = view_mut!(cx.editor); if let Some(alt) = view.docs_access_history.pop() { diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index b9189eb30..82baf336f 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -38,6 +38,7 @@ pub fn default() -> HashMap { "G" => goto_line, "g" => { "Goto" "g" => goto_file_start, + "|" => goto_column, "e" => goto_last_line, "f" => goto_file, "h" => goto_line_start, @@ -368,6 +369,7 @@ pub fn default() -> HashMap { "v" => normal_mode, "g" => { "Goto" "g" => extend_to_file_start, + "|" => extend_to_column, "e" => extend_to_last_line, "k" => extend_line_up, "j" => extend_line_down, From aa3fad84ef136b482eb5f84abbf109f25af9700a Mon Sep 17 00:00:00 2001 From: RoloEdits Date: Thu, 1 May 2025 13:54:45 -0700 Subject: [PATCH 02/12] build(grammar): remove explicit opt out of optimizations for MSVC (#13451) `cc` should pick correct defaults when `debug` or `release`. --- helix-loader/src/grammar.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index dcf440312..343cc9b95 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -451,7 +451,6 @@ fn build_tree_sitter_library( command .args(["/nologo", "/LD", "/I"]) .arg(header_path) - .arg("/Od") .arg("/utf-8") .arg("/std:c11"); if let Some(scanner_path) = scanner_path.as_ref() { @@ -469,7 +468,6 @@ fn build_tree_sitter_library( cpp_command .args(["/nologo", "/LD", "/I"]) .arg(header_path) - .arg("/Od") .arg("/utf-8") .arg("/std:c++14") .arg(format!("/Fo{}", object_file.display())) From 12139a4c30ad20d9a1b181de69532a57601cf96f Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 2 May 2025 09:45:21 -0400 Subject: [PATCH 03/12] queries: Fix `comment.unused` highlights in Erlang * Other languages use `comment.unused` instead of `comment.discard`. * Fix the precedence of discarded variables - previously the parameter highlight was higher precedence so discarded variables in the parameter list were highlighted as parameters instead of `comment.unused`. --- runtime/queries/erlang/highlights.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runtime/queries/erlang/highlights.scm b/runtime/queries/erlang/highlights.scm index 4bdeceaab..13b57e954 100644 --- a/runtime/queries/erlang/highlights.scm +++ b/runtime/queries/erlang/highlights.scm @@ -1,5 +1,5 @@ ; Comments -(tripledot) @comment.discard +(tripledot) @comment.unused [(comment) (line_comment) (shebang)] @comment @@ -114,10 +114,6 @@ ] @comment.block.documentation) (#any-of? @keyword "doc" "moduledoc")) -; Ignored variables -((variable) @comment.discard - (#match? @comment.discard "^_")) - ; Macros (macro "?"+ @keyword.directive @@ -163,3 +159,7 @@ (record field: (atom) @variable.other.member) (record name: (atom) @type) + +; Ignored variables +((variable) @comment.unused + (#match? @comment.unused "^_")) From ac3c6ebafffd6c0e7d55d1349bbec2eb9be7e2a0 Mon Sep 17 00:00:00 2001 From: RoloEdits Date: Sun, 4 May 2025 06:35:58 -0700 Subject: [PATCH 04/12] feat(commands): add `language` variable expansion (#13466) --- book/src/command-line.md | 1 + helix-view/src/expansion.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/book/src/command-line.md b/book/src/command-line.md index 7bf32bbda..b7177447c 100644 --- a/book/src/command-line.md +++ b/book/src/command-line.md @@ -47,6 +47,7 @@ The following variables are supported: | `cursor_column` | The column number of the primary cursor in the currently focused document, starting at 1. This is counted as the number of grapheme clusters from the start of the line rather than bytes or codepoints. | | `buffer_name` | The relative path of the currently focused document. `[scratch]` is expanded instead for scratch buffers. | | `line_ending` | A string containing the line ending of the currently focused document. For example on Unix systems this is usually a line-feed character (`\n`) but on Windows systems this may be a carriage-return plus a line-feed (`\r\n`). The line ending kind of the currently focused document can be inspected with the `:line-ending` command. | +| `language` | A string containing the language name of the currently focused document.| Aside from editor variables, the following expansions may be used: diff --git a/helix-view/src/expansion.rs b/helix-view/src/expansion.rs index 96a71b8e5..053152a4d 100644 --- a/helix-view/src/expansion.rs +++ b/helix-view/src/expansion.rs @@ -33,6 +33,8 @@ pub enum Variable { BufferName, /// A string containing the line-ending of the currently focused document. LineEnding, + // The name of current buffers language as set in `languages.toml` + Language, } impl Variable { @@ -41,6 +43,7 @@ impl Variable { Self::CursorColumn, Self::BufferName, Self::LineEnding, + Self::Language, ]; pub const fn as_str(&self) -> &'static str { @@ -49,6 +52,7 @@ impl Variable { Self::CursorColumn => "cursor_column", Self::BufferName => "buffer_name", Self::LineEnding => "line_ending", + Self::Language => "language", } } @@ -58,6 +62,7 @@ impl Variable { "cursor_column" => Some(Self::CursorColumn), "buffer_name" => Some(Self::BufferName), "line_ending" => Some(Self::LineEnding), + "language" => Some(Self::Language), _ => None, } } @@ -215,5 +220,9 @@ fn expand_variable(editor: &Editor, variable: Variable) -> Result Ok(Cow::Borrowed(doc.line_ending.as_str())), + Variable::Language => Ok(match doc.language_name() { + Some(lang) => Cow::Owned(lang.to_owned()), + None => Cow::Borrowed("text"), + }), } } From 4c630c148a1596b96c49e598135003967cab96cb Mon Sep 17 00:00:00 2001 From: RoloEdits Date: Sun, 4 May 2025 06:43:09 -0700 Subject: [PATCH 05/12] feat(commands): add `selection` variable expansion (#13467) --- book/src/command-line.md | 1 + helix-view/src/expansion.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/book/src/command-line.md b/book/src/command-line.md index b7177447c..2c0723fae 100644 --- a/book/src/command-line.md +++ b/book/src/command-line.md @@ -48,6 +48,7 @@ The following variables are supported: | `buffer_name` | The relative path of the currently focused document. `[scratch]` is expanded instead for scratch buffers. | | `line_ending` | A string containing the line ending of the currently focused document. For example on Unix systems this is usually a line-feed character (`\n`) but on Windows systems this may be a carriage-return plus a line-feed (`\r\n`). The line ending kind of the currently focused document can be inspected with the `:line-ending` command. | | `language` | A string containing the language name of the currently focused document.| +| `selection` | A string containing the contents of the primary selection of the currently focused document. | Aside from editor variables, the following expansions may be used: diff --git a/helix-view/src/expansion.rs b/helix-view/src/expansion.rs index 053152a4d..99baf4bfb 100644 --- a/helix-view/src/expansion.rs +++ b/helix-view/src/expansion.rs @@ -35,6 +35,8 @@ pub enum Variable { LineEnding, // The name of current buffers language as set in `languages.toml` Language, + // Primary selection + Selection, } impl Variable { @@ -44,6 +46,7 @@ impl Variable { Self::BufferName, Self::LineEnding, Self::Language, + Self::Selection, ]; pub const fn as_str(&self) -> &'static str { @@ -53,6 +56,7 @@ impl Variable { Self::BufferName => "buffer_name", Self::LineEnding => "line_ending", Self::Language => "language", + Self::Selection => "selection", } } @@ -63,6 +67,7 @@ impl Variable { "buffer_name" => Some(Self::BufferName), "line_ending" => Some(Self::LineEnding), "language" => Some(Self::Language), + "selection" => Some(Self::Selection), _ => None, } } @@ -224,5 +229,8 @@ fn expand_variable(editor: &Editor, variable: Variable) -> Result Cow::Owned(lang.to_owned()), None => Cow::Borrowed("text"), }), + Variable::Selection => Ok(Cow::Owned( + doc.selection(view.id).primary().fragment(text).to_string(), + )), } } From 72932a391b342d101951cf3f3280498413221c80 Mon Sep 17 00:00:00 2001 From: Spenser Black Date: Sun, 4 May 2025 09:52:28 -0400 Subject: [PATCH 06/12] Support `.git-blame-ignore-revs` (#13460) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 680d0dcd8..c44765ad9 100644 --- a/languages.toml +++ b/languages.toml @@ -1899,7 +1899,7 @@ source = { git = "https://github.com/mtoohey31/tree-sitter-gitattributes", rev = [[language]] name = "git-ignore" scope = "source.gitignore" -file-types = [{ glob = ".gitignore_global" }, { glob = "git/ignore" }, { glob = ".ignore" }, { glob = "CODEOWNERS" }, { glob = ".config/helix/ignore" }, { glob = ".helix/ignore" }, { glob = ".*ignore" }] +file-types = [{ glob = ".gitignore_global" }, { glob = "git/ignore" }, { glob = ".ignore" }, { glob = "CODEOWNERS" }, { glob = ".config/helix/ignore" }, { glob = ".helix/ignore" }, { glob = ".*ignore" }, { glob = ".git-blame-ignore-revs" }] injection-regex = "git-ignore" comment-token = "#" grammar = "gitignore" From ece12dd74d44da8bb8686ac7d65458de47dbc9b9 Mon Sep 17 00:00:00 2001 From: uncenter Date: Mon, 5 May 2025 09:20:57 -0400 Subject: [PATCH 07/12] docs(guides/textobject): list `parameter.around` capture (#13470) --- book/src/guides/textobject.md | 1 + 1 file changed, 1 insertion(+) diff --git a/book/src/guides/textobject.md b/book/src/guides/textobject.md index 2cf3d3bec..b0efb03bc 100644 --- a/book/src/guides/textobject.md +++ b/book/src/guides/textobject.md @@ -23,6 +23,7 @@ The following [captures][tree-sitter-captures] are recognized: | `test.inside` | | `test.around` | | `parameter.inside` | +| `parameter.around` | | `comment.inside` | | `comment.around` | | `entry.inside` | From 4784650ccf96fd68c2d8d84d9ae6c3d359fc1c50 Mon Sep 17 00:00:00 2001 From: Spenser Black Date: Mon, 5 May 2025 09:57:00 -0400 Subject: [PATCH 08/12] Add support for Pug language (#13435) --- book/src/generated/lang-support.md | 1 + languages.toml | 11 ++++ runtime/queries/pug/highlights.scm | 97 ++++++++++++++++++++++++++++++ runtime/queries/pug/injections.scm | 3 + 4 files changed, 112 insertions(+) create mode 100644 runtime/queries/pug/highlights.scm create mode 100644 runtime/queries/pug/injections.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index d66f7bef1..e69d1d840 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -180,6 +180,7 @@ | prolog | ✓ | | ✓ | `swipl` | | protobuf | ✓ | ✓ | ✓ | `buf`, `pb`, `protols` | | prql | ✓ | | | | +| pug | ✓ | | | | | purescript | ✓ | ✓ | | `purescript-language-server` | | python | ✓ | ✓ | ✓ | `ruff`, `jedi-language-server`, `pylsp` | | qml | ✓ | | ✓ | `qmlls` | diff --git a/languages.toml b/languages.toml index c44765ad9..b28a0c150 100644 --- a/languages.toml +++ b/languages.toml @@ -4313,3 +4313,14 @@ comment-tokens = "#" [[grammar]] name = "debian" source = { git = "https://gitlab.com/MggMuggins/tree-sitter-debian", rev = "9b3f4b78c45aab8a2f25a5f9e7bbc00995bc3dde" } + +[[language]] +name = "pug" +scope = "source.pug" +file-types = ["pug"] +comment-tokens = ["//", "//-"] +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "pug" +source = { git = "https://github.com/zealot128/tree-sitter-pug", rev = "13e9195370172c86a8b88184cc358b23b677cc46" } diff --git a/runtime/queries/pug/highlights.scm b/runtime/queries/pug/highlights.scm new file mode 100644 index 000000000..3e5c66fe0 --- /dev/null +++ b/runtime/queries/pug/highlights.scm @@ -0,0 +1,97 @@ +(comment) @comment + +( + doctype + (("doctype") @keyword.storage.type) + ((doctype_name) @type.enum.variant) +) + +(tag_name) @constant + +; Attributes +(id) @attribute +(class) @attribute +(attribute_name) @attribute + +(quoted_attribute_value) @string + +; Controls +( + conditional + ((keyword) @keyword.control.conditional) +) +( + case + ((keyword) @keyword.control) + ( + when + ((keyword) @keyword.control) + ) +) +( + each + ((keyword) @keyword.control.repeat) +) +( + else + ((keyword) @keyword.control.conditional) +) +( + while + ((keyword) @keyword.control.repeat) +) + +; Mixins +( + mixin_definition + ((keyword) @keyword.function) + ((mixin_name) @function.method) +) +( + mixin_use + (("+") @operator) + ((mixin_name) @function.method) +) + +; Includes +( + include + ((keyword) @keyword.directive) + ((filename) @string.special.path) +) + +; Inheritance +( + extends + ((keyword) @keyword.directive) + ((filename) @string.special.path) +) +( + block_definition + ((keyword) @keyword.directive) + ((block_name) @function.method) +) +( + block_append + ((keyword) @keyword.directive) + ((block_name) @function.method) +) +( + block_prepend + ((keyword) @keyword.directive) + ((block_name) @function.method) +) + +; Filters +( + filter + (":" @function.macro) + ((filter_name) @function.macro) + ((content) @special) +) + +; Inline JavaScript +( + unbuffered_code + (("-") @special) +) diff --git a/runtime/queries/pug/injections.scm b/runtime/queries/pug/injections.scm new file mode 100644 index 000000000..328787f57 --- /dev/null +++ b/runtime/queries/pug/injections.scm @@ -0,0 +1,3 @@ +((javascript) @injection.content + (#set! injection.language "javascript") +) From 46cb1777926fea28ff23bec0f34641bff54ec786 Mon Sep 17 00:00:00 2001 From: CalebLarsen <43345286+CalebLarsen@users.noreply.github.com> Date: Mon, 5 May 2025 09:03:40 -0500 Subject: [PATCH 09/12] feat: add basic Slang support (#13449) Co-authored-by: uncenter --- book/src/generated/lang-support.md | 1 + languages.toml | 15 ++ runtime/queries/slang/highlights.scm | 371 ++++++++++++++++++++++++++ runtime/queries/slang/indents.scm | 6 + runtime/queries/slang/injections.scm | 5 + runtime/queries/slang/textobjects.scm | 30 +++ 6 files changed, 428 insertions(+) create mode 100644 runtime/queries/slang/highlights.scm create mode 100644 runtime/queries/slang/indents.scm create mode 100644 runtime/queries/slang/injections.scm create mode 100644 runtime/queries/slang/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index e69d1d840..8502f5db1 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -201,6 +201,7 @@ | scala | ✓ | ✓ | ✓ | `metals` | | scheme | ✓ | | ✓ | | | scss | ✓ | | | `vscode-css-language-server` | +| slang | ✓ | ✓ | ✓ | `slangd` | | slint | ✓ | ✓ | ✓ | `slint-lsp` | | smali | ✓ | | ✓ | | | smithy | ✓ | | | `cs` | diff --git a/languages.toml b/languages.toml index b28a0c150..f4ddccef3 100644 --- a/languages.toml +++ b/languages.toml @@ -104,6 +104,7 @@ robotframework_ls = { command = "robotframework_ls" } ruff = { command = "ruff", args = ["server"] } ruby-lsp = { command = "ruby-lsp" } serve-d = { command = "serve-d" } +slangd = { command = "slangd" } slint-lsp = { command = "slint-lsp", args = [] } solargraph = { command = "solargraph", args = ["stdio"] } solc = { command = "solc", args = ["--lsp"] } @@ -2577,6 +2578,20 @@ formatter = { command = "cue", args = ["fmt", "-"] } name = "cue" source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "8a5f273bfa281c66354da562f2307c2d394b6c81" } +[[language]] +name = "slang" +scope = "source.lang" +injection-regex = "slang" +file-types = ["slang"] +comment-token = "//" +block-comment-tokens = { start = "/*", end = "*/" } +language-servers = [ "slangd" ] +indent = { tab-width = 4, unit = " " } + +[[grammar]] +name = "slang" +source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-slang", rev = "327b1b821c255867a4fb724c8eee48887e3d014b" } + [[language]] name = "slint" scope = "source.slint" diff --git a/runtime/queries/slang/highlights.scm b/runtime/queries/slang/highlights.scm new file mode 100644 index 000000000..030aea634 --- /dev/null +++ b/runtime/queries/slang/highlights.scm @@ -0,0 +1,371 @@ +; inherits: c + +; cpp +((identifier) @variable.other.member + (#match? @variable.other.member "^m_.*$")) + +(parameter_declaration + declarator: (reference_declarator) @variable.parameter) + +; function(Foo ...foo) +(variadic_parameter_declaration + declarator: (variadic_declarator + (_) @variable.parameter)) + +; int foo = 0 +(optional_parameter_declaration + declarator: (_) @variable.parameter) + +(field_declaration + (field_identifier) @variable.other.member) + +(field_initializer + (field_identifier) @variable.other.member) + +(function_declarator + declarator: (field_identifier) @function.method) + +(concept_definition + name: (identifier) @type) + +(alias_declaration + name: (type_identifier) @type) + +(namespace_identifier) @namespace + +((namespace_identifier) @type + (#match? @type "^[%u]")) + +(case_statement + value: (qualified_identifier + (identifier) @constant)) + +(using_declaration + . + "using" + . + "namespace" + . + [ + (qualified_identifier) + (identifier) + ] @namespace) + +(destructor_name + (identifier) @function.method) + +; functions +(function_declarator + (qualified_identifier + (identifier) @function)) + +(function_declarator + (qualified_identifier + (qualified_identifier + (identifier) @function))) + +(function_declarator + (qualified_identifier + (qualified_identifier + (qualified_identifier + (identifier) @function)))) + +(function_declarator + (template_function + (identifier) @function)) + +(operator_name) @function + +"operator" @function + +"static_assert" @function.builtin + + +(call_expression + (qualified_identifier + (identifier) @function)) + + +(call_expression + (qualified_identifier + (qualified_identifier + (identifier) @function))) + +(call_expression + (qualified_identifier + (qualified_identifier + (qualified_identifier + (identifier) @function)))) + +(call_expression + (template_function + (identifier) @function)) + +(call_expression + (qualified_identifier + (template_function + (identifier) @function))) + +(call_expression + (qualified_identifier + (qualified_identifier + (template_function + (identifier) @function)))) + +(call_expression + (qualified_identifier + (qualified_identifier + (qualified_identifier + (template_function + (identifier) @function))))) + +; methods +(function_declarator + (template_method + (field_identifier) @function.method)) + +(call_expression + (field_expression + (field_identifier) @function.method)) + +; constructors +((function_declarator + (qualified_identifier + (identifier) @constructor)) + (#match? @constructor "^%u")) + +((call_expression + function: (identifier) @constructor) + (#match? @constructor "^%u")) + +((call_expression + function: (qualified_identifier + name: (identifier) @constructor)) + (#match? @constructor "^%u")) + +((call_expression + function: (field_expression + field: (field_identifier) @constructor)) + (#match? @constructor "^%u")) + +; constructing a type in an initializer list: Constructor (): **SuperType (1)** +((field_initializer + (field_identifier) @constructor + (argument_list)) + (#match? @constructor "^%u")) + +; Constants +(this) @variable.builtin + +(null + "nullptr" @constant.builtin) + +(true) @constant.builtin.boolean + +(false) @constant.builtin.boolean + +; Literals +(raw_string_literal) @string + +; Keywords +[ + "try" + "catch" + "noexcept" + "throw" +] @keyword.control.exception + +[ + "decltype" + "explicit" + "friend" + "override" + "using" + "requires" + "constexpr" +] @keyword + +[ + "class" + "namespace" + "template" + "typename" + "concept" +] @keyword.storage.type + +[ + "co_await" + "co_yield" + "co_return" +] @keyword + +[ + "public" + "private" + "protected" + "final" + "virtual" +] @keyword.storage.modifier + +[ + "new" + "delete" + "xor" + "bitand" + "bitor" + "compl" + "not" + "xor_eq" + "and_eq" + "or_eq" + "not_eq" + "and" + "or" +] @keyword.operator + +"<=>" @operator + +"::" @punctuation.delimiter + +(template_argument_list + [ + "<" + ">" + ] @punctuation.bracket) + +(template_parameter_list + [ + "<" + ">" + ] @punctuation.bracket) + +(literal_suffix) @operator + +; hlsl +[ + "in" + "out" + "inout" + "uniform" + "shared" + "groupshared" + "discard" + "cbuffer" + "row_major" + "column_major" + "globallycoherent" + "centroid" + "noperspective" + "nointerpolation" + "sample" + "linear" + "snorm" + "unorm" + "point" + "line" + "triangleadj" + "lineadj" + "triangle" +] @keyword + +((identifier) @variable.builtin + (#match? @variable.builtin "^SV_")) +; ((identifier) @variable) + +(hlsl_attribute) @attribute + +(hlsl_attribute + [ + "[" + "]" + ] @attribute) + +"This" @type.builtin + +[ + "interface" + "extension" + "property" + "associatedtype" + "where" + "var" + "let" +] @keyword + +"__init" @constructor + +[ + "__subscript" + "get" + "set" +] @function.builtin + +(call_expression) @function + +(call_expression (identifier)) @function + +((call_expression + function: (identifier) @function.builtin) + (#any-of? @function.builtin + "frac" "abs" "acos" "acosh" "asin" "asinh" "atan" "atanh" "cos" "cosh" "exp" "exp2" "floor" "log" "log10" "log2" "round" "rsqrt" "sin" "sincos" "sinh" "sqrt" "tan" "tanh" "trunc" + "AllMemoryBarrier" "AllMemoryBarrierWithGroupSync" "DeviceMemoryBarrier" "DeviceMemoryBarrierWithGroupSync" "GroupMemoryBarrier" "GroupMemoryBarrierWithGroupSync" + "abort" "clip" "errorf" "printf" + "all" "any" "countbits" "faceforward" "firstbithigh" "firstbitlow" "isfinite" "isinf" "isnan" "max" "min" "noise" "pow" "reversebits" "sign" + "asdouble" "asfloat" "asint" "asuint" "D3DCOLORtoUBYTE4" "f16tof32" "f32tof16" + "ceil" "clamp" "degrees" "fma" "fmod" "frac" "frexp" "ldexp" "lerp" "mad" "modf" "radiants" "saturate" "smoothstep" "step" + "cross" "determinant" "distance" "dot" "dst" "length" "lit" "msad4" "mul" "normalize" "rcp" "reflect" "refract" "transpose" + "ddx" "ddx_coarse" "ddx_fine" "ddy" "ddy_coarse" "ddy_fine" "fwidth" + "EvaluateAttributeAtCentroid" "EvaluateAttributeAtSample" "EvaluateAttributeSnapped" + "GetRenderTargetSampleCount" "GetRenderTargetSamplePosition" + "InterlockedAdd" "InterlockedAnd" "InterlockedCompareExchange" "InterlockedCompareStore" "InterlockedExchange" "InterlockedMax" "InterlockedMin" "InterlockedOr" "InterlockedXor" + "InterlockedCompareStoreFloatBitwise" "InterlockedCompareExchangeFloatBitwise" + "Process2DQuadTessFactorsAvg" "Process2DQuadTessFactorsMax" "Process2DQuadTessFactorsMin" "ProcessIsolineTessFactors" + "ProcessQuadTessFactorsAvg" "ProcessQuadTessFactorsMax" "ProcessQuadTessFactorsMin" "ProcessTriTessFactorsAvg" "ProcessTriTessFactorsMax" "ProcessTriTessFactorsMin" + "tex1D" "tex1Dbias" "tex1Dgrad" "tex1Dlod" "tex1Dproj" + "tex2D" "tex2Dbias" "tex2Dgrad" "tex2Dlod" "tex2Dproj" + "tex3D" "tex3Dbias" "tex3Dgrad" "tex3Dlod" "tex3Dproj" + "texCUBE" "texCUBEbias" "texCUBEgrad" "texCUBElod" "texCUBEproj" + "WaveIsFirstLane" "WaveGetLaneCount" "WaveGetLaneIndex" + "IsHelperLane" + "WaveActiveAnyTrue" "WaveActiveAllTrue" "WaveActiveBallot" + "WaveReadLaneFirst" "WaveReadLaneAt" + "WaveActiveAllEqual" "WaveActiveAllEqualBool" "WaveActiveCountBits" + "WaveActiveSum" "WaveActiveProduct" "WaveActiveBitAnd" "WaveActiveBitOr" "WaveActiveBitXor" "WaveActiveMin" "WaveActiveMax" + "WavePrefixCountBits" "WavePrefixProduct" "WavePrefixSum" + "QuadReadAcrossX" "QuadReadAcrossY" "QuadReadAcrossDiagonal" "QuadReadLaneAt" + "QuadAny" "QuadAll" + "WaveMatch" "WaveMultiPrefixSum" "WaveMultiPrefixProduct" "WaveMultiPrefixCountBits" "WaveMultiPrefixAnd" "WaveMultiPrefixOr" "WaveMultiPrefixXor" + "NonUniformResourceIndex" + "DispatchMesh" "SetMeshOutputCounts" + "dot4add_u8packed" "dot4add_i8packed" "dot2add" + "RestartStrip" + "CalculateLevelOfDetail" "CalculateLevelOfDetailUnclamped" "Gather" "GetDimensions" "GetSamplePosition" "Load" "Sample" "SampleBias" "SampleCmp" "SampleCmpLevelZero" "SampleGrad" "SampleLevel" "GatherRaw" "SampleCmpLevel" + "SampleCmpBias" "SampleCmpGrad" + "WriteSamplerFeedback" "WriteSamplerFeedbackBias" "WriteSamplerFeedbackGrad" "WriteSamplerFeedbackLevel" + "Append" "Consume" "DecrementCounter" "IncrementCounter" + "Load2" "Load3" "Load4" "Store" "Store2" "Store3" "Store4" + "GatherRed" "GatherGreen" "GatherBlue" "GatherAlpha" "GatherCmp" "GatherCmpRed" "GatherCmpGreen" "GatherCmpBlue" "GatherCmpAlpha" + )) + +(interface_requirements + (identifier) @type) + +(binary_expression + [ + "is" + "as" + ] + right: (identifier) @type) + +[ + "as" + "is" +] @keyword.operator + +[ + "__exported" + "import" +] @keyword.control.import + +(property_declaration + (identifier) @variable.other.member) diff --git a/runtime/queries/slang/indents.scm b/runtime/queries/slang/indents.scm new file mode 100644 index 000000000..75ed7a936 --- /dev/null +++ b/runtime/queries/slang/indents.scm @@ -0,0 +1,6 @@ +; inherits: hlsl + +[ + (interface_specifier) + (extension_specifier) +] @indent diff --git a/runtime/queries/slang/injections.scm b/runtime/queries/slang/injections.scm new file mode 100644 index 000000000..2fd39cba0 --- /dev/null +++ b/runtime/queries/slang/injections.scm @@ -0,0 +1,5 @@ +((preproc_arg) @injection.content + (#set! injection.language "slang")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/slang/textobjects.scm b/runtime/queries/slang/textobjects.scm new file mode 100644 index 000000000..4658f46ca --- /dev/null +++ b/runtime/queries/slang/textobjects.scm @@ -0,0 +1,30 @@ +(function_definition + body: (_) @function.inside) @function.around + +(struct_specifier + body: (_) @class.inside) @class.around + +(interface_specifier + body: (_) @class.inside) @class.around + +(enum_specifier + body: (_) @class.inside) @class.around + +(union_specifier + body: (_) @class.inside) @class.around + +(parameter_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(argument_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(comment) @comment.inside + +(comment)+ @comment.around + +(enumerator + (_) @entry.inside) @entry.around + +(initializer_list + (_) @entry.around) From cbac4273836f5837cec641ab21f365c79b102a4b Mon Sep 17 00:00:00 2001 From: Rotem Horesh <148942120+rotmh@users.noreply.github.com> Date: Mon, 5 May 2025 17:08:33 +0300 Subject: [PATCH 10/12] feat: add a tree-sitter grammar and highlights for dunst's config (#13458) --- book/src/generated/lang-support.md | 1 + languages.toml | 10 ++++++++++ runtime/queries/dunstrc/highlights.scm | 14 ++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 runtime/queries/dunstrc/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 8502f5db1..5b2962a48 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -46,6 +46,7 @@ | dot | ✓ | | | `dot-language-server` | | dtd | ✓ | | | | | dune | ✓ | | | | +| dunstrc | ✓ | | | | | earthfile | ✓ | ✓ | ✓ | `earthlyls` | | edoc | ✓ | | | | | eex | ✓ | | | | diff --git a/languages.toml b/languages.toml index f4ddccef3..13f70db4a 100644 --- a/languages.toml +++ b/languages.toml @@ -4339,3 +4339,13 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "pug" source = { git = "https://github.com/zealot128/tree-sitter-pug", rev = "13e9195370172c86a8b88184cc358b23b677cc46" } + +[[language]] +name = "dunstrc" +scope = "source.dunstrc" +comment-tokens = ["#", ";"] +file-types = [ { glob = "dunst/dunstrc" } ] + +[[grammar]] +name = "dunstrc" +source = { git = "https://github.com/rotmh/tree-sitter-dunstrc", rev = "9cb9d5cc51cf5e2a47bb2a0e2f2e519ff11c1431" } diff --git a/runtime/queries/dunstrc/highlights.scm b/runtime/queries/dunstrc/highlights.scm new file mode 100644 index 000000000..8964b43de --- /dev/null +++ b/runtime/queries/dunstrc/highlights.scm @@ -0,0 +1,14 @@ +(assign + (key) @attribute) + +(comment) @comment.line + +[ + "[" + "]" +] @punctuation.bracket + +"=" @operator + +(section + (name) @namespace) From fb45017a260da87979e1566630ed37d5cebb4ff8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 08:16:18 -0500 Subject: [PATCH 11/12] build(deps): bump the rust-dependencies group with 3 updates (#13474) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ccf23cde0..4f617ade7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,9 +151,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] name = "cc" -version = "1.2.20" +version = "1.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04da6a0d40b948dfc4fa8f5bbf402b0fc1a64a28dbf7d12ffd683550f2c1b63a" +checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" dependencies = [ "shlex", ] @@ -177,9 +177,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", @@ -913,7 +913,7 @@ dependencies = [ "itoa", "libc", "memmap2", - "rustix 1.0.5", + "rustix 1.0.7", "smallvec", "thiserror 2.0.12", ] @@ -1530,7 +1530,7 @@ dependencies = [ "regex-automata", "regex-cursor", "ropey", - "rustix 1.0.5", + "rustix 1.0.7", "tempfile", "unicode-segmentation", "which", @@ -1637,7 +1637,7 @@ dependencies = [ "log", "once_cell", "parking_lot", - "rustix 1.0.5", + "rustix 1.0.7", "serde", "serde_json", "slotmap", @@ -2374,9 +2374,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags", "errno", @@ -2622,7 +2622,7 @@ dependencies = [ "fastrand", "getrandom 0.3.1", "once_cell", - "rustix 1.0.5", + "rustix 1.0.7", "windows-sys 0.59.0", ] @@ -2995,7 +2995,7 @@ checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" dependencies = [ "either", "env_home", - "rustix 1.0.5", + "rustix 1.0.7", "winsafe", ] From e53462c78ccf90180442f00468ea305a57c24fea Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Tue, 6 May 2025 15:24:14 +0200 Subject: [PATCH 12/12] verilog: separate highlighting of keyword operators (#13473) --- runtime/queries/verilog/highlights.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/runtime/queries/verilog/highlights.scm b/runtime/queries/verilog/highlights.scm index de65cab07..9cec88be1 100644 --- a/runtime/queries/verilog/highlights.scm +++ b/runtime/queries/verilog/highlights.scm @@ -106,6 +106,7 @@ "+" "/" "*" + "**" "^" "&" "|" @@ -118,8 +119,6 @@ "'{" "<=" "@" - "or" - "and" "==" "!=" "===" @@ -131,8 +130,15 @@ "%" ">>" "<<" + ">>>" + "<<<" "|=" (inc_or_dec_operator) + "?" +] @operator +[ + "or" + "and" ] @keyword.operator (cast