-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
121 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,50 @@ | ||
{ | ||
"scopeName": "inline.graphql.dart", | ||
"injectionSelector": "L:(meta.embedded.block.dart | source.dart -string -comment)", | ||
"patterns": [ | ||
{ | ||
"begin": "(''')(#graphql)", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "string.interpolated.triple.single.dart" | ||
}, | ||
"2": { | ||
"name": "comment.line.graphql.js" | ||
} | ||
}, | ||
"end": "(''')", | ||
"endCaptures": { | ||
"1": { | ||
"name": "string.interpolated.triple.single.dart" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"include": "source.graphql" | ||
} | ||
] | ||
}, | ||
{ | ||
"begin": "(\"\"\")(#graphql)", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "string.interpolated.triple.double.dart" | ||
}, | ||
"2": { | ||
"name": "comment.line.graphql.js" | ||
} | ||
}, | ||
"end": "(\"\"\")", | ||
"endCaptures": { | ||
"1": { | ||
"name": "string.interpolated.triple.double.dart" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"include": "source.graphql" | ||
} | ||
] | ||
} | ||
] | ||
} |
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,6 @@ | ||
const test = """#graphql | ||
"""; | ||
|
||
const tet = '''#graphql | ||
'''; |
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
11 changes: 11 additions & 0 deletions
11
packages/vscode-graphql-syntax/tests/__fixtures__/test.dart
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,11 @@ | ||
const query1 = '''#graphql | ||
query { | ||
id | ||
} | ||
'''; | ||
|
||
const query2 = """#graphql | ||
query { | ||
id | ||
} | ||
"""; |
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 |
---|---|---|
|
@@ -61,3 +61,4 @@ | |
name | ||
} | ||
}""" | ||
|
32 changes: 32 additions & 0 deletions
32
packages/vscode-graphql-syntax/tests/__snapshots__/dart-grammar.spec.ts.snap
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,32 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`inline.graphql.dart grammar > should tokenize a simple dart file 1`] = ` | ||
const query1 = | | ||
''' | string.interpolated.triple.single.dart | ||
#graphql | comment.line.graphql.js | ||
| | ||
query | keyword.operation.graphql | ||
| meta.selectionset.graphql | ||
{ | meta.selectionset.graphql punctuation.operation.graphql | ||
| meta.selectionset.graphql | ||
id | meta.selectionset.graphql variable.graphql | ||
| meta.selectionset.graphql | ||
} | meta.selectionset.graphql punctuation.operation.graphql | ||
''' | string.interpolated.triple.single.dart | ||
; | | ||
| | ||
const query2 = | | ||
""" | string.interpolated.triple.double.dart | ||
#graphql | comment.line.graphql.js | ||
| | ||
query | keyword.operation.graphql | ||
| meta.selectionset.graphql | ||
{ | meta.selectionset.graphql punctuation.operation.graphql | ||
| meta.selectionset.graphql | ||
id | meta.selectionset.graphql variable.graphql | ||
| meta.selectionset.graphql | ||
} | meta.selectionset.graphql punctuation.operation.graphql | ||
""" | string.interpolated.triple.double.dart | ||
; | | ||
| | ||
`; |
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,10 @@ | ||
import { tokenizeFile } from './__utilities__/utilities'; | ||
|
||
describe('inline.graphql.dart grammar', () => { | ||
const scope = 'inline.graphql.dart'; | ||
|
||
it('should tokenize a simple dart file', async () => { | ||
const result = await tokenizeFile('__fixtures__/test.dart', scope); | ||
expect(result).toMatchSnapshot(); | ||
}); | ||
}); |