Skip to content

Commit cab5ac6

Browse files
committed
✨ Support comment body
1 parent a1638ba commit cab5ac6

5 files changed

Lines changed: 10 additions & 5 deletions

File tree

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ export default grammar({
916916
$._command_string,
917917
),
918918

919-
comment: _ => seq('#', /[^\n]*/),
919+
comment: $ => seq('#', alias(/[^\n]*/, $.body)),
920920
_space: _ => prec(-1, repeat1(/[ \t]/)),
921921
},
922922
});

queries/highlights.scm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
(comment) @comment @spell
1+
(comment) @comment
2+
3+
(comment
4+
(body) @spell)
25

36
(string) @string
47

queries/injections.scm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
((shell) @injection.content
22
(#set! injection.language "bash"))
33

4-
((comment) @injection.content
4+
(comment
5+
(body) @injection.content
56
(#set! injection.language "comment"))
67

78
(set_option_directive

queries/textobjects.scm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
(comment) @comment.outer
1+
(comment
2+
(body) @comment.inner) @comment.outer
23

34
(if_statement
45
(body) @conditional.inner) @conditional.outer

tree-sitter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
],
1616
"metadata": {
17-
"version": "0.1.1",
17+
"version": "0.1.2",
1818
"license": "MIT",
1919
"description": "tmux grammar for tree-sitter",
2020
"authors": [

0 commit comments

Comments
 (0)