mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Completion for default export should be '.default' (#16742)
* Completion for default export should be '.default' * Don't include empty string in name table * getSymbolsInScope() should return local symbols, not exported symbols * Fix bug: getSymbolAtLocation should work for local symbol too
This commit is contained in:
@@ -11875,6 +11875,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getTypeOfSymbolAtLocation(symbol: Symbol, location: Node) {
|
||||
symbol = symbol.exportSymbol || symbol;
|
||||
|
||||
// If we have an identifier or a property access at the given location, if the location is
|
||||
// an dotted name expression, and if the location is not an assignment target, obtain the type
|
||||
// of the expression (which will reflect control flow analysis). If the expression indeed
|
||||
@@ -22281,11 +22283,6 @@ namespace ts {
|
||||
}
|
||||
|
||||
switch (location.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
if (!isExternalOrCommonJsModule(<SourceFile>location)) {
|
||||
break;
|
||||
}
|
||||
// falls through
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
copySymbols(getSymbolOfNode(location).exports, meaning & SymbolFlags.ModuleMember);
|
||||
break;
|
||||
@@ -22337,7 +22334,7 @@ namespace ts {
|
||||
* @param meaning meaning of symbol to filter by before adding to symbol table
|
||||
*/
|
||||
function copySymbol(symbol: Symbol, meaning: SymbolFlags): void {
|
||||
if (symbol.flags & meaning) {
|
||||
if (getCombinedLocalAndExportSymbolFlags(symbol) & meaning) {
|
||||
const id = symbol.name;
|
||||
// We will copy all symbol regardless of its reserved name because
|
||||
// symbolsToArray will check whether the key is a reserved name and
|
||||
|
||||
@@ -3598,6 +3598,11 @@ namespace ts {
|
||||
}
|
||||
return previous[previous.length - 1];
|
||||
}
|
||||
|
||||
/** See comment on `declareModuleMember` in `binder.ts`. */
|
||||
export function getCombinedLocalAndExportSymbolFlags(symbol: Symbol): SymbolFlags {
|
||||
return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ts {
|
||||
|
||||
Reference in New Issue
Block a user