apollographql / vscode-graphql

Apollo GraphQL VS Code extension
https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo
MIT License
63 stars 20 forks source link

"graphql-object-field": highlighting "string" -> "variable" #198

Closed phryneas closed 3 weeks ago

phryneas commented 3 weeks ago

Prioritizes "constant.object.key.graphql" over "string.unquoted.graphql", changes "constant" to "variable".

This makes nested objects in graphql arguments look more in-line.

Snippet for testing:

type Query {
  users: [User] @auth(
    role: User,
    permissions: {
      write: true
#     ^^^^^ funny how GitHub also highlights this as a string here
    }
  )
}

enum Role {
  User
  Admin
}

type User {
  id: ID!
  name: String!
}

input Permissions {
  read: Boolean
  write: Boolean
}

directive @auth(role: Role, permissions: Permissions) on FIELD_DEFINITION

Without these changes:

image

With these changes:

image

Note that after these changes write is highlighted the same as role or permissions.

github-actions[bot] commented 3 weeks ago

You can download the latest build of the extension for this PR here: vscode-apollo-0.0.0-build.1726069523.pr.198.commit.2e5d0cf.zip.

To install the extension, download the file, unzip it and install it in VS Code by selecting "Install from VSIX..." in the Extensions view.

Alternatively, run

code --install-extension vscode-apollo-0.0.0-build.1726069523.pr.198.commit.2e5d0cf.vsix --force

from the command line.

For older builds, please see the edit history of this comment.

phryneas commented 3 weeks ago

Honestly, with that explanation, this looks even better to me. It's very weird that in your GH comment, var is string-colored.

This is also more in line with how object properties in JavaScript are highlighted: image