Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaSolOs committed Aug 17, 2023
1 parent 9a20d7e commit 3fdba53
Show file tree
Hide file tree
Showing 23 changed files with 562 additions and 18 deletions.
8 changes: 8 additions & 0 deletions src/services/inlayHints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {
Node,
NodeArray,
NodeBuilderFlags,
NumericLiteral,
OptionalTypeNode,
ParameterDeclaration,
ParenthesizedTypeNode,
Expand All @@ -81,6 +82,7 @@ import {
skipParentheses,
some,
SourceFile,
StringLiteral,
Symbol,
SymbolFlags,
SyntaxKind,
Expand Down Expand Up @@ -483,6 +485,12 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
parts.push({ text: identifierText });
}
break;
case SyntaxKind.NumericLiteral:
parts.push({ text: (node as NumericLiteral).text });
break;
case SyntaxKind.StringLiteral:
parts.push({ text: `"${(node as StringLiteral).text}"` });
break;
case SyntaxKind.QualifiedName:
const qualifiedName = node as QualifiedName;
visitDisplayPart(qualifiedName.left);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ foo(1);
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter1.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter1.ts"
},
{
"text": ":"
Expand All @@ -34,7 +34,7 @@ foo('');
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter1.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter1.ts"
},
{
"text": ":"
Expand All @@ -56,7 +56,7 @@ foo(true);
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter1.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter1.ts"
},
{
"text": ":"
Expand All @@ -78,7 +78,7 @@ foo((1));
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter1.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter1.ts"
},
{
"text": ":"
Expand All @@ -100,7 +100,7 @@ foo(foo(1));
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter1.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter1.ts"
},
{
"text": ":"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ foo(1);
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -34,7 +34,7 @@ foo('');
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -56,7 +56,7 @@ foo(true);
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -78,7 +78,7 @@ foo(() => 1);
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -100,7 +100,7 @@ foo(function () { return 1 });
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -122,7 +122,7 @@ foo({});
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -144,7 +144,7 @@ foo({ a: 1 });
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -166,7 +166,7 @@ foo([]);
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -188,7 +188,7 @@ foo([1]);
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -210,7 +210,7 @@ foo(foo);
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -232,7 +232,7 @@ foo((1));
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -254,7 +254,7 @@ foo(foo(1));
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand All @@ -276,7 +276,7 @@ foo(foo(1));
"start": 14,
"length": 1
},
"file": "/tests/cases/fourslash/inlayHintsInterativeAnyParameter2.ts"
"file": "/tests/cases/fourslash/inlayHintsInteractiveAnyParameter2.ts"
},
{
"text": ":"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const f1: F1 = (a, b) => { }
^
{
"text": ": string",
"position": 58,
"kind": "Type",
"whitespaceBefore": true
}

const f1: F1 = (a, b) => { }
^
{
"text": ": number",
"position": 61,
"kind": "Type",
"whitespaceBefore": true
}

const f2: F1 = (a, b: number) => { }
^
{
"text": ": string",
"position": 87,
"kind": "Type",
"whitespaceBefore": true
}

foo1((a) => { })
^
{
"text": ": string",
"position": 157,
"kind": "Type",
"whitespaceBefore": true
}

foo2((a) => { })
^
{
"text": ": 2 | 3",
"position": 232,
"kind": "Type",
"whitespaceBefore": true
}

foo3(a => {
^
{
"text": ": (c: (d: 2 | 3) => void) => void",
"position": 331,
"kind": "Type",
"whitespaceBefore": true
}

a(d => {})
^
{
"text": ": 2 | 3",
"position": 344,
"kind": "Type",
"whitespaceBefore": true
}

foo4(1, a => { })
^
{
"text": ": number",
"position": 409,
"kind": "Type",
"whitespaceBefore": true
}

const foo5: F2 = (a) => { }
^
{
"text": ": { a: number; b: string; }",
"position": 492,
"kind": "Type",
"whitespaceBefore": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
=== No inlay hints ===
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
bar: function (x?): void {
^
{
"text": ": boolean",
"position": 87,
"kind": "Type",
"whitespaceBefore": true
}

set foo(value) { this.#value = value; }
^
{
"text": ": number",
"position": 250,
"kind": "Type",
"whitespaceBefore": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
=== No inlay hints ===
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
=== No inlay hints ===
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function bar () { return require('./a').a; }
^
{
"text": "",
"displayParts": [
{
"text": ": "
},
{
"text": "1"
}
],
"position": 58,
"kind": "Type",
"whitespaceBefore": true
}

const d = bar()
^
{
"text": "",
"displayParts": [
{
"text": ": "
},
{
"text": "1"
}
],
"position": 111,
"kind": "Type",
"whitespaceBefore": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
y.foo(1, 2)
^
{
"text": "",
"position": 88,
"kind": "Parameter",
"whitespaceAfter": true,
"displayParts": [
{
"text": "a",
"span": {
"start": 40,
"length": 1
},
"file": "/a.js"
},
{
"text": ":"
}
]
}

y.foo(1, 2)
^
{
"text": "",
"position": 91,
"kind": "Parameter",
"whitespaceAfter": true,
"displayParts": [
{
"text": "b",
"span": {
"start": 51,
"length": 1
},
"file": "/a.js"
},
{
"text": ":"
}
]
}
Loading

0 comments on commit 3fdba53

Please sign in to comment.