michaelgmcd / vscode-language-babel

VSCode syntax highlighting for today's JavaScript
https://marketplace.visualstudio.com/items?itemName=mgmcdermott.vscode-language-babel
MIT License
131 stars 17 forks source link

GQL Template Literal Annotation Highlighting #62

Closed mondash closed 4 years ago

mondash commented 4 years ago

Describe the issue

I've found a bug (or perhaps a missing feature) in the syntax highlighting for Apollo GraphQL template literals. Multi-line annotations using triple double quotes are not highlighted as comments. In the image below, see the difference in color from the field annotation as well as the unwanted highlighting of the reserved word type in the annotation. This is using Oceanic Next theme as recommended in the README.

Screenshot of Current Behavior

image

Sample Code to Reproduce

import { gql } from "apollo-server";

const userType = gql`
  """
  Description of the user type
  """
  type User {
    "Description of the email field"
    email: String!
    id: ID!
  }
`;
michaelgmcd commented 4 years ago

Yep, this is just a missing feature. Is this in the graphQL spec or is it Apollo-specific? (Looking at https://github.com/graphql/graphql-spec/issues/276). I'm hesitant to add it as the default behavior if it's just as apollo. I don't see how it could hurt though.

mondash commented 4 years ago

Thanks for the quick response!

As far as I can tell, it looks like this is a GraphQL spec (although I could not find any source on the Schemas and Types page on graphql.org. Here's the Apollo Schema basics page where this is demonstrated under the Documentation Strings heading and an Alligator.io article A GraphQL SDL Reference where this is demonstrated under the Schema Documentation heading.

It looks line single line annotations with double quotes and multi-line annotations with triple double quotes should be available for both types and fields. All kinds are working for me in my Apollo playground.

The syntax highlighting is working for me for both kinds of field annotations but neither kinds of type annotations

michaelgmcd commented 4 years ago

@mondash Please re-open if this is not fixed in 0.0.26