Skip to content

Commit 6767b43

Browse files
authored
Update findGraphQLTags.ts
1 parent b96aa67 commit 6767b43

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/graphql-language-service-server/src/findGraphQLTags.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ export function findGraphQLTags(text: string, ext: string): TagResult[] {
169169
}
170170
},
171171
TemplateLiteral: (node: TemplateExpression) => {
172-
if (node.quasis[0].value.raw.startsWith('#graphql\n')) {
172+
const hasGraphQLPrefix = node.quasis[0].value.raw.startsWith('#graphql\n');
173+
const hasGraphQLComment = !!node.leadingComments[0]?.value.match(/^\s*GraphQL\s*$/);
174+
if (hasGraphQLPrefix || hasGraphQLComment) {
173175
const loc = node.quasis[0].loc;
174176
if (loc) {
175177
const range = new Range(
@@ -180,8 +182,8 @@ export function findGraphQLTags(text: string, ext: string): TagResult[] {
180182
tag: '',
181183
template: node.quasis[0].value.raw,
182184
range,
183-
}
184185
});
186+
}
185187
}
186188
}
187189
};

0 commit comments

Comments
 (0)