graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

[vscode-graphql] Markdown code highlighting breaks for fenced code blocks when gql is typed

Open stenreijers opened this issue 3 years ago • 4 comments

In a markdown file whenever I have a fenced code block, with for example Javascript code, whenever I type gql somewhere the code highlighting in that block breaks.

output

stenreijers avatar May 27 '22 08:05 stenreijers

It's some side effect of this

https://github.com/graphql/graphiql/blob/5278625d27ca91ac12b1c5c8fc9468fc238f5dcd/packages/vscode-graphql/grammars/graphql.markdown.codeblock.json#L8

acao avatar Jun 06 '22 08:06 acao

CC'ing @orta who wrote this lovely grammar

acao avatar Jun 06 '22 09:06 acao

@acao it looks awfully similar to this to my eye

I believe I have a fix (just copied the way fenced code blocks are captured in the markdown tml). Working on a testing setup to go along with this change.

Curious if you would expect to see highlighting in this case:

<!-- markdown file -->

```js
const query = gql`
  query { test } # <- would you expect gql syntax highlighting here?
`;
js```

qw-in avatar Jul 09 '22 23:07 qw-in

In a markdown file whenever I have a fenced code block, with for example Javascript code, whenever I type gql somewhere the code highlighting in that block breaks.

output output

umbrellasystem404 avatar Jul 11 '22 07:07 umbrellasystem404