Skip to content

Commit

Permalink
add DiagnosticChangeEvent #30075
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Mar 14, 2018
1 parent 2f4dede commit ec091c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ declare module 'vscode' {
all(): [Uri, Diagnostic[]][];
}

export interface DiagnosticChangeEvent {
uris: Uri[];
}

export namespace languages {

/**
*
*/
export const onDidChangeDiagnostics: Event<Uri[]>;
export const onDidChangeDiagnostics: Event<DiagnosticChangeEvent>;

export const diagnostics: DiagnosticInformation;
}
Expand Down
12 changes: 6 additions & 6 deletions src/vs/workbench/api/node/extHostDiagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,26 +239,26 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
}
}

static _mapper(last: (vscode.Uri | string)[]): vscode.Uri[] {
let res: vscode.Uri[] = [];
static _mapper(last: (vscode.Uri | string)[]): { uris: vscode.Uri[] } {
let uris: vscode.Uri[] = [];
let map = new Set<string>();
for (const uri of last) {
if (typeof uri === 'string') {
if (!map.has(uri)) {
map.add(uri);
res.push(URI.parse(uri));
uris.push(URI.parse(uri));
}
} else {
if (!map.has(uri.toString())) {
map.add(uri.toString());
res.push(uri);
uris.push(uri);
}
}
}
return res;
return { uris };
}

readonly onDidChangeDiagnostics: Event<vscode.Uri[]> = mapEvent(debounceEvent(this._onDidChangeDiagnostics.event, ExtHostDiagnostics._debouncer, 50), ExtHostDiagnostics._mapper);
readonly onDidChangeDiagnostics: Event<vscode.DiagnosticChangeEvent> = mapEvent(debounceEvent(this._onDidChangeDiagnostics.event, ExtHostDiagnostics._debouncer, 50), ExtHostDiagnostics._mapper);

constructor(mainContext: IMainContext) {
this._proxy = mainContext.getProxy(MainContext.MainThreadDiagnostics);
Expand Down

0 comments on commit ec091c2

Please sign in to comment.