Skip to content

Commit 56a487c

Browse files
DanielRosenwasserCopilot
authored andcommitted
Fix failing tests for hovers/quick info on this (#2676)
1 parent ffe8feb commit 56a487c

4 files changed

Lines changed: 15 additions & 20 deletions

File tree

internal/fourslash/_scripts/failingTests.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ TestLocalFunction
411411
TestMemberListInReopenedEnum
412412
TestMemberListInWithBlock
413413
TestMemberListOfExportedClass
414-
TestMemberListOnContextualThis
415414
TestMultilineCommentBeforeOpenBrace
416415
TestMultiModuleFundule
417416
TestNgProxy1
@@ -508,10 +507,7 @@ TestQuickInfoOnPropertyAccessInWriteLocation2
508507
TestQuickInfoOnPropertyAccessInWriteLocation3
509508
TestQuickInfoOnPropertyAccessInWriteLocation4
510509
TestQuickInfoOnPropertyAccessInWriteLocation5
511-
TestQuickInfoOnThis
512-
TestQuickInfoOnThis2
513510
TestQuickInfoOnThis3
514-
TestQuickInfoOnThis4
515511
TestQuickInfoOnUndefined
516512
TestQuickInfoOnVarInArrowExpression
517513
TestQuickInfoPrivateIdentifierInTypeReferenceNoCrash1
@@ -551,7 +547,6 @@ TestSymbolCompletionLowerPriority
551547
TestSyntheticImportFromBabelGeneratedFile1
552548
TestSyntheticImportFromBabelGeneratedFile2
553549
TestTabbingAfterNewlineInsertedBeforeWhile
554-
TestThisBindingInLambda
555550
TestThisPredicateFunctionQuickInfo01
556551
TestThisPredicateFunctionQuickInfo02
557552
TestTsxCompletionNonTagLessThan

internal/ls/hover.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func formatQuickInfo(quickInfo string) string {
174174
func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol, node *ast.Node) (string, *ast.Node) {
175175
container := getContainerNode(node)
176176
if node.Kind == ast.KindThisKeyword && ast.IsInExpressionContext(node) || ast.IsThisInTypeQuery(node) {
177-
return c.TypeToStringEx(c.GetTypeAtLocation(node), container, typeFormatFlags), nil
177+
return "this: " + c.TypeToStringEx(c.GetTypeAtLocation(node), container, typeFormatFlags), nil
178178
}
179179
if symbol == nil {
180180
return "", nil

testdata/baselines/reference/fourslash/quickInfo/quickInfoCommentsClassMembers.baseline

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@
751751
// ^^^^
752752
// | ----------------------------------------------------------------------
753753
// | ```tsx
754-
// | this
754+
// | this: this
755755
// | ```
756756
// |
757757
// | ----------------------------------------------------------------------
@@ -3168,7 +3168,7 @@
31683168
"item": {
31693169
"contents": {
31703170
"kind": "markdown",
3171-
"value": "```tsx\nthis\n```\n"
3171+
"value": "```tsx\nthis: this\n```\n"
31723172
},
31733173
"range": {
31743174
"start": {

testdata/baselines/reference/fourslash/quickInfo/quickInfoOnThis5.baseline

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
// ^^^^
88
// | ----------------------------------------------------------------------
99
// | ```tsx
10-
// | { num: number; f(): void; g(this: number): void; }
10+
// | this: { num: number; f(): void; g(this: number): void; }
1111
// | ```
1212
// |
1313
// | ----------------------------------------------------------------------
1414
// type Z = typeof this.num;
1515
// ^^^^
1616
// | ----------------------------------------------------------------------
1717
// | ```tsx
18-
// | { num: number; f(): void; g(this: number): void; }
18+
// | this: { num: number; f(): void; g(this: number): void; }
1919
// | ```
2020
// |
2121
// | ----------------------------------------------------------------------
@@ -25,7 +25,7 @@
2525
// ^^^^
2626
// | ----------------------------------------------------------------------
2727
// | ```tsx
28-
// | number
28+
// | this: number
2929
// | ```
3030
// |
3131
// | ----------------------------------------------------------------------
@@ -38,15 +38,15 @@
3838
// ^^^^
3939
// | ----------------------------------------------------------------------
4040
// | ```tsx
41-
// | this
41+
// | this: this
4242
// | ```
4343
// |
4444
// | ----------------------------------------------------------------------
4545
// type Z = typeof this.num;
4646
// ^^^^
4747
// | ----------------------------------------------------------------------
4848
// | ```tsx
49-
// | this
49+
// | this: this
5050
// | ```
5151
// |
5252
// | ----------------------------------------------------------------------
@@ -56,7 +56,7 @@
5656
// ^^^^
5757
// | ----------------------------------------------------------------------
5858
// | ```tsx
59-
// | number
59+
// | this: number
6060
// | ```
6161
// |
6262
// | ----------------------------------------------------------------------
@@ -76,7 +76,7 @@
7676
"item": {
7777
"contents": {
7878
"kind": "markdown",
79-
"value": "```tsx\n{ num: number; f(): void; g(this: number): void; }\n```\n"
79+
"value": "```tsx\nthis: { num: number; f(): void; g(this: number): void; }\n```\n"
8080
},
8181
"range": {
8282
"start": {
@@ -103,7 +103,7 @@
103103
"item": {
104104
"contents": {
105105
"kind": "markdown",
106-
"value": "```tsx\n{ num: number; f(): void; g(this: number): void; }\n```\n"
106+
"value": "```tsx\nthis: { num: number; f(): void; g(this: number): void; }\n```\n"
107107
},
108108
"range": {
109109
"start": {
@@ -130,7 +130,7 @@
130130
"item": {
131131
"contents": {
132132
"kind": "markdown",
133-
"value": "```tsx\nnumber\n```\n"
133+
"value": "```tsx\nthis: number\n```\n"
134134
},
135135
"range": {
136136
"start": {
@@ -157,7 +157,7 @@
157157
"item": {
158158
"contents": {
159159
"kind": "markdown",
160-
"value": "```tsx\nthis\n```\n"
160+
"value": "```tsx\nthis: this\n```\n"
161161
},
162162
"range": {
163163
"start": {
@@ -184,7 +184,7 @@
184184
"item": {
185185
"contents": {
186186
"kind": "markdown",
187-
"value": "```tsx\nthis\n```\n"
187+
"value": "```tsx\nthis: this\n```\n"
188188
},
189189
"range": {
190190
"start": {
@@ -211,7 +211,7 @@
211211
"item": {
212212
"contents": {
213213
"kind": "markdown",
214-
"value": "```tsx\nnumber\n```\n"
214+
"value": "```tsx\nthis: number\n```\n"
215215
},
216216
"range": {
217217
"start": {

0 commit comments

Comments
 (0)