Skip to content

Commit

Permalink
fix(31126): show completions in nested namespace name (#39663)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk authored Sep 3, 2020
1 parent d896353 commit db5f519
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/services/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1162,13 +1162,12 @@ namespace ts.Completions {
|| isPartOfTypeNode(node.parent)
|| isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
const isRhsOfImportDeclaration = isInRightSideOfInternalImportEqualsDeclaration(node);
if (isEntityName(node) || isImportType) {
if (isEntityName(node) || isImportType || isPropertyAccessExpression(node)) {
const isNamespaceName = isModuleDeclaration(node.parent);
if (isNamespaceName) isNewIdentifierLocation = true;
let symbol = typeChecker.getSymbolAtLocation(node);
if (symbol) {
symbol = skipAlias(symbol, typeChecker);

if (symbol.flags & (SymbolFlags.Module | SymbolFlags.Enum)) {
// Extract module or enum members
const exportedSymbols = typeChecker.getExportsOfModule(symbol);
Expand Down
27 changes: 27 additions & 0 deletions tests/cases/fourslash/completionListInNestedNamespaceName.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/// <reference path='fourslash.ts'/>

////namespace A {
//// export namespace B {
//// export interface C {}
//// }
////}
////
////interface T1 extends A/*1*/
////
////declare const t2: A/*2*/
////
////const t3 = (x: A/*3*/) => {}
////
////interface T4 {
//// c: A/*4*/
////}

for (const marker of test.markers()) {
goTo.marker(marker);
edit.insert(".");
verify.completions({ exact: ["B"] });
edit.insert("B.");
verify.completions({ exact: ["C"] });
edit.insert("C.");
verify.completions({ exact: undefined });
}

0 comments on commit db5f519

Please sign in to comment.