Skip to content

Commit

Permalink
Revert "fix: Fix vscode-graphql-syntax’s grammar to support string li…
Browse files Browse the repository at this point in the history
…terals on separate lines" (#3543)

* Revert "fix: Fix vscode-graphql-syntax’s grammar to support string literals o…"

This reverts commit e502c41.
  • Loading branch information
acao authored Mar 2, 2024
1 parent 04b44fa commit defc126
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 454 deletions.
6 changes: 6 additions & 0 deletions .changeset/famous-ads-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"vscode-graphql-syntax": patch
"vscode-graphql": patch
---

Temporarily revert a syntax highlighting bugfix that caused more bugs
49 changes: 26 additions & 23 deletions packages/vscode-graphql-syntax/grammars/graphql.js.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,39 @@
"patterns": [
{
"contentName": "meta.embedded.block.graphql",
"begin": "(?<=(?:(?:Relay\\??\\.)QL|gql|graphql|graphql\\.experimental)\\s*(?:<.*>)?\\s*)\\(",
"end": "\\)",
"begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental)|(/\\* GraphQL \\*/))\\s*\\(?\\s*(`|')",
"beginCaptures": {
"1": {
"name": "variable.other.class.js"
},
"2": {
"name": "entity.name.function.tagged-template.js"
},
"3": {
"name": "entity.name.function.tagged-template.js"
},
"4": {
"name": "comment.graphql.js"
},
"5": {
"name": "punctuation.definition.string.template.begin.js"
}
},
"end": "(`|')",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.template.end.js"
}
},
"patterns": [
{
"begin": "(`|')",
"end": "(`|')",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.template.begin.js"
}
},
"endCaptures": {
"0": {
"name": "punctuation.definition.string.template.end.js"
}
},
"patterns": [
{
"include": "source.graphql"
}
]
"include": "source.graphql"
}
]
},
{
"contentName": "meta.embedded.block.graphql",
"begin": "\\s*+(?:(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental)\\s*(?:<.*>)?\\s*)|(/\\* GraphQL \\*/))\\s*(`|')",
"begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental))\\s*\\(?\\s*(?:<.*>)(`|')",
"beginCaptures": {
"1": {
"name": "variable.other.class.js"
Expand All @@ -42,9 +48,6 @@
"name": "entity.name.function.tagged-template.js"
},
"4": {
"name": "comment.graphql.js"
},
"5": {
"name": "punctuation.definition.string.template.begin.js"
}
},
Expand Down
44 changes: 0 additions & 44 deletions packages/vscode-graphql-syntax/tests/__fixtures__/test-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,6 @@ const Component = () => {
};
```

```js
const variable = 1;

const queryA = graphql(`
query {
something(arg: ${variable})
}
`);

const queryB = graphql(
`
query {
something(arg: ${variable})
}
`
);

const queryC = graphql(
'query { something(arg: ${variable}) }'
);
```

```ts
const variable: number = 1;

const queryA = graphql(`
query {
something(arg: ${variable})
}
`);

const queryB = graphql(
`
query {
something(arg: ${variable})
}
`
);

const queryC = graphql(
'query { something(arg: ${variable}) }'
);
```

### svelte

```svelte
Expand Down
13 changes: 2 additions & 11 deletions packages/vscode-graphql-syntax/tests/__fixtures__/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,8 @@ const graphql = graphql(`
}
`);

const graphql = graphql(
`
query($id: ID!) { test }
`,
[var1, var2]
);

const query = /* GraphQL */ 'query { id } ';
const query = graphql('query($id: ID!) { id } ');
const query = graphql(
'query($id: ID!) { test }'
);
const query = graphql('query { id } ');

const queryWithInlineComment = `#graphql
query {
Expand All @@ -69,6 +59,7 @@ const queryWithInlineComment = `#graphql
}
}
`;
// TODO: fix this
const queryWithInlineComment = `
#graphql
query {
Expand Down
20 changes: 1 addition & 19 deletions packages/vscode-graphql-syntax/tests/__fixtures__/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,9 @@ const query = graphql<SomeGeneric>`
}
`;

// TODO: Fix this
const query = graphql<Generic>('query { id }');

const query = graphql(
'query { id }'
);

const query = graphql<Generic>(
'query { id }'
);

const query = graphql(`
query { id }
`);

const query = graphql(
`
query { id }
`,
[var1, var2]
);

const queryWithInlineComment = `#graphql
query {
user(id: "5", name: boolean) {
Expand Down
Loading

0 comments on commit defc126

Please sign in to comment.