Skip to content

Commit e96cd3b

Browse files
committed
Simplify pendingDiagnostics sort
1 parent 4ba8a1b commit e96cd3b

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

extensions/typescript/src/features/bufferSyncSupport.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export default class BufferSyncSupport {
153153
private readonly disposables: Disposable[] = [];
154154
private readonly syncedBuffers: SyncedBufferMap;
155155

156-
private pendingDiagnostics = new Map<string, number>();
156+
private readonly pendingDiagnostics = new Map<string, number>();
157157
private readonly diagnosticDelayer: Delayer<any>;
158158

159159
constructor(
@@ -271,16 +271,9 @@ export default class BufferSyncSupport {
271271
if (!this._validate) {
272272
return;
273273
}
274-
let files = Array.from(this.pendingDiagnostics.entries()).map(([key, value]) => {
275-
return {
276-
file: key,
277-
time: value
278-
};
279-
}).sort((a, b) => {
280-
return a.time - b.time;
281-
}).map((value) => {
282-
return value.file;
283-
});
274+
const files = Array.from(this.pendingDiagnostics.entries())
275+
.sort((a, b) => a[1] - b[1])
276+
.map(entry => entry[0]);
284277

285278
// Add all open TS buffers to the geterr request. They might be visible
286279
for (const file of this.syncedBuffers.allResources) {

0 commit comments

Comments
 (0)