Skip to content

Commit b05c8ee

Browse files
authored
fix: correct declareMap reference line number (#2250)
1 parent 6ba86d2 commit b05c8ee

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

packages/language-server/src/plugins/typescript/DocumentSnapshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ export class DtsDocumentSnapshot extends JSOrTSDocumentSnapshot implements Docum
664664
}
665665

666666
return {
667-
line: mapped.line,
667+
line: mapped.line - 1,
668668
character: mapped.column,
669669
uri: pathToUrl(originalFilePath)
670670
};

packages/language-server/test/plugins/typescript/TypescriptPlugin.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,12 +569,12 @@ describe('TypescriptPlugin', function () {
569569
assert.deepStrictEqual(definition, [
570570
<LocationLink>{
571571
targetRange: {
572-
end: { line: 1, character: 18 },
573-
start: { line: 1, character: 16 }
572+
end: { line: 0, character: 18 },
573+
start: { line: 0, character: 16 }
574574
},
575575
targetSelectionRange: {
576-
start: { line: 1, character: 16 },
577-
end: { line: 1, character: 18 }
576+
start: { line: 0, character: 16 },
577+
end: { line: 0, character: 18 }
578578
},
579579
originSelectionRange: {
580580
start: { line: 1, character: 13 },
@@ -592,12 +592,12 @@ describe('TypescriptPlugin', function () {
592592
assert.deepStrictEqual(definition, [
593593
<LocationLink>{
594594
targetRange: {
595-
end: { line: 1, character: 18 },
596-
start: { line: 1, character: 16 }
595+
end: { line: 0, character: 18 },
596+
start: { line: 0, character: 16 }
597597
},
598598
targetSelectionRange: {
599-
start: { line: 1, character: 16 },
600-
end: { line: 1, character: 18 }
599+
start: { line: 0, character: 16 },
600+
end: { line: 0, character: 18 }
601601
},
602602
originSelectionRange: {
603603
start: { line: 1, character: 13 },

packages/language-server/test/plugins/typescript/features/FindReferencesProvider.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ describe('FindReferencesProvider', function () {
319319
assert.deepStrictEqual(references, <Location[]>[
320320
{
321321
range: {
322-
end: { line: 1, character: 18 },
323-
start: { line: 1, character: 16 }
322+
end: { line: 0, character: 18 },
323+
start: { line: 0, character: 16 }
324324
},
325325
uri: getUri('declaration-map/declaration-map-project/index.ts')
326326
},

packages/language-server/test/plugins/typescript/features/ImplemenationProvider.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ describe('ImplementationProvider', function () {
8989
assert.deepStrictEqual(implementations, <Location[]>[
9090
{
9191
range: {
92-
end: { line: 1, character: 18 },
93-
start: { line: 1, character: 16 }
92+
end: { line: 0, character: 18 },
93+
start: { line: 0, character: 16 }
9494
},
9595
uri: getUri('../declaration-map/declaration-map-project/index.ts')
9696
}

packages/language-server/test/plugins/typescript/features/TypeDefinitionProvider.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ describe('TypeDefinitionProvider', function () {
9898
assert.deepStrictEqual(typeDefs, <Location[]>[
9999
{
100100
range: {
101-
end: { line: 1, character: 18 },
102-
start: { line: 1, character: 16 }
101+
end: { line: 0, character: 18 },
102+
start: { line: 0, character: 16 }
103103
},
104104
uri: getUri('../declaration-map/declaration-map-project/index.ts')
105105
}

0 commit comments

Comments
 (0)