mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
cleaning the code
This commit is contained in:
@@ -112,6 +112,7 @@ export interface TypeScriptServiceConfiguration {
|
||||
readonly useSyntaxServer: SyntaxServerConfiguration;
|
||||
readonly webProjectWideIntellisenseEnabled: boolean;
|
||||
readonly webProjectWideIntellisenseSuppressSemanticErrors: boolean;
|
||||
readonly enableDiagnosticsTelemetry: boolean;
|
||||
readonly enableProjectDiagnostics: boolean;
|
||||
readonly maxTsServerMemory: number;
|
||||
readonly enablePromptUseWorkspaceTsdk: boolean;
|
||||
@@ -144,6 +145,7 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
useSyntaxServer: this.readUseSyntaxServer(configuration),
|
||||
webProjectWideIntellisenseEnabled: this.readWebProjectWideIntellisenseEnable(configuration),
|
||||
webProjectWideIntellisenseSuppressSemanticErrors: this.readWebProjectWideIntellisenseSuppressSemanticErrors(configuration),
|
||||
enableDiagnosticsTelemetry: this.readEnableDiagnosticsTelemetry(configuration),
|
||||
enableProjectDiagnostics: this.readEnableProjectDiagnostics(configuration),
|
||||
maxTsServerMemory: this.readMaxTsServerMemory(configuration),
|
||||
enablePromptUseWorkspaceTsdk: this.readEnablePromptUseWorkspaceTsdk(configuration),
|
||||
@@ -197,6 +199,10 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
return SyntaxServerConfiguration.Never;
|
||||
}
|
||||
|
||||
protected readEnableDiagnosticsTelemetry(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.enableDiagnosticsTelemetry', false);
|
||||
}
|
||||
|
||||
protected readEnableProjectDiagnostics(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.tsserver.experimental.enableProjectDiagnostics', false);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Disposable } from '../utils/dispose';
|
||||
import { ResourceMap } from '../utils/resourceMap';
|
||||
import { TelemetryReporter } from '../logging/telemetry';
|
||||
import { URI } from 'vscode-uri';
|
||||
import { diff } from 'semver';
|
||||
import { TypeScriptServiceConfiguration } from '../configuration/configuration';
|
||||
|
||||
function diagnosticsEquals(a: vscode.Diagnostic, b: vscode.Diagnostic): boolean {
|
||||
if (a === b) {
|
||||
@@ -151,18 +151,6 @@ class DiagnosticSettings {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
const diagnostics = this.getDiagnostics(document.uri);
|
||||
const diagnoticCodes = diagnostics.reduce(function (result: number[], d: vscode.Diagnostic) {
|
||||
const code = d.code;
|
||||
if (typeof code === 'string' || typeof code === 'number') {
|
||||
result.push(Number(code));
|
||||
} else if (code !== undefined) {
|
||||
result.push(Number(code.value));
|
||||
}
|
||||
return result;
|
||||
}, []);
|
||||
*/
|
||||
class DiagnosticsTelemetryManager extends Disposable {
|
||||
|
||||
private readonly _timeOutDiagnosticMaps = new Map<URI, NodeJS.Timeout | undefined>();
|
||||
@@ -245,6 +233,7 @@ export class DiagnosticsManager extends Disposable {
|
||||
|
||||
constructor(
|
||||
owner: string,
|
||||
configuration: TypeScriptServiceConfiguration,
|
||||
telemetryReporter: TelemetryReporter,
|
||||
onCaseInsensitiveFileSystem: boolean
|
||||
) {
|
||||
@@ -253,7 +242,7 @@ export class DiagnosticsManager extends Disposable {
|
||||
this._pendingUpdates = new ResourceMap<any>(undefined, { onCaseInsensitiveFileSystem });
|
||||
|
||||
this._currentDiagnostics = this._register(vscode.languages.createDiagnosticCollection(owner));
|
||||
if (Math.random() * 1000 <= 1) {
|
||||
if (Math.random() * 1000 <= 1 || configuration.enableDiagnosticsTelemetry) {
|
||||
this._register(new DiagnosticsTelemetryManager(telemetryReporter, this.getDiagnostics));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
}
|
||||
return this.apiVersion.fullVersionString;
|
||||
});
|
||||
this.diagnosticsManager = new DiagnosticsManager('typescript', this.telemetryReporter, onCaseInsenitiveFileSystem);
|
||||
this.diagnosticsManager = new DiagnosticsManager('typescript', this._configuration, this.telemetryReporter, onCaseInsenitiveFileSystem);
|
||||
this.typescriptServerSpawner = new TypeScriptServerSpawner(this.versionProvider, this._versionManager, this.logDirectoryProvider, this.pluginPathsProvider, this.logger, this.telemetryReporter, this.tracer, this.processFactory);
|
||||
|
||||
this._register(this.pluginManager.onDidUpdateConfig(update => {
|
||||
|
||||
Reference in New Issue
Block a user