mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 12:32:08 -06:00
fix(50796): omit questionToken in object literal method completions (#50802)
This commit is contained in:
parent
3b84f76fb2
commit
01cae69e34
@ -1171,7 +1171,7 @@ namespace ts.Completions {
|
||||
/*modifiers*/ undefined,
|
||||
typedParam.dotDotDotToken,
|
||||
typedParam.name,
|
||||
typedParam.questionToken,
|
||||
/*questionToken*/ undefined,
|
||||
/*type*/ undefined,
|
||||
typedParam.initializer,
|
||||
));
|
||||
|
||||
38
tests/cases/fourslash/completionsObjectLiteralMethod5.ts
Normal file
38
tests/cases/fourslash/completionsObjectLiteralMethod5.ts
Normal file
@ -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)",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user