From 86f8fbf8d7250700657874b9f8bca0e74f6fa01a Mon Sep 17 00:00:00 2001 From: ViniiR Date: Tue, 20 Jan 2026 14:37:42 -0300 Subject: [PATCH 1/2] feat: add awk injection in bash --- runtime/queries/bash/injections.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/runtime/queries/bash/injections.scm b/runtime/queries/bash/injections.scm index 5b7e06bac..53995cab6 100644 --- a/runtime/queries/bash/injections.scm +++ b/runtime/queries/bash/injections.scm @@ -88,3 +88,27 @@ (#offset! @injection.content 0 1 0 -1) (#set! injection.include-children) (#set! injection.self)) + +(command + name: (command_name + (word) @_command) + . + argument: (raw_string) @injection.content + . + (#eq? @_command "awk") + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "awk")) + +(command + name: (command_name + (word) @_command) + argument: (_)? @_param + . + argument: (raw_string) @injection.content + . + (#eq? @_command "awk") + (#not-match? @_param "^(--file|--field-separator|-[^-]*[fF])") + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "awk")) From 91d80b2c737bea925c359da0e9bbb82796351cfe Mon Sep 17 00:00:00 2001 From: ViniiR Date: Tue, 20 Jan 2026 15:15:55 -0300 Subject: [PATCH 2/2] fix(bash): change expensive regex --- runtime/queries/bash/injections.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runtime/queries/bash/injections.scm b/runtime/queries/bash/injections.scm index 53995cab6..471baccfd 100644 --- a/runtime/queries/bash/injections.scm +++ b/runtime/queries/bash/injections.scm @@ -88,10 +88,10 @@ (#offset! @injection.content 0 1 0 -1) (#set! injection.include-children) (#set! injection.self)) - + (command name: (command_name - (word) @_command) + (word)) @_command . argument: (raw_string) @injection.content . @@ -102,13 +102,14 @@ (command name: (command_name - (word) @_command) + (word)) @_command argument: (_)? @_param . argument: (raw_string) @injection.content . (#eq? @_command "awk") - (#not-match? @_param "^(--file|--field-separator|-[^-]*[fF])") + (#not-any-of? @_param "--file" "--field-separator") + (#not-lua-match? @_param "^%-[^%-]*[fF]") (#offset! @injection.content 0 1 0 -1) (#set! injection.include-children) (#set! injection.language "awk"))