提交 0e18b053 编写于 作者: S Simon Chan 提交者: Matt Bierner

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

* Automatically restart ts server after disableAutomaticTypeAcquisition config changed

* Change to LF
上级 0af0d492
......@@ -4,7 +4,7 @@
"configuration.typescript": "TypeScript",
"typescript.useCodeSnippetsOnMethodSuggest.dec": "Complete functions with their parameter signature.",
"typescript.tsdk.desc": "Specifies the folder path containing the tsserver and lib*.d.ts files to use.",
"typescript.disableAutomaticTypeAcquisition": "Disables automatic type acquisition. Requires TypeScript >= 2.0.6 and a restart after changing it.",
"typescript.disableAutomaticTypeAcquisition": "Disables automatic type acquisition. Requires TypeScript >= 2.0.6.",
"typescript.tsserver.log": "Enables logging of the TS server to a file. This log can be used to diagnose TS Server issues. The log may contain file paths, source code, and other potentially sensitive information from your project.",
"typescript.tsserver.trace": "Enables tracing of messages sent to the TS server. This trace can be used to diagnose TS Server issues. The trace may contain file paths, source code, and other potentially sensitive information from your project.",
"typescript.validate.enable": "Enable/disable TypeScript validation.",
......
......@@ -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');
}
}
......
......@@ -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);
}
}
\ No newline at end of file
private static readDisableAutomaticTypeAcquisition(configuration: WorkspaceConfiguration): boolean {
return configuration.get<boolean>('typescript.disableAutomaticTypeAcquisition', false);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册