From 84385bfce31bfc14546aea320d217924f4fb136a Mon Sep 17 00:00:00 2001 From: Vitor Correa Date: Fri, 2 Feb 2024 16:47:22 -0500 Subject: [PATCH] Improve GraphQL regex to match 'GQL' --- grammars/ruby.cson.json | 4 ++-- src/test/suite/grammars.test.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/grammars/ruby.cson.json b/grammars/ruby.cson.json index 4693636c..043eb12a 100644 --- a/grammars/ruby.cson.json +++ b/grammars/ruby.cson.json @@ -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" diff --git a/src/test/suite/grammars.test.ts b/src/test/suite/grammars.test.ts index d77e6266..3885b36d 100644 --- a/src/test/suite/grammars.test.ts +++ b/src/test/suite/grammars.test.ts @@ -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", @@ -37,6 +36,10 @@ const EMBEDDED_HEREDOC_LANGUAGES: InferrableLanguageConfigOrLabel[] = [ id: "cpp", label: "C++", }, + { + label: "GraphQL", + delimiters: ["GRAPHQL", "GQL"], + }, { label: "HAML", contentName: "text.haml",