mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
Changes from CR feedback
This commit is contained in:
parent
1f9f20f043
commit
7d3f22fc66
@ -294,6 +294,7 @@ namespace ts.server {
|
||||
let shouldRefreshInferredProjects = false;
|
||||
for (const p of projects) {
|
||||
if (!p.updateGraph()) {
|
||||
this.typingsCache.invalidateCachedTypingsForProject(p);
|
||||
shouldRefreshInferredProjects = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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}'`);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user