fix(31126): show completions in nested namespace name (#39663)
This commit is contained in:
parent
d89635381a
commit
db5f519514
|
@ -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);
|
||||
|
|
27
tests/cases/fourslash/completionListInNestedNamespaceName.ts
Normal file
27
tests/cases/fourslash/completionListInNestedNamespaceName.ts
Normal file
|
@ -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 });
|
||||
}
|
Loading…
Reference in a new issue