Skip to content

Commit f500954

Browse files
authored
Fix compare LSP positions (#1703)
1 parent 0216862 commit f500954

File tree

56 files changed

+120
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+120
-96
lines changed

internal/fourslash/_scripts/failingTests.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,13 @@ TestEditJsdocType
167167
TestExportDefaultClass
168168
TestExportDefaultFunction
169169
TestFindAllReferencesDynamicImport1
170-
TestFindAllReferencesTripleSlash
171170
TestFindAllReferencesUmdModuleAsGlobalConst
172171
TestFindAllRefsCommonJsRequire
173172
TestFindAllRefsCommonJsRequire2
174173
TestFindAllRefsCommonJsRequire3
175174
TestFindAllRefsExportEquals
176175
TestFindAllRefsForDefaultExport03
177176
TestFindAllRefsModuleDotExports
178-
TestFindAllRefsReExport_broken
179177
TestFindAllRefs_importType_typeofImport
180178
TestFindReferencesAfterEdit
181179
TestFindReferencesBindingPatternInJsdocNoCrash1

internal/fourslash/tests/gen/findAllReferencesTripleSlash_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func TestFindAllReferencesTripleSlash(t *testing.T) {
1111
t.Parallel()
12-
t.Skip()
12+
1313
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1414
const content = `// @checkJs: true
1515
// @Filename: /node_modules/@types/globals/index.d.ts

internal/fourslash/tests/gen/findAllRefsReExport_broken_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func TestFindAllRefsReExport_broken(t *testing.T) {
1111
t.Parallel()
12-
t.Skip()
12+
1313
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1414
const content = `// @Filename: /a.ts
1515
/*1*/export { /*2*/x };`

internal/ls/utilities.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func ComparePositions(pos, other lsproto.Position) int {
2828
if lineComp := cmp.Compare(pos.Line, other.Line); lineComp != 0 {
2929
return lineComp
3030
}
31-
return cmp.Compare(pos.Line, other.Line)
31+
return cmp.Compare(pos.Character, other.Character)
3232
}
3333

3434
// Implements a cmp.Compare like function for two *lsproto.Range

testdata/baselines/reference/fourslash/findAllRef/AutoImportProvider_referencesCrash.baseline.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
// === /home/src/workspaces/project/b/b.ts ===
1010

1111
// /// <reference path="../a/index.d.ts" />
12-
// new A/*FIND ALL REFS*/[|A|]();
12+
// new [|A|]/*FIND ALL REFS*/();

testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesImportMeta.baseline.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
// // Haha that's so meta!
55
//
6-
// let x = import.meta/*FIND ALL REFS*/[|meta|];
6+
// let x = import.[|meta|]/*FIND ALL REFS*/;

testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesJsOverloadedFunctionParameter.baseline.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
// * @param {unknown} x
66
// * @returns {unknown}
77
// */
8-
// function foo(x/*FIND ALL REFS*/[|x|]) {
8+
// function foo([|x|]/*FIND ALL REFS*/) {
99
// return [|x|];
1010
// }

testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesLinkTag1.baseline.jsonc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// === /findAllReferencesLinkTag1.ts ===
33

44
// class C {
5-
// m/*FIND ALL REFS*/[|m|]() { }
5+
// [|m|]/*FIND ALL REFS*/() { }
66
// n = 1
77
// static s() { }
88
// /**
@@ -26,7 +26,7 @@
2626

2727
// class C {
2828
// m() { }
29-
// n/*FIND ALL REFS*/[|n|] = 1
29+
// [|n|]/*FIND ALL REFS*/ = 1
3030
// static s() { }
3131
// /**
3232
// * {@link m}
@@ -52,7 +52,7 @@
5252
// class C {
5353
// m() { }
5454
// n = 1
55-
// static s/*FIND ALL REFS*/[|s|]() { }
55+
// static [|s|]/*FIND ALL REFS*/() { }
5656
// /**
5757
// * {@link m}
5858
// * @see {m}
@@ -79,7 +79,7 @@
7979
// }
8080
//
8181
// interface I {
82-
// a/*FIND ALL REFS*/[|a|]()
82+
// [|a|]/*FIND ALL REFS*/()
8383
// b: 1
8484
// /**
8585
// * {@link a}
@@ -95,7 +95,7 @@
9595
//
9696
// interface I {
9797
// a()
98-
// b/*FIND ALL REFS*/[|b|]: 1
98+
// [|b|]/*FIND ALL REFS*/: 1
9999
// /**
100100
// * {@link a}
101101
// * @see {a}
@@ -115,7 +115,7 @@
115115
// function ref() { }
116116
// /** @see {r2} */
117117
// function d3() { }
118-
// function r2/*FIND ALL REFS*/[|r2|]() { }
118+
// function [|r2|]/*FIND ALL REFS*/() { }
119119
// }
120120

121121

@@ -124,7 +124,7 @@
124124
// === findAllReferences ===
125125
// === /findAllReferencesLinkTag1.ts ===
126126

127-
// class C/*FIND ALL REFS*/[|C|] {
127+
// class [|C|]/*FIND ALL REFS*/ {
128128
// m() { }
129129
// n = 1
130130
// static s() { }
@@ -169,7 +169,7 @@
169169
// r() { }
170170
// }
171171
//
172-
// interface I/*FIND ALL REFS*/[|I|] {
172+
// interface [|I|]/*FIND ALL REFS*/ {
173173
// a()
174174
// b: 1
175175
// /**

testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesLinkTag2.baseline.jsonc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// This = class {
77
// show() { }
88
// }
9-
// m/*FIND ALL REFS*/[|m|]() { }
9+
// [|m|]/*FIND ALL REFS*/() { }
1010
// }
1111
// /**
1212
// * @see {Consider.prototype.m}
@@ -21,7 +21,7 @@
2121
// namespace NPR {
2222
// export class Consider {
2323
// This = class {
24-
// show/*FIND ALL REFS*/[|show|]() { }
24+
// [|show|]/*FIND ALL REFS*/() { }
2525
// }
2626
// m() { }
2727
// }
@@ -35,7 +35,7 @@
3535

3636
// namespace NPR {
3737
// export class Consider {
38-
// This/*FIND ALL REFS*/[|This|] = class {
38+
// [|This|]/*FIND ALL REFS*/ = class {
3939
// show() { }
4040
// }
4141
// m() { }
@@ -48,7 +48,7 @@
4848
// === /findAllReferencesLinkTag2.ts ===
4949

5050
// namespace NPR {
51-
// export class Consider/*FIND ALL REFS*/[|Consider|] {
51+
// export class [|Consider|]/*FIND ALL REFS*/ {
5252
// This = class {
5353
// show() { }
5454
// }
@@ -80,7 +80,7 @@
8080
// === findAllReferences ===
8181
// === /findAllReferencesLinkTag2.ts ===
8282

83-
// namespace NPR/*FIND ALL REFS*/[|NPR|] {
83+
// namespace [|NPR|]/*FIND ALL REFS*/ {
8484
// export class Consider {
8585
// This = class {
8686
// show() { }

testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesLinkTag3.baseline.jsonc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// This = class {
77
// show() { }
88
// }
9-
// m/*FIND ALL REFS*/[|m|]() { }
9+
// [|m|]/*FIND ALL REFS*/() { }
1010
// }
1111
// /**
1212
// * {@linkcode Consider.prototype.[|m|]}
@@ -24,7 +24,7 @@
2424
// namespace NPR {
2525
// export class Consider {
2626
// This = class {
27-
// show/*FIND ALL REFS*/[|show|]() { }
27+
// [|show|]/*FIND ALL REFS*/() { }
2828
// }
2929
// m() { }
3030
// }
@@ -38,7 +38,7 @@
3838

3939
// namespace NPR {
4040
// export class Consider {
41-
// This/*FIND ALL REFS*/[|This|] = class {
41+
// [|This|]/*FIND ALL REFS*/ = class {
4242
// show() { }
4343
// }
4444
// m() { }
@@ -51,7 +51,7 @@
5151
// === /findAllReferencesLinkTag3.ts ===
5252

5353
// namespace NPR {
54-
// export class Consider/*FIND ALL REFS*/[|Consider|] {
54+
// export class [|Consider|]/*FIND ALL REFS*/ {
5555
// This = class {
5656
// show() { }
5757
// }
@@ -83,7 +83,7 @@
8383
// === findAllReferences ===
8484
// === /findAllReferencesLinkTag3.ts ===
8585

86-
// namespace NPR/*FIND ALL REFS*/[|NPR|] {
86+
// namespace [|NPR|]/*FIND ALL REFS*/ {
8787
// export class Consider {
8888
// This = class {
8989
// show() { }

0 commit comments

Comments
 (0)