Skip to content

Commit 01cae69

Browse files
authoredSep 16, 2022
fix(50796): omit questionToken in object literal method completions (#50802)
1 parent 3b84f76 commit 01cae69

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed
 

‎src/services/completions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ namespace ts.Completions {
11711171
/*modifiers*/ undefined,
11721172
typedParam.dotDotDotToken,
11731173
typedParam.name,
1174-
typedParam.questionToken,
1174+
/*questionToken*/ undefined,
11751175
/*type*/ undefined,
11761176
typedParam.initializer,
11771177
));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @newline: LF
4+
// @Filename: a.ts
5+
////interface Foo {
6+
//// method(x?: string): void;
7+
////}
8+
////const foo: Foo = {
9+
//// /*m*/
10+
////}
11+
12+
verify.completions({
13+
marker: "m",
14+
preferences: {
15+
includeCompletionsWithInsertText: true,
16+
includeCompletionsWithSnippetText: true,
17+
includeCompletionsWithObjectLiteralMethodSnippets: true,
18+
useLabelDetailsInCompletionEntries: true,
19+
},
20+
includes: [
21+
{
22+
name: "method",
23+
sortText: completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "method"),
24+
insertText: undefined,
25+
},
26+
{
27+
name: "method",
28+
sortText: completion.SortText.SortBelow(
29+
completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "method")),
30+
source: completion.CompletionSource.ObjectLiteralMethodSnippet,
31+
isSnippet: true,
32+
insertText: "method(x) {\n $0\n},",
33+
labelDetails: {
34+
detail: "(x)",
35+
},
36+
},
37+
],
38+
});

0 commit comments

Comments
 (0)
Please sign in to comment.