mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Inlay hints for ThisType nodes (#56564)
This commit is contained in:
parent
921259ee02
commit
2f2d2f2bb9
@ -77,6 +77,7 @@ import {
|
||||
isRestTypeNode,
|
||||
isSpreadElement,
|
||||
isStringLiteral,
|
||||
isThisTypeNode,
|
||||
isTupleTypeNode,
|
||||
isTypeLiteralNode,
|
||||
isTypeNode,
|
||||
@ -792,6 +793,10 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
|
||||
parts.push({ text: tokenToString(node.operator) });
|
||||
visitForDisplayParts(node.operand);
|
||||
break;
|
||||
case SyntaxKind.ThisType:
|
||||
Debug.assertNode(node, isThisTypeNode);
|
||||
parts.push({ text: "this" });
|
||||
break;
|
||||
default:
|
||||
Debug.failBadSyntaxKind(node);
|
||||
}
|
||||
|
||||
@ -33,6 +33,23 @@ function foo1 () {
|
||||
"whitespaceBefore": true
|
||||
}
|
||||
|
||||
bar() {
|
||||
^
|
||||
{
|
||||
"text": "",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": ": "
|
||||
},
|
||||
{
|
||||
"text": "this"
|
||||
}
|
||||
],
|
||||
"position": 130,
|
||||
"kind": "Type",
|
||||
"whitespaceBefore": true
|
||||
}
|
||||
|
||||
const a = () => 1
|
||||
^
|
||||
{
|
||||
@ -45,7 +62,7 @@ const a = () => 1
|
||||
"text": "number"
|
||||
}
|
||||
],
|
||||
"position": 135,
|
||||
"position": 173,
|
||||
"kind": "Type",
|
||||
"whitespaceBefore": true
|
||||
}
|
||||
@ -62,7 +79,7 @@ const b = function () { return 1 }
|
||||
"text": "number"
|
||||
}
|
||||
],
|
||||
"position": 162,
|
||||
"position": 200,
|
||||
"kind": "Type",
|
||||
"whitespaceBefore": true
|
||||
}
|
||||
@ -79,7 +96,7 @@ const c = (b) => 1
|
||||
"text": "number"
|
||||
}
|
||||
],
|
||||
"position": 189,
|
||||
"position": 227,
|
||||
"kind": "Type",
|
||||
"whitespaceBefore": true
|
||||
}
|
||||
@ -12,6 +12,9 @@
|
||||
//// foo() {
|
||||
//// return 1
|
||||
//// }
|
||||
//// bar() {
|
||||
//// return this
|
||||
//// }
|
||||
//// }
|
||||
|
||||
//// const a = () => 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user