mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
adding the data relative to the diagnostic error codes in the typescript extension
This commit is contained in:
parent
cb94a70e1f
commit
b4801aeb02
|
@ -8,6 +8,7 @@ import { DiagnosticLanguage } from '../configuration/languageDescription';
|
|||
import * as arrays from '../utils/arrays';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { ResourceMap } from '../utils/resourceMap';
|
||||
import { TelemetryReporter } from '../logging/telemetry';
|
||||
|
||||
function diagnosticsEquals(a: vscode.Diagnostic, b: vscode.Diagnostic): boolean {
|
||||
if (a === b) {
|
||||
|
@ -153,11 +154,13 @@ export class DiagnosticsManager extends Disposable {
|
|||
private readonly _settings = new DiagnosticSettings();
|
||||
private readonly _currentDiagnostics: vscode.DiagnosticCollection;
|
||||
private readonly _pendingUpdates: ResourceMap<any>;
|
||||
private readonly _telemetryReporter: TelemetryReporter;
|
||||
|
||||
private readonly _updateDelay = 50;
|
||||
|
||||
constructor(
|
||||
owner: string,
|
||||
telemetryReporter: TelemetryReporter,
|
||||
onCaseInsensitiveFileSystem: boolean
|
||||
) {
|
||||
super();
|
||||
|
@ -165,6 +168,7 @@ export class DiagnosticsManager extends Disposable {
|
|||
this._pendingUpdates = new ResourceMap<any>(undefined, { onCaseInsensitiveFileSystem });
|
||||
|
||||
this._currentDiagnostics = this._register(vscode.languages.createDiagnosticCollection(owner));
|
||||
this._telemetryReporter = telemetryReporter;
|
||||
}
|
||||
|
||||
public override dispose() {
|
||||
|
@ -238,7 +242,29 @@ export class DiagnosticsManager extends Disposable {
|
|||
}
|
||||
|
||||
public getDiagnostics(file: vscode.Uri): ReadonlyArray<vscode.Diagnostic> {
|
||||
return this._currentDiagnostics.get(file) || [];
|
||||
const diagnostics = this._currentDiagnostics.get(file) || [];
|
||||
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;
|
||||
}, []).sort();
|
||||
/* __GDPR__
|
||||
"typescript.diagnostics" : {
|
||||
"owner": "@aiday-mar",
|
||||
"diagnosticCodes" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" },
|
||||
"${include}": [
|
||||
"${TypeScriptCommonProperties}"
|
||||
]
|
||||
}
|
||||
*/
|
||||
this._telemetryReporter.logTelemetry('typescript.diagnostics', {
|
||||
diagnoticCodes: diagnoticCodes.join(', ')
|
||||
});
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
private scheduleDiagnosticsUpdate(file: vscode.Uri) {
|
||||
|
|
|
@ -176,7 +176,6 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||
this.bufferSyncSupport = new BufferSyncSupport(this, allModeIds, onCaseInsenitiveFileSystem);
|
||||
this.onReady(() => { this.bufferSyncSupport.listen(); });
|
||||
|
||||
this.diagnosticsManager = new DiagnosticsManager('typescript', onCaseInsenitiveFileSystem);
|
||||
this.bufferSyncSupport.onDelete(resource => {
|
||||
this.cancelInflightRequestsForResource(resource);
|
||||
this.diagnosticsManager.deleteAllDiagnosticsInFile(resource);
|
||||
|
@ -213,7 +212,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||
}
|
||||
return this.apiVersion.fullVersionString;
|
||||
});
|
||||
|
||||
this.diagnosticsManager = new DiagnosticsManager('typescript', 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 => {
|
||||
|
|
Loading…
Reference in a new issue