Skip to content

Comment Highlighting Broken #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wesbos opened this issue Apr 20, 2018 · 8 comments
Closed

Comment Highlighting Broken #87

wesbos opened this issue Apr 20, 2018 · 8 comments

Comments

@wesbos
Copy link

wesbos commented Apr 20, 2018

I'm using Prisma and they generate the schema for us. One of the peices they generate has a comment like this:

type Query {
  users(where: UserWhereInput, orderBy: UserOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [User]!
  cartItems(where: CartItemWhereInput, orderBy: CartItemOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [CartItem]!
  items(where: ItemWhereInput, orderBy: ItemOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Item]!
  orderItems(where: OrderItemWhereInput, orderBy: OrderItemOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [OrderItem]!
  orders(where: OrderWhereInput, orderBy: OrderOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Order]!
  user(where: UserWhereUniqueInput!): User
  cartItem(where: CartItemWhereUniqueInput!): CartItem
  item(where: ItemWhereUniqueInput!): Item
  orderItem(where: OrderItemWhereUniqueInput!): OrderItem
  order(where: OrderWhereUniqueInput!): Order
  usersConnection(where: UserWhereInput, orderBy: UserOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): UserConnection!
  cartItemsConnection(where: CartItemWhereInput, orderBy: CartItemOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): CartItemConnection!
  itemsConnection(where: ItemWhereInput, orderBy: ItemOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): ItemConnection!
  orderItemsConnection(where: OrderItemWhereInput, orderBy: OrderItemOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): OrderItemConnection!
  ordersConnection(where: OrderWhereInput, orderBy: OrderOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): OrderConnection!
  """
  Fetches an object given its ID
  """
  node("""
  The ID of an object
  """
  id: ID!): Node
}

That last comment is a bit weird and seems to be breaking highlighting.

Is this a valid graphql comment? GitHub seems to highlight it just fine, but this extension highlights it like this:

This very well may be an issue with Prisma too, will open an issue over there.

@wesbos
Copy link
Author

wesbos commented Apr 20, 2018

Just talked to @marktani from Graph Cool and he confirmed that it is valid GraphQL and pointed me at this issue:

graphql/graphql-js#1285

So the highlighter needs to be fixed

@kumarharsh
Copy link
Owner

Thanks for the report. Will push a fix over the weekend

@wesbos
Copy link
Author

wesbos commented Apr 20, 2018

:D Thank you so much

@kumarharsh
Copy link
Owner

@wesbos I don't see github highlighting it fine:
image
(notice the blue vs black colour of the first and second comments)

I have fixed the issue, though I'm not really happy with the regexp. In the linked issue, it's a little unclear whether the triple-quotes just after a parenthesis is a desired behaviour or not.

@wesbos
Copy link
Author

wesbos commented Apr 23, 2018

thank you! I didn't realize github goodfed it up too, but it doesn't make the rest of the content a comment like this issue did.

@johannpinson
Copy link

Thinks @wesbos for the report and @kumarharsh for the fix
You rock guys! 👍

@wesbos
Copy link
Author

wesbos commented Jun 22, 2018

Hrmm this still seems to be broken with the following code:

type AggregateUser {
  count: Int!
}

type BatchPayload {
  """The number of nodes that have been affected by the Batch operation."""
  count: Long!
}

"""
The `Long` scalar type represents non-fractional signed whole numeric values.
Long can represent values between -(2^63) and 2^63 - 1.
"""
scalar Long

type Mutation {
  createUser(data: UserCreateInput!): User!
  updateUser(data: UserUpdateInput!, where: UserWhereUniqueInput!): User
  deleteUser(where: UserWhereUniqueInput!): User
  upsertUser(where: UserWhereUniqueInput!, create: UserCreateInput!, update: UserUpdateInput!): User!
  updateManyUsers(data: UserUpdateInput!, where: UserWhereInput): BatchPayload!
  deleteManyUsers(where: UserWhereInput): BatchPayload!
}

enum MutationType {
  CREATED
  UPDATED
  DELETED
}

"""An object with an ID"""
interface Node {
  """The id of the object."""
  id: ID!
}

"""Information about pagination in a connection."""
type PageInfo {
  """When paginating forwards, are there more items?"""
  hasNextPage: Boolean!

  """When paginating backwards, are there more items?"""
  hasPreviousPage: Boolean!

  """When paginating backwards, the cursor to continue."""
  startCursor: String

  """When paginating forwards, the cursor to continue."""
  endCursor: String
}

@kumarharsh
Copy link
Owner

Thanks. I'm aware of this issue. Will push a fix for it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants