diff --git a/src/services/completions.ts b/src/services/completions.ts index 290ba49656343..0e4075150830e 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -4322,6 +4322,7 @@ function getCompletionData( * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetObjectLikeCompletionSymbols(): GlobalsSearch | undefined { + if (contextToken?.kind === SyntaxKind.DotDotDotToken) return GlobalsSearch.Continue; const symbolsStartIndex = symbols.length; const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile); if (!objectLikeContainer) return GlobalsSearch.Continue; diff --git a/tests/cases/fourslash/completionsDotDotDotInObjectLiteral1.ts b/tests/cases/fourslash/completionsDotDotDotInObjectLiteral1.ts new file mode 100644 index 0000000000000..e5e264a278d9a --- /dev/null +++ b/tests/cases/fourslash/completionsDotDotDotInObjectLiteral1.ts @@ -0,0 +1,15 @@ +/// + +//// // https://github.com/microsoft/TypeScript/issues/57540 +//// +//// const foo = { b: 100 }; +//// +//// const bar: { +//// a: number; +//// b: number; +//// } = { +//// a: 42, +//// .../*1*/ +//// }; + +verify.completions({ marker: "1", includes: ["foo"], excludes: ["b"] });