Skip to content

Commit a38152e

Browse files
authoredFeb 4, 2024
fix triple quote comment syntax (#3529)
1 parent 28a101f commit a38152e

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed
 

‎.changeset/angry-pots-return.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'vscode-graphql-syntax': patch
3+
---
4+
5+
fix triple double quote comment syntax by disabling inline double quote js strings for now

‎packages/vscode-graphql-syntax/grammars/graphql.js.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"patterns": [
55
{
66
"contentName": "meta.embedded.block.graphql",
7-
"begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental)|(/\\* GraphQL \\*/))\\s*\\(?\\s*(`|'|\")",
7+
"begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental)|(/\\* GraphQL \\*/))\\s*\\(?\\s*(`|')",
88
"beginCaptures": {
99
"1": {
1010
"name": "variable.other.class.js"
@@ -22,7 +22,7 @@
2222
"name": "punctuation.definition.string.template.begin.js"
2323
}
2424
},
25-
"end": "(`|'|\")",
25+
"end": "(`|')",
2626
"endCaptures": {
2727
"0": {
2828
"name": "punctuation.definition.string.template.end.js"
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"contentName": "meta.embedded.block.graphql",
39-
"begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental))\\s*\\(?\\s*(?:<.*>)(`|'|\")",
39+
"begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental))\\s*\\(?\\s*(?:<.*>)(`|')",
4040
"beginCaptures": {
4141
"1": {
4242
"name": "variable.other.class.js"
@@ -51,7 +51,7 @@
5151
"name": "punctuation.definition.string.template.begin.js"
5252
}
5353
},
54-
"end": "(`|'|\")",
54+
"end": "(`|')",
5555
"endCaptures": {
5656
"0": {
5757
"name": "punctuation.definition.string.template.end.js"
@@ -66,7 +66,7 @@
6666
{
6767
"name": "taggedTemplates",
6868
"contentName": "meta.embedded.block.graphql",
69-
"begin": "(`|'|\")(#graphql)",
69+
"begin": "(`|')(#graphql)",
7070
"beginCaptures": {
7171
"1": {
7272
"name": "punctuation.definition.string.template.begin.js"
@@ -75,7 +75,7 @@
7575
"name": "comment.line.graphql.js"
7676
}
7777
},
78-
"end": "(`|'|\")",
78+
"end": "(`|')",
7979
"endCaptures": {
8080
"0": {
8181
"name": "punctuation.definition.string.template.end.js"

‎packages/vscode-graphql-syntax/tests/__fixtures__/test.js

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const graphql = graphql`
2929
`;
3030

3131
const graphql = graphql(`
32+
""" this is a comment """
3233
query {
3334
user(id: "5", name: ${variable}) {
3435
something
@@ -70,6 +71,7 @@ const queryWithInlineComment = `
7071

7172
const queryWithLeadingComment = /* GraphQL */ `
7273
query {
74+
""" this is a comment """
7375
user(id: "5", name: boolean) {
7476
something
7577
}

‎packages/vscode-graphql-syntax/tests/__snapshots__/js-grammar.spec.ts.snap

+8
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ graphql | entity.name.function.tagged-template.js
114114
( |
115115
\` | punctuation.definition.string.template.begin.js
116116
| meta.embedded.block.graphql
117+
""" | meta.embedded.block.graphql comment.line.graphql.js punctuation.whitespace.comment.leading.graphql
118+
this is a comment | meta.embedded.block.graphql comment.line.graphql.js
119+
""" | meta.embedded.block.graphql comment.line.graphql.js
120+
| meta.embedded.block.graphql
117121
query | meta.embedded.block.graphql keyword.operation.graphql
118122
| meta.embedded.block.graphql meta.selectionset.graphql
119123
{ | meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
@@ -292,6 +296,10 @@ query | meta.embedded.block.graphql keyword.ope
292296
| meta.embedded.block.graphql meta.selectionset.graphql
293297
{ | meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
294298
| meta.embedded.block.graphql meta.selectionset.graphql
299+
""" | meta.embedded.block.graphql meta.selectionset.graphql comment.line.graphql.js punctuation.whitespace.comment.leading.graphql
300+
this is a comment | meta.embedded.block.graphql meta.selectionset.graphql comment.line.graphql.js
301+
""" | meta.embedded.block.graphql meta.selectionset.graphql comment.line.graphql.js
302+
| meta.embedded.block.graphql meta.selectionset.graphql
295303
user | meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
296304
( | meta.embedded.block.graphql meta.selectionset.graphql meta.arguments.graphql meta.brace.round.directive.graphql
297305
id | meta.embedded.block.graphql meta.selectionset.graphql meta.arguments.graphql variable.parameter.graphql

0 commit comments

Comments
 (0)
Please sign in to comment.