From 034c36f6357376294af1eafd98a4d3fa6efd9d71 Mon Sep 17 00:00:00 2001 From: Jonas Köhnen Date: Sun, 18 Jan 2026 17:56:12 +0000 Subject: [PATCH] Fix highlighting for new github-action language (#15137) --- book/src/generated/lang-support.md | 2 +- runtime/queries/github-action/highlights.scm | 1 + runtime/queries/github-action/indents.scm | 1 + runtime/queries/github-action/injections.scm | 32 ++++++++++++++++++++++++++++++++ runtime/queries/github-action/rainbows.scm | 1 + runtime/queries/github-action/textobjects.scm | 1 + runtime/queries/yaml/injections.scm | 32 -------------------------------- 7 file(s) changed, 37 insertion(s)(+), 33 deletion(s)(-) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -91,7 +91,7 @@ | git-ignore | ✓ | | | | | | | git-notes | ✓ | | | | | | | git-rebase | ✓ | | | | | | -| github-action | | | | | | `actions-languageserver`, `yaml-language-server` | +| github-action | ✓ | ✓ | ✓ | | ✓ | `actions-languageserver`, `yaml-language-server` | | gitlab-ci | ✓ | ✓ | ✓ | ✓ | ✓ | `yaml-language-server`, `gitlab-ci-ls` | | gjs | ✓ | ✓ | ✓ | ✓ | | `typescript-language-server`, `vscode-eslint-language-server`, `ember-language-server` | | gleam | ✓ | ✓ | | | ✓ | `gleam` | diff --git a/runtime/queries/github-action/highlights.scm b/runtime/queries/github-action/highlights.scm new file mode 100644 --- /dev/null +++ b/runtime/queries/github-action/highlights.scm @@ -0,0 +1,1 @@ +; inherits: yaml diff --git a/runtime/queries/github-action/indents.scm b/runtime/queries/github-action/indents.scm new file mode 100644 --- /dev/null +++ b/runtime/queries/github-action/indents.scm @@ -0,0 +1,1 @@ +; inherits: yaml diff --git a/runtime/queries/github-action/injections.scm b/runtime/queries/github-action/injections.scm new file mode 100644 --- /dev/null +++ b/runtime/queries/github-action/injections.scm @@ -0,0 +1,32 @@ +; inherits: yaml + +; JavaScript for workflow scripting (inline) +(block_mapping + (block_mapping_pair + key: (flow_node) @_uses (#eq? @_uses "uses") + value: (flow_node) @_actions_ghs (#match? @_actions_ghs "^actions/github-script")) + (block_mapping_pair + key: (flow_node) @_with (#eq? @_with "with") + value: (block_node + (block_mapping + (block_mapping_pair + key: (flow_node) @_run (#eq? @_run "script") + value: (flow_node + (plain_scalar + (string_scalar) @injection.content + (#set! injection.language "javascript")))))))) + +; JavaScript for workflow scripting (block) +(block_mapping + (block_mapping_pair + key: (flow_node) @_uses (#eq? @_uses "uses") + value: (flow_node) @_actions_ghs (#match? @_actions_ghs "^actions/github-script")) + (block_mapping_pair + key: (flow_node) @_with (#any-of? @_with "with") + value: (block_node + (block_mapping + (block_mapping_pair + key: (flow_node) @_run (#any-of? @_run "script") + value: (block_node + (block_scalar) @injection.content + (#set! injection.language "javascript"))))))) diff --git a/runtime/queries/github-action/rainbows.scm b/runtime/queries/github-action/rainbows.scm new file mode 100644 --- /dev/null +++ b/runtime/queries/github-action/rainbows.scm @@ -0,0 +1,1 @@ +; inherits: yaml diff --git a/runtime/queries/github-action/textobjects.scm b/runtime/queries/github-action/textobjects.scm new file mode 100644 --- /dev/null +++ b/runtime/queries/github-action/textobjects.scm @@ -0,0 +1,1 @@ +; inherits: yaml diff --git a/runtime/queries/yaml/injections.scm b/runtime/queries/yaml/injections.scm --- a/runtime/queries/yaml/injections.scm +++ b/runtime/queries/yaml/injections.scm @@ -55,35 +55,3 @@ (#set! injection.language "bash")))))) ;;; END nvim-treesitter LICENSED CODE - -; GitHub actions: JavaScript for workflow scripting (inline) -(block_mapping - (block_mapping_pair - key: (flow_node) @_uses (#eq? @_uses "uses") - value: (flow_node) @_actions_ghs (#match? @_actions_ghs "^actions/github-script")) - (block_mapping_pair - key: (flow_node) @_with (#eq? @_with "with") - value: (block_node - (block_mapping - (block_mapping_pair - key: (flow_node) @_run (#eq? @_run "script") - value: (flow_node - (plain_scalar - (string_scalar) @injection.content - (#set! injection.language "javascript")))))))) - -; GitHub actions: JavaScript for workflow scripting (block) -(block_mapping - (block_mapping_pair - key: (flow_node) @_uses (#eq? @_uses "uses") - value: (flow_node) @_actions_ghs (#match? @_actions_ghs "^actions/github-script")) - (block_mapping_pair - key: (flow_node) @_with (#any-of? @_with "with") - value: (block_node - (block_mapping - (block_mapping_pair - key: (flow_node) @_run (#any-of? @_run "script") - value: (block_node - (block_scalar) @injection.content - (#set! injection.language "javascript"))))))) - -- tangled.sh