Automatically restart ts server after disableAutomaticTypeAcquisition config changed (#32412)

* Automatically restart ts server after disableAutomaticTypeAcquisition config changed

* Change to LF
This commit is contained in:
Simon Chan
2017-08-17 07:43:40 +08:00
committed by Matt Bierner
parent 0af0d49222
commit 0e18b0533f
3 changed files with 11 additions and 4 deletions

View File

@@ -332,7 +332,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
const args: string[] = [];
if (this.apiVersion.has206Features()) {
args.push('--useSingleInferredProject');
if (workspace.getConfiguration().get<boolean>('typescript.disableAutomaticTypeAcquisition', false)) {
if (this.configuration.disableAutomaticTypeAcquisition) {
args.push('--disableAutomaticTypingAcquisition');
}
}

View File

@@ -47,6 +47,7 @@ export class TypeScriptServiceConfiguration {
public readonly npmLocation: string | null;
public readonly tsServerLogLevel: TsServerLogLevel = TsServerLogLevel.Off;
public readonly checkJs: boolean;
public readonly disableAutomaticTypeAcquisition: boolean;
public static loadFromWorkspace(): TypeScriptServiceConfiguration {
return new TypeScriptServiceConfiguration();
@@ -60,6 +61,7 @@ export class TypeScriptServiceConfiguration {
this.npmLocation = TypeScriptServiceConfiguration.readNpmLocation(configuration);
this.tsServerLogLevel = TypeScriptServiceConfiguration.readTsServerLogLevel(configuration);
this.checkJs = TypeScriptServiceConfiguration.readCheckJs(configuration);
this.disableAutomaticTypeAcquisition = TypeScriptServiceConfiguration.readDisableAutomaticTypeAcquisition(configuration);
}
public isEqualTo(other: TypeScriptServiceConfiguration): boolean {
@@ -67,7 +69,8 @@ export class TypeScriptServiceConfiguration {
&& this.localTsdk === other.localTsdk
&& this.npmLocation === other.npmLocation
&& this.tsServerLogLevel === other.tsServerLogLevel
&& this.checkJs === other.checkJs;
&& this.checkJs === other.checkJs
&& this.disableAutomaticTypeAcquisition === other.disableAutomaticTypeAcquisition;
}
private static extractGlobalTsdk(configuration: WorkspaceConfiguration): string | null {
@@ -98,4 +101,8 @@ export class TypeScriptServiceConfiguration {
private static readNpmLocation(configuration: WorkspaceConfiguration): string | null {
return configuration.get<string | null>('typescript.npm', null);
}
}
private static readDisableAutomaticTypeAcquisition(configuration: WorkspaceConfiguration): boolean {
return configuration.get<boolean>('typescript.disableAutomaticTypeAcquisition', false);
}
}