-
-
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 just before 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
1 parent
43b31f7
commit 665e27f
Showing
1 changed file
with
39 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,39 @@ | ||
; mark arbitary languages with a comment | ||
((((comment) @injection.language) . | ||
(indented_string_expression (string_fragment) @injection.content)) | ||
(#set! injection.combined)) | ||
|
||
((binding | ||
attrpath: (attrpath (identifier) @_path) | ||
expression: (indented_string_expression | ||
(string_fragment) @injection.content)) | ||
(#match? @_path "(^\\w*Phase|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$") | ||
(#set! injection.language "bash") | ||
(#set! injection.combined)) | ||
|
||
((apply_expression | ||
function: (apply_expression function: (_) @_func) | ||
argument: (indented_string_expression (string_fragment) @injection.content)) | ||
(#match? @_func "(^|\\.)writeShellScript(Bin)?$") | ||
(#set! injection.language "bash") | ||
(#set! injection.combined)) | ||
|
||
(apply_expression | ||
(apply_expression | ||
function: (apply_expression | ||
function: ((_) @_func))) | ||
argument: (indented_string_expression (string_fragment) @injection.content) | ||
(#match? @_func "(^|\\.)runCommand(((No)?(CC))?(Local)?)?$") | ||
(#set! injection.language "bash") | ||
(#set! injection.combined)) | ||
|
||
(apply_expression | ||
function: ((_) @_func) | ||
argument: (_ (_)* (_ (_)* (binding | ||
attrpath: (attrpath (identifier) @_path) | ||
expression: (indented_string_expression | ||
(string_fragment) @injection.content)))) | ||
(#match? @_func "(^|\\.)writeShellApplication$") | ||
(#match? @_path "^text$") | ||
(#set! injection.language "bash") | ||
(#set! injection.combined)) |