Add pending commands in queue order

This commit is contained in:
Dirk Baeumer
2025-05-19 21:30:24 +02:00
parent 155d317f52
commit bd9d26deb3
2 changed files with 7 additions and 3 deletions

View File

@@ -60,9 +60,13 @@ export class RequestQueue {
return this.queue.shift(); return this.queue.shift();
} }
public getQueuedCommands(): string[] { public getQueuedCommands(skipLast: boolean = false): string[] {
const result: string[] = []; const result: string[] = [];
for (let i = this.queue.length - 1; i >= 0; i--) { const end = skipLast ? this.queue.length - 1 : this.queue.length;
if (end <= 0) {
return result;
}
for (let i = 0; i < end; i++) {
const item = this.queue[i]; const item = this.queue[i];
result.push(item.request.command); result.push(item.request.command);
if (result.length >= 5) { if (result.length >= 5) {

View File

@@ -292,7 +292,7 @@ export class SingleTsServer extends Disposable implements ITypeScriptServer {
pendingResponses pendingResponses
}; };
if (queueLength > 0) { if (queueLength > 0) {
data.queuedCommands = this._requestQueue.getQueuedCommands(); data.queuedCommands = this._requestQueue.getQueuedCommands(true);
} }
if (pendingResponses > 0) { if (pendingResponses > 0) {
data.pendingCommands = this.getPendingCommands(); data.pendingCommands = this.getPendingCommands();