Changes from CR feedback

This commit is contained in:
Jason Ramsay 2016-08-26 16:37:31 -07:00
parent 1f9f20f043
commit 7d3f22fc66
4 changed files with 5 additions and 12 deletions

View File

@ -294,6 +294,7 @@ namespace ts.server {
let shouldRefreshInferredProjects = false;
for (const p of projects) {
if (!p.updateGraph()) {
this.typingsCache.invalidateCachedTypingsForProject(p);
shouldRefreshInferredProjects = true;
}
}

View File

@ -355,9 +355,6 @@ namespace ts.server {
removed.push(id);
}
}
if (added.length > 0 || removed.length > 0) {
this.projectService.typingsCache.invalidateCachedTypingsForProject(this);
}
this.lastReportedFileNames = currentFiles;
this.lastReportedFileNames = currentFiles;

View File

@ -114,7 +114,7 @@ namespace ts.server.typingsInstaller {
protected runInstall(cachePath: string, typingsToInstall: string[], postInstallAction: (installedTypings: string[]) => void): void {
const id = this.installRunCount;
this.installRunCount++;
const command = `npm install @types/${typingsToInstall.join(" @types/")} --save-dev`;
const command = `npm install ${typingsToInstall.map(t => "@types/" + t)} --save-dev`;
if (this.log.isEnabled()) {
this.log.writeLine(`Running npm install @types ${id}, command '${command}'. cache path '${cachePath}'`);
}

View File

@ -19,12 +19,7 @@ namespace ts.server.typingsInstaller {
function typingToFileName(cachePath: string, packageName: string, installTypingHost: InstallTypingHost): string {
const result = resolveModuleName(packageName, combinePaths(cachePath, "index.d.ts"), { moduleResolution: ModuleResolutionKind.NodeJs }, installTypingHost);
return result.resolvedModule ? result.resolvedModule.resolvedFileName : null;
}
function getPackageName(typingFile: string) {
const idx = typingFile.lastIndexOf("/");
return idx > 0 ? typingFile.substr(idx + 1) : undefined;
return result.resolvedModule && result.resolvedModule.resolvedFileName;
}
export abstract class TypingsInstaller {
@ -137,7 +132,7 @@ namespace ts.server.typingsInstaller {
if (npmConfig.devDependencies) {
for (const key in npmConfig.devDependencies) {
// key is @types/<package name>
const packageName = getPackageName(key);
const packageName = getBaseFileName(key);
if (!packageName) {
continue;
}
@ -199,7 +194,7 @@ namespace ts.server.typingsInstaller {
const installedPackages: Map<true> = createMap<true>();
const installedTypingFiles: string[] = [];
for (const t of installedTypings) {
const packageName = getPackageName(t);
const packageName = getBaseFileName(t);
if (!packageName) {
continue;
}