Skip to content

Commit

Permalink
Improve support for command bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Feb 20, 2024
1 parent be0fdf7 commit 983420b
Show file tree
Hide file tree
Showing 10 changed files with 4,223 additions and 3,922 deletions.
6 changes: 4 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,10 @@ module.exports = grammar({

escape_sequence: (_) => ESCAPE_SEQUENCE,

_backticked: (_) => seq("`", repeat(/./), "`"),
_indented_backticked: (_) => seq("```", repeat(/./), "```"),
_backticked: ($) => seq("`", optional($.command_body), "`"),
_indented_backticked: ($) => seq("```", optional($.command_body), "```"),

command_body: ($) => repeat1(choice($.interpolation, /./)),

// interpolation : '{{' expression '}}'
interpolation: ($) => seq("{{", $.expression, "}}"),
Expand Down
4 changes: 3 additions & 1 deletion queries-src/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@
"]"
"("
")"
"{{"
"}}"
] @punctuation.bracket

[ "{{" "}}" "`" ] @punctuation.special
[ "`" "```"] @punctuation.special

; Literals

Expand Down
21 changes: 9 additions & 12 deletions queries-src/injections.scm
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
(comment) @comment
((comment) @injection.content
(#set! injection.language "comment"))

; FIXME: shebang
; (shebang_recipe
; (shebang
; interpreter:(TEXT) @language)
; (shebang_body) @content
; )
; Defaults if language is not set elsewhere

(source_file
; (item (setting lang:(identifier) @language))
(recipe (recipe_body) @content)
)
; (recipe_line
; (text) @injection.content
; (#set! injection.language "bash"))

; (interpolation (expression) @just)
; (external_command
; (command_body) @injection.content
; (#set! injection.language "bash"))
2 changes: 1 addition & 1 deletion queries/just/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
")"
] @punctuation.bracket

[ "{{" "}}" "`" ] @punctuation.special
[ "{{" "}}" "`" "```"] @punctuation.special

; Literals

Expand Down
21 changes: 9 additions & 12 deletions queries/just/injections.scm
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
; File autogenerated by build-queries-nvim.py; do not edit

(comment) @comment
((comment) @injection.content
(#set! injection.language "comment"))

; FIXME: shebang
; (shebang_recipe
; (shebang
; interpreter:(TEXT) @language)
; (shebang_body) @content
; )
; Defaults if language is not set elsewhere

(source_file
; (item (setting lang:(identifier) @language))
(recipe (recipe_body) @content)
)
; (recipe_line
; (text) @injection.content
; (#set! injection.language "bash"))

; (interpolation (expression) @just)
; (external_command
; (command_body) @injection.content
; (#set! injection.language "bash"))
46 changes: 36 additions & 10 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 26 additions & 1 deletion src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 983420b

Please sign in to comment.