Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit b7bcb13

Browse files
committed
fix oboe for source location line
1 parent 49ab94b commit b7bcb13

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/FindGraphQLTags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function getSourceLocationOffset(quasi: ts.TaggedTemplateExpression) {
171171
const pos = getTemplateNode(quasi).pos;
172172
const loc = quasi.getSourceFile().getLineAndCharacterOfPosition(pos);
173173
return {
174-
line: loc.line,
174+
line: loc.line + 1,
175175
column: loc.character + 1
176176
};
177177
}

test/FindGraphQLTags-test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ describe('FindGraphQLTags', () => {
2323
name
2424
}
2525
`,
26-
sourceLocationOffset: { line: 4, column: 16 },
26+
sourceLocationOffset: { line: 5, column: 16 },
2727
}])
2828
})
2929

30+
it('extracts a tag in line 1', () => {
31+
expect(find(`graphql\`fragment TestModule_artist on Artist {name}\``)).toEqual([{
32+
keyName: null,
33+
template: `fragment TestModule_artist on Artist {name}`,
34+
sourceLocationOffset: { line: 1, column: 8 },
35+
}])
36+
})
3037
// TODO: Cover all cases where tags are extracted
3138
})

0 commit comments

Comments
 (0)