mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
sending diagnostics on file open
This commit is contained in:
@@ -154,7 +154,6 @@ 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;
|
||||
|
||||
@@ -168,7 +167,30 @@ export class DiagnosticsManager extends Disposable {
|
||||
this._pendingUpdates = new ResourceMap<any>(undefined, { onCaseInsensitiveFileSystem });
|
||||
|
||||
this._currentDiagnostics = this._register(vscode.languages.createDiagnosticCollection(owner));
|
||||
this._telemetryReporter = telemetryReporter;
|
||||
this._register(vscode.workspace.onDidOpenTextDocument((document) => {
|
||||
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;
|
||||
}, []).sort();
|
||||
/* __GDPR__
|
||||
"typescript.diagnostics" : {
|
||||
"owner": "@aiday-mar",
|
||||
"diagnosticCodes" : { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" },
|
||||
"${include}": [
|
||||
"${TypeScriptCommonProperties}"
|
||||
]
|
||||
}
|
||||
*/
|
||||
telemetryReporter.logTelemetry('typescript.diagnostics', {
|
||||
diagnoticCodes: diagnoticCodes.join(', ')
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public override dispose() {
|
||||
@@ -242,29 +264,7 @@ export class DiagnosticsManager extends Disposable {
|
||||
}
|
||||
|
||||
public getDiagnostics(file: vscode.Uri): ReadonlyArray<vscode.Diagnostic> {
|
||||
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;
|
||||
return this._currentDiagnostics.get(file) || [];
|
||||
}
|
||||
|
||||
private scheduleDiagnosticsUpdate(file: vscode.Uri) {
|
||||
|
||||
@@ -468,6 +468,9 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
}
|
||||
this.serviceExited(!this.isRestarting);
|
||||
this.isRestarting = false;
|
||||
|
||||
// TODO: on handle exit, we need to send the typescript errors that we have accumulated
|
||||
console.log('on handle exit');
|
||||
});
|
||||
|
||||
handle.onEvent(event => this.dispatchEvent(event));
|
||||
@@ -579,6 +582,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: service exited will close the client service, is this the one that we need to monitor?
|
||||
private serviceExited(restart: boolean): void {
|
||||
this.loadingIndicator.reset();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user