提交 8b61c15d 编写于 作者: M Matt Bierner

Use per-resource settings for js/ts validate.enable

For #78549 but requires more work
上级 2c4790d4
......@@ -310,8 +310,6 @@ export default class BufferSyncSupport extends Disposable {
private readonly client: ITypeScriptServiceClient;
private _validateJavaScript: boolean = true;
private _validateTypeScript: boolean = true;
private readonly modeIds: Set<string>;
private readonly syncedBuffers: SyncedBufferMap;
private readonly pendingDiagnostics: PendingDiagnostics;
......@@ -334,9 +332,6 @@ export default class BufferSyncSupport extends Disposable {
this.syncedBuffers = new SyncedBufferMap(pathNormalizer);
this.pendingDiagnostics = new PendingDiagnostics(pathNormalizer);
this.synchronizer = new BufferSynchronizer(client);
this.updateConfiguration();
vscode.workspace.onDidChangeConfiguration(this.updateConfiguration, this, this._disposables);
}
private readonly _onDelete = this._register(new vscode.EventEmitter<vscode.Uri>());
......@@ -511,22 +506,20 @@ export default class BufferSyncSupport extends Disposable {
this.pendingDiagnostics.clear();
}
private updateConfiguration() {
const jsConfig = vscode.workspace.getConfiguration('javascript', null);
const tsConfig = vscode.workspace.getConfiguration('typescript', null);
this._validateJavaScript = jsConfig.get<boolean>('validate.enable', true);
this._validateTypeScript = tsConfig.get<boolean>('validate.enable', true);
}
private shouldValidate(buffer: SyncedBuffer) {
switch (buffer.kind) {
case BufferKind.JavaScript:
return this._validateJavaScript;
{
const config = vscode.workspace.getConfiguration('javascript', buffer.resource);
return config.get<boolean>('validate.enable', true);
}
case BufferKind.TypeScript:
default:
return this._validateTypeScript;
{
const config = vscode.workspace.getConfiguration('typescript', buffer.resource);
return config.get<boolean>('validate.enable', true);
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册