mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
External module items now display their base file name in quotes.
This commit is contained in:
@@ -521,6 +521,20 @@ module ts {
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
}
|
||||
|
||||
var supportedExtensions = [".d.ts", ".ts", ".js"];
|
||||
export function removeFileExtension(path: string): string {
|
||||
|
||||
for (var i = 0; i < supportedExtensions.length; i++) {
|
||||
var ext = supportedExtensions[i];
|
||||
|
||||
if (fileExtensionIs(path, ext)) {
|
||||
return path.substr(0, path.length - ext.length);
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
export interface ObjectAllocator {
|
||||
getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
|
||||
|
||||
@@ -17,20 +17,13 @@ module ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
var moduleExtensions = [".d.ts", ".ts", ".js"];
|
||||
|
||||
interface ReferenceComments {
|
||||
referencedFiles: FileReference[];
|
||||
amdDependencies: string[];
|
||||
}
|
||||
|
||||
export function getModuleNameFromFilename(filename: string) {
|
||||
for (var i = 0; i < moduleExtensions.length; i++) {
|
||||
var ext = moduleExtensions[i];
|
||||
var len = filename.length - ext.length;
|
||||
if (len > 0 && filename.substr(len) === ext) return filename.substr(0, len);
|
||||
}
|
||||
return filename;
|
||||
return removeFileExtension(filename);
|
||||
}
|
||||
|
||||
export function getSourceFileOfNode(node: Node): SourceFile {
|
||||
|
||||
@@ -195,7 +195,7 @@ module ts {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
var variableDeclaration = <VariableDeclaration>node;
|
||||
return basicChildItem(node, variableDeclaration.name.text, ts.ScriptElementKind.variableElement);
|
||||
|
||||
|
||||
case SyntaxKind.Constructor:
|
||||
return basicChildItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement);
|
||||
}
|
||||
@@ -286,7 +286,11 @@ module ts {
|
||||
}
|
||||
|
||||
hasGlobalNode = true;
|
||||
return new ts.NavigationBarItem("<global>",
|
||||
var rootName = isExternalModule(node) ?
|
||||
"\"" + getBaseFilename(removeFileExtension(normalizePath(node.filename))) + "\"" :
|
||||
"<global>"
|
||||
|
||||
return new ts.NavigationBarItem(rootName,
|
||||
ts.ScriptElementKind.moduleElement,
|
||||
ts.ScriptElementKindModifier.none,
|
||||
[getNodeSpan(node)],
|
||||
|
||||
Reference in New Issue
Block a user