@@ -1000,6 +1000,7 @@ namespace ts.Completions {
1000
1000
let completionKind = CompletionKind . None ;
1001
1001
let isNewIdentifierLocation = false ;
1002
1002
let keywordFilters = KeywordCompletionFilters . None ;
1003
+ // This also gets mutated in nested-functions after the return
1003
1004
let symbols : Symbol [ ] = [ ] ;
1004
1005
const symbolToOriginInfoMap : SymbolOriginInfoMap = [ ] ;
1005
1006
const symbolToSortTextMap : SymbolSortTextMap = [ ] ;
@@ -1464,7 +1465,7 @@ namespace ts.Completions {
1464
1465
}
1465
1466
1466
1467
/**
1467
- * Gathers symbols that can be imported from other files, deduplicating along the way. Symbols can be “ duplicates”
1468
+ * Gathers symbols that can be imported from other files, de-duplicating along the way. Symbols can be " duplicates"
1468
1469
* if re-exported from another module, e.g. `export { foo } from "./a"`. That syntax creates a fresh symbol, but
1469
1470
* it’s just an alias to the first, and both have the same name, so we generally want to filter those aliases out,
1470
1471
* if and only if the the first can be imported (it may be excluded due to package.json filtering in
@@ -1548,7 +1549,7 @@ namespace ts.Completions {
1548
1549
// Don't add another completion for `export =` of a symbol that's already global.
1549
1550
// So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`.
1550
1551
if ( resolvedModuleSymbol !== moduleSymbol &&
1551
- every ( resolvedModuleSymbol . declarations , d => ! ! d . getSourceFile ( ) . externalModuleIndicator ) ) {
1552
+ every ( resolvedModuleSymbol . declarations , d => ! ! d . getSourceFile ( ) . externalModuleIndicator && ! findAncestor ( d , isGlobalScopeAugmentation ) ) ) {
1552
1553
pushSymbol ( resolvedModuleSymbol , moduleSymbol , /*skipFilter*/ true ) ;
1553
1554
}
1554
1555
0 commit comments