-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
By simply placing a comment with the name of the desired language above a multi-line string, that language will be injected. Also, common functions and attributes which are expected to be shell code are automatically injected.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
; mark arbitary languages with a comment | ||
( | ||
((comment) @injection.language) . [ | ||
(indented_string_expression (_) @injection.content) | ||
(_ (_)* (indented_string_expression (_) @injection.content)) | ||
(_ (_)* (_ (_)* (indented_string_expression (_) @injection.content))) | ||
(_ (_)* (_ (_)* (_ (_)* (indented_string_expression (_) @injection.content)))) | ||
(_ (_)* (_ (_)* (_ (_)* (_ (_)* (indented_string_expression (_) @injection.content)))))]) | ||
|
||
((binding | ||
attrpath: (attrpath (identifier) @_path) | ||
expression: [ | ||
(indented_string_expression (string_fragment) @injection.content) | ||
(_ (_)* (indented_string_expression (string_fragment) @injection.content)) | ||
(_ (_)* (_ (_)* (indented_string_expression (string_fragment) @injection.content))) | ||
]) | ||
(#match? @_path "(^\\w*Phase|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$") | ||
(#set! injection.language "bash")) | ||
|
||
((apply_expression | ||
function: (apply_expression function: (_) @_func) | ||
argument: (indented_string_expression (string_fragment) @injection.content)) | ||
(#match? @_func "(^|\\.)writeShellScript(Bin)?$") | ||
(#set! injection.language "bash")) | ||
|
||
(apply_expression | ||
(apply_expression | ||
function: (apply_expression | ||
function: ((_) @_func))) | ||
argument: (indented_string_expression (string_fragment) @injection.content) | ||
(#match? @_func "(^|\\.)runCommand(CC|NoCC|Local|NoCCLocal)?$") | ||
(#set! injection.language "bash")) | ||
|
||
(apply_expression | ||
function: ((_) @_func) | ||
argument: (_ (_)* (_ (_)* (binding | ||
attrpath: (attrpath (identifier) @_path) | ||
expression: [ | ||
(indented_string_expression (string_fragment) @injection.content) | ||
(_ (_)* (indented_string_expression (string_fragment) @injection.content) .) | ||
(_ (_)* (_ (_)* (indented_string_expression (string_fragment) @injection.content))) | ||
]))) | ||
(#match? @_func "(^|\\.)writeShellApplication$") | ||
(#match? @_path "^text$") | ||
(#set! injection.language "bash")) |