Use compilation options to get extensions to remove to get module name

This commit is contained in:
Sheetal Nandi 2015-10-08 14:27:02 -07:00
parent f7b72047f0
commit 2d083f7d83
4 changed files with 8 additions and 8 deletions

View file

@ -77,13 +77,13 @@ namespace ts {
IsContainerWithLocals = IsContainer | HasLocals
}
export function bindSourceFile(file: SourceFile) {
export function bindSourceFile(file: SourceFile, compilerOptions: CompilerOptions) {
let start = new Date().getTime();
bindSourceFileWorker(file);
bindSourceFileWorker(file, compilerOptions);
bindTime += new Date().getTime() - start;
}
function bindSourceFileWorker(file: SourceFile) {
function bindSourceFileWorker(file: SourceFile, compilerOptions: CompilerOptions) {
let parent: Node;
let container: Node;
let blockScopeContainer: Node;
@ -941,7 +941,7 @@ namespace ts {
function bindSourceFileIfExternalModule() {
setExportContextFlag(file);
if (isExternalModule(file)) {
bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName)}"`);
bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName, getSupportedExtensions(compilerOptions))}"`);
}
}

View file

@ -14833,7 +14833,7 @@ namespace ts {
function initializeTypeChecker() {
// Bind all source files and propagate errors
forEach(host.getSourceFiles(), file => {
bindSourceFile(file);
bindSourceFile(file, compilerOptions);
});
// Initialize global symbol table

View file

@ -2,7 +2,7 @@
/* @internal */
namespace ts.NavigationBar {
export function getNavigationBarItems(sourceFile: SourceFile): ts.NavigationBarItem[] {
export function getNavigationBarItems(sourceFile: SourceFile, compilerOptions: CompilerOptions): ts.NavigationBarItem[] {
// If the source file has any child items, then it included in the tree
// and takes lexical ownership of all other top-level items.
let hasGlobalNode = false;
@ -442,7 +442,7 @@ namespace ts.NavigationBar {
hasGlobalNode = true;
let rootName = isExternalModule(node)
? "\"" + escapeString(getBaseFileName(removeFileExtension(normalizePath(node.fileName)))) + "\""
? "\"" + escapeString(getBaseFileName(removeFileExtension(normalizePath(node.fileName), getSupportedExtensions(compilerOptions)))) + "\""
: "<global>"
return getNavigationBarItem(rootName,

View file

@ -6263,7 +6263,7 @@ namespace ts {
function getNavigationBarItems(fileName: string): NavigationBarItem[] {
let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return NavigationBar.getNavigationBarItems(sourceFile);
return NavigationBar.getNavigationBarItems(sourceFile, host.getCompilationSettings());
}
function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {