Open johannpinson opened 6 years ago
@johannpinson : Can you point out the place where the error is? Are you talking about the line after # USER
?
@divyenduz
Yes for 2 comments:
Check if current user has one of required role
just after the directive @hasrole
and
Get the currently logged in user
There is the good "color" expected for a comment:
Personally, I use #
for internal comment into the file and string comment like """
which will be displayed inside GraphQL Playground for example.
@johannpinson : Thanks! In the 1st image, the format is "<string>"
, is that even a valid comment?
To my understanding, comments can be represented via """
or #
Hello @divyenduz
Sorry for the delay.
You can see in the specs that a comment can be use with single "
: https://facebook.github.io/graphql/draft/#sec-Descriptions
In fact, in the specs, it's named "description" when we use "
and a comment for #
The single-quote descriptions break the coloring completely. String literals is the proper way for documenting fields, so I think it's very important to fix this. The following is very hard to work with:
@divyenduz The later GraphQL specs introduced a new difference between what they call comments and descriptions. Originally, any text like so # a comment here
was called a Comment and would show up in the GraphQL introspection docs. This has been changed in later specs with the addition of Descriptions. Descriptions are either wrapped in quotes in a single line or triple quotes for multi line. Comments are now completely ignored by the spec and treated as whitespace. Descriptions are not ignored, they are included in the autogenerated introspection documentation of GraphQL.
Therefore, we should add formatting support for text inside quotes like "A description here"
to be the same as a multi-line description block, which is denoted by wrapping it with the triple quotes """
I'm happy to submit a pull request for this, however it should be very straight-forward. Essentially it's this that needs editing:
/vscode-graphql/blob/master/grammars/graphql.json
From this:
"graphql-description-singleline": {
"name": "comment.line.number-sign.graphql",
"match": "#(?=([^\"]*\"[^\"]*\")*[^\"]*$).*$"
}
To this:
"graphql-description-singleline": {
"name": "comment.line.number-sign.graphql",
"match": "\".*\""
}
@alan-cooney Thank you, Please submit a pull-request. Do share some images of how the syntax highlighting looks like with the modified grammar.
hey @divyenduz
There are still some problems with string laterals comments, cf. screenshot:
Since
"""
for multiline looks goods, it not true for single line comments.Thanks,