Skip to content

Commit db5f519

Browse files
authored
fix(31126): show completions in nested namespace name (#39663)
1 parent d896353 commit db5f519

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/services/completions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,13 +1162,12 @@ namespace ts.Completions {
11621162
|| isPartOfTypeNode(node.parent)
11631163
|| isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
11641164
const isRhsOfImportDeclaration = isInRightSideOfInternalImportEqualsDeclaration(node);
1165-
if (isEntityName(node) || isImportType) {
1165+
if (isEntityName(node) || isImportType || isPropertyAccessExpression(node)) {
11661166
const isNamespaceName = isModuleDeclaration(node.parent);
11671167
if (isNamespaceName) isNewIdentifierLocation = true;
11681168
let symbol = typeChecker.getSymbolAtLocation(node);
11691169
if (symbol) {
11701170
symbol = skipAlias(symbol, typeChecker);
1171-
11721171
if (symbol.flags & (SymbolFlags.Module | SymbolFlags.Enum)) {
11731172
// Extract module or enum members
11741173
const exportedSymbols = typeChecker.getExportsOfModule(symbol);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////namespace A {
4+
//// export namespace B {
5+
//// export interface C {}
6+
//// }
7+
////}
8+
////
9+
////interface T1 extends A/*1*/
10+
////
11+
////declare const t2: A/*2*/
12+
////
13+
////const t3 = (x: A/*3*/) => {}
14+
////
15+
////interface T4 {
16+
//// c: A/*4*/
17+
////}
18+
19+
for (const marker of test.markers()) {
20+
goTo.marker(marker);
21+
edit.insert(".");
22+
verify.completions({ exact: ["B"] });
23+
edit.insert("B.");
24+
verify.completions({ exact: ["C"] });
25+
edit.insert("C.");
26+
verify.completions({ exact: undefined });
27+
}

0 commit comments

Comments
 (0)