This commit is contained in:
Matt Bierner
2019-06-20 18:15:33 -07:00
parent fd245fcda0
commit 5fc7a8c5c0
3 changed files with 11 additions and 11 deletions

View File

@@ -36,30 +36,30 @@ export class TypeScriptServerSpawner {
pluginManager: PluginManager
): ITypeScriptServer {
if (this.shouldUseSeparateSyntaxServer(version)) {
const syntaxServer = this.spawnProcessBasedTsServer('syntax', version, configuration, pluginManager, ['--syntaxOnly', '--disableAutomaticTypingAcquisition']);
const semanticServer = this.spawnProcessBasedTsServer('semantic', version, configuration, pluginManager, []);
const syntaxServer = this.spawnTsServer('syntax', version, configuration, pluginManager, ['--syntaxOnly', '--disableAutomaticTypingAcquisition']);
const semanticServer = this.spawnTsServer('semantic', version, configuration, pluginManager, []);
return new SyntaxRoutingTsServer(syntaxServer, semanticServer);
}
return this.spawnProcessBasedTsServer('main', version, configuration, pluginManager, []);
return this.spawnTsServer('main', version, configuration, pluginManager, []);
}
private shouldUseSeparateSyntaxServer(version: TypeScriptVersion): boolean {
if (!version.version || version.version.lt(API.v340)) {
if (!version.apiVersion || version.apiVersion.lt(API.v340)) {
return false;
}
return vscode.workspace.getConfiguration('typescript')
.get<boolean>('experimental.useSeparateSyntaxServer', false);
}
private spawnProcessBasedTsServer(
private spawnTsServer(
serverId: string,
version: TypeScriptVersion,
configuration: TypeScriptServiceConfiguration,
pluginManager: PluginManager,
extraForkArgs: readonly string[],
): ITypeScriptServer {
const apiVersion = version.version || API.defaultVersion;
const apiVersion = version.apiVersion || API.defaultVersion;
const { args, cancellationPipeName, tsServerLogFile } = this.getTsServerArgs(configuration, version, apiVersion, pluginManager);

View File

@@ -285,7 +285,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
currentVersion = this.versionPicker.currentVersion;
}
const apiVersion = this.versionPicker.currentVersion.version || API.defaultVersion;
const apiVersion = this.versionPicker.currentVersion.apiVersion || API.defaultVersion;
this.onDidChangeTypeScriptVersion(currentVersion);
let mytoken = ++this.token;
@@ -353,7 +353,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
handle.onEvent(event => this.dispatchEvent(event));
this._onReady!.resolve();
this._onTsServerStarted.fire(currentVersion.version);
this._onTsServerStarted.fire(currentVersion.apiVersion);
if (apiVersion.gte(API.v300)) {
this.loadingIndicator.startedLoadingProject(undefined /* projectName */);

View File

@@ -27,10 +27,10 @@ export class TypeScriptVersion {
}
public get isValid(): boolean {
return this.version !== undefined;
return this.apiVersion !== undefined;
}
public get version(): API | undefined {
public get apiVersion(): API | undefined {
const version = this.getTypeScriptVersion(this.tsServerPath);
if (version) {
return version;
@@ -46,7 +46,7 @@ export class TypeScriptVersion {
}
public get versionString(): string {
const version = this.version;
const version = this.apiVersion;
return version ? version.versionString : localize(
'couldNotLoadTsVersion', 'Could not load the TypeScript version at this path');
}