Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit 1de33e9

Browse files
authored
fix: 'Execute Query' below gql` is shown one line down (#276)
1 parent 450e9be commit 1de33e9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/client/graphql-codelens-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export class GraphQLCodeLensProvider implements CodeLensProvider {
2929
return literals.map(literal => {
3030
return new CodeLens(
3131
new Range(
32-
new Position(literal.position.line + 1, 0),
33-
new Position(literal.position.line + 1, 0),
32+
new Position(literal.position.line, 0),
33+
new Position(literal.position.line, 0),
3434
),
3535
{
3636
title: `Execute ${capitalize(literal.definition.operation)}`,

src/client/source-helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class SourceHelper {
164164
// https://regex101.com/r/Pd5PaU/2
165165
const regExpGQL = new RegExp(tag + "\\s*`([\\s\\S]+?)`", "mg")
166166

167-
let result
167+
let result: RegExpExecArray | null
168168
while ((result = regExpGQL.exec(text)) !== null) {
169169
const contents = result[1]
170170

@@ -174,7 +174,7 @@ export class SourceHelper {
174174
continue
175175
}
176176
try {
177-
processGraphQLString(contents, result.index + 4)
177+
processGraphQLString(contents, result.index + tag.length + 1)
178178
} catch (e) {}
179179
}
180180
})

0 commit comments

Comments
 (0)