Skip to content
Permalink
Browse files
fix(50796): omit questionToken in object literal method completions (#…
  • Loading branch information
magic-akari committed Sep 16, 2022
1 parent 3b84f76 commit 01cae69e3403a831bc5c752b95c8b7547dd95821
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
@@ -1171,7 +1171,7 @@ namespace ts.Completions {
/*modifiers*/ undefined,
typedParam.dotDotDotToken,
typedParam.name,
typedParam.questionToken,
/*questionToken*/ undefined,
/*type*/ undefined,
typedParam.initializer,
));
@@ -0,0 +1,38 @@
/// <reference path="fourslash.ts" />

// @newline: LF
// @Filename: a.ts
////interface Foo {
//// method(x?: string): void;
////}
////const foo: Foo = {
//// /*m*/
////}

verify.completions({
marker: "m",
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: true,
includeCompletionsWithObjectLiteralMethodSnippets: true,
useLabelDetailsInCompletionEntries: true,
},
includes: [
{
name: "method",
sortText: completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "method"),
insertText: undefined,
},
{
name: "method",
sortText: completion.SortText.SortBelow(
completion.SortText.ObjectLiteralProperty(completion.SortText.LocationPriority, "method")),
source: completion.CompletionSource.ObjectLiteralMethodSnippet,
isSnippet: true,
insertText: "method(x) {\n $0\n},",
labelDetails: {
detail: "(x)",
},
},
],
});

0 comments on commit 01cae69

Please sign in to comment.