Skip to content

Commit df8d755

Browse files
authored
Prefer global over object members completions after ... (#57542)
1 parent 65de938 commit df8d755

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/services/completions.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4322,6 +4322,7 @@ function getCompletionData(
43224322
* @returns true if 'symbols' was successfully populated; false otherwise.
43234323
*/
43244324
function tryGetObjectLikeCompletionSymbols(): GlobalsSearch | undefined {
4325+
if (contextToken?.kind === SyntaxKind.DotDotDotToken) return GlobalsSearch.Continue;
43254326
const symbolsStartIndex = symbols.length;
43264327
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile);
43274328
if (!objectLikeContainer) return GlobalsSearch.Continue;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// // https://github.com./microsoft/TypeScript/issues/57540
4+
////
5+
//// const foo = { b: 100 };
6+
////
7+
//// const bar: {
8+
//// a: number;
9+
//// b: number;
10+
//// } = {
11+
//// a: 42,
12+
//// .../*1*/
13+
//// };
14+
15+
verify.completions({ marker: "1", includes: ["foo"], excludes: ["b"] });

0 commit comments

Comments
 (0)