Expose ProjectService to plugins (#23824)

Add refreshDiagnostics() method to Project
This commit is contained in:
Andy
2018-05-07 12:38:38 -07:00
committed by GitHub
parent e39e6fc780
commit 05b250691f
3 changed files with 11 additions and 4 deletions

View File

@@ -577,7 +577,8 @@ namespace ts.server {
return this.pendingProjectUpdates.has(project.getProjectName());
}
private sendProjectsUpdatedInBackgroundEvent() {
/* @internal */
sendProjectsUpdatedInBackgroundEvent() {
if (!this.eventHandler) {
return;
}

View File

@@ -164,7 +164,7 @@ namespace ts.server {
return hasOneOrMoreJsAndNoTsFiles(this);
}
public static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} {
public static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined {
const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules")));
log(`Loading ${moduleName} from ${initialDir} (resolved to ${resolvedPath})`);
const result = host.require(resolvedPath, moduleName);
@@ -1102,6 +1102,11 @@ namespace ts.server {
}
}
/** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */
refreshDiagnostics() {
this.projectService.sendProjectsUpdatedInBackgroundEvent();
}
private enableProxy(pluginModuleFactory: PluginModuleFactory, configEntry: PluginImport) {
try {
if (typeof pluginModuleFactory !== "function") {