Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Commit

Permalink
add tokenizer for graphql language variables
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Jan 14, 2020
1 parent 03db2f6 commit 3655d9a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/graphql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,30 @@ export const language = <ILanguage>{
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords

// fields and argument names
[
/[a-z_$][\w$]*/,
/[a-z_][\w$]*/,
{
cases: {
'@keywords': 'keyword',
'@default': 'identifier',
'@default': 'key.identifier',
},
},
],

// identify typed input variables
[
/[$][\w$]*/,
{
cases: {
'@keywords': 'keyword',
'@default': 'argument.identifier',
},
},
],

// to show class names nicely
[
/[A-Z][\w\$]*/,
{
Expand All @@ -87,7 +101,7 @@ export const language = <ILanguage>{
'@default': 'type.identifier',
},
},
], // to show class names nicely
],

// whitespace
{ include: '@whitespace' },
Expand Down

0 comments on commit 3655d9a

Please sign in to comment.