Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Improve GraphQL regex to match 'GQL' #1020

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions grammars/ruby.cson.json
Original file line number Diff line number Diff line change
Expand Up @@ -1671,13 +1671,13 @@
]
},
{
"begin": "(?=(?><<[-~]([\"'`]?)((?:[_\\w]+_|)GRAPHQL)\\b\\1))",
"begin": "(?=(?><<[-~]([\"'`]?)((?:[_\\w]+_|)(?:GRAPHQL|GQL))\\b\\1))",
"comment": "Heredoc with embedded GraphQL",
"end": "(?!\\G)",
"name": "meta.embedded.block.graphql",
"patterns": [
{
"begin": "(?><<[-~]([\"'`]?)((?:[_\\w]+_|)GRAPHQL)\\b\\1)",
"begin": "(?><<[-~]([\"'`]?)((?:[_\\w]+_|)(?:GRAPHQL|GQL))\\b\\1)",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.ruby"
Expand Down
5 changes: 4 additions & 1 deletion src/test/suite/grammars.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const EMBEDDED_HEREDOC_LANGUAGES: InferrableLanguageConfigOrLabel[] = [
// Languages for which we can infer everything from the comment label
"C",
"CSS",
"GraphQL",
"Lua",
"Ruby",
"SQL",
Expand All @@ -37,6 +36,10 @@ const EMBEDDED_HEREDOC_LANGUAGES: InferrableLanguageConfigOrLabel[] = [
id: "cpp",
label: "C++",
},
{
label: "GraphQL",
delimiters: ["GRAPHQL", "GQL"],
},
{
label: "HAML",
contentName: "text.haml",
Expand Down
Loading