Skip to content

Commit c0e5c80

Browse files
author
Andy
authored
Add exports of current module to getSymbolsInScope (#28442)
1 parent b48c2b2 commit c0e5c80

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27698,8 +27698,11 @@ namespace ts {
2769827698
}
2769927699

2770027700
switch (location.kind) {
27701+
case SyntaxKind.SourceFile:
27702+
if (!isExternalOrCommonJsModule(<SourceFile>location)) break;
27703+
// falls through
2770127704
case SyntaxKind.ModuleDeclaration:
27702-
copySymbols(getSymbolOfNode(location as ModuleDeclaration).exports!, meaning & SymbolFlags.ModuleMember);
27705+
copySymbols(getSymbolOfNode(location as ModuleDeclaration | SourceFile).exports!, meaning & SymbolFlags.ModuleMember);
2770327706
break;
2770427707
case SyntaxKind.EnumDeclaration:
2770527708
copySymbols(getSymbolOfNode(location as EnumDeclaration).exports!, meaning & SymbolFlags.EnumMember);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////declare global {
4+
//// namespace N {
5+
//// const foo: number;
6+
//// }
7+
////}
8+
////export import foo = N.foo;
9+
/////**/
10+
11+
verify.completions({
12+
marker: "",
13+
exact: [
14+
{ name: "foo", kind: "alias", kindModifiers: "export", text: "(alias) const foo: number\nimport foo = N.foo" },
15+
...completion.globalsPlus([{ name: "N", kind: "module", kindModifiers: "declare", text: "namespace N" }]),
16+
],
17+
});

0 commit comments

Comments
 (0)