This repository has been archived by the owner on May 30, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Background
I investigated it briefly and apparently, there is a conflict between the GraphQL Syntax highlighting extension and Ruby LSP. Two evidences that this is the case:
I'm not how to make Ruby LSP grammar take precedence over the GraphQL extension grammar (maybe using injectionSelector).
Alternative
As I've seen in other codebases, there is also the common usage of
GQL
to delimit the GraphQL syntax highlight block. Since the Ruby LSP regex nor the GraphQL Syntax highlight regex matches it, if we add it here we gain precedence and are able to correctly highlight our whole file:Implementation
Added the keyword
GQL
to be matched by the GraphQL grammar blockbegin
regex, the same syntax that is used to match bothJS|JAVASCRIPT
.Automated Tests
Updated how we test for GraphQL, moving it to an object that contains both delimiters
["GQL", "GRAPHQL"]
Manual Tests
Writing a GraphQL snippet that starts and ends with
GQL
should highlight only the block between them and keep the rest of the file syntax highlight working.