From 954ce958a4aca875c1de3bee565c757c8624aa53 Mon Sep 17 00:00:00 2001 From: "Kirschner, Andreas {DXRE~Penzberg}" Date: Mon, 21 Dec 2020 17:02:54 +0100 Subject: [PATCH 1/8] call dequeue when cancelRequest is called add some logging --- src/omnisharp/requestQueue.ts | 16 +++++++++++++++- src/omnisharp/server.ts | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/omnisharp/requestQueue.ts b/src/omnisharp/requestQueue.ts index c4c50d4dd..fa410e0ea 100644 --- a/src/omnisharp/requestQueue.ts +++ b/src/omnisharp/requestQueue.ts @@ -14,6 +14,7 @@ export interface Request { onError(err: any): void; startTime?: number; endTime?: number; + id?: number; } /** @@ -62,7 +63,11 @@ class RequestQueue { request.onError(new Error(`Pending request cancelled: ${request.command}`)); } - // TODO: Handle cancellation of a request already waiting on the OmniSharp server. + console.log(`canceling waiting request ${request.command} ${request.id}`); + if (request.id){ + console.log(`dequeueing request ${request.command} with id ${request.id}`); + this.dequeue(request.id); + } } /** @@ -84,18 +89,21 @@ class RequestQueue { */ public processPending() { if (this._pending.length === 0) { + console.log("non pending: break"); return; } this.eventStream.post(new OmnisharpServerProcessRequestStart(this._name)); const slots = this._maxSize - this._waiting.size; + console.log(`slots available: ${slots}`); for (let i = 0; i < slots && this._pending.length > 0; i++) { const item = this._pending.shift(); item.startTime = Date.now(); const id = this._makeRequest(item); + console.log(`requested: ${item.command}, id: ${id}`); this._waiting.set(id, item); if (this.isFull()) { @@ -159,30 +167,36 @@ export class RequestQueueCollection { public drain() { if (this._isProcessing) { + console.log("is processing: break"); return false; } if (this._priorityQueue.isFull()) { + console.log("priority queue is full: break"); return false; } if (this._normalQueue.isFull() && this._deferredQueue.isFull()) { + console.log("other queues are full: break"); return false; } this._isProcessing = true; if (this._priorityQueue.hasPending()) { + console.log("processing priority queue"); this._priorityQueue.processPending(); this._isProcessing = false; return; } if (this._normalQueue.hasPending()) { + console.log("processing normal queue"); this._normalQueue.processPending(); } if (this._deferredQueue.hasPending()) { + console.log("processing deferred queue"); this._deferredQueue.processPending(); } diff --git a/src/omnisharp/server.ts b/src/omnisharp/server.ts index 2f895b412..749eb4c42 100644 --- a/src/omnisharp/server.ts +++ b/src/omnisharp/server.ts @@ -705,7 +705,8 @@ export class OmniSharpServer { private _makeRequest(request: Request) { const id = OmniSharpServer._nextId++; - + request.id = id; + const requestPacket: protocol.WireProtocol.RequestPacket = { Type: 'request', Seq: id, From 0a403e0c8b02ab4b0ce4f348105675576bfb9f70 Mon Sep 17 00:00:00 2001 From: "Kirschner, Andreas {DXRE~Penzberg}" Date: Mon, 21 Dec 2020 17:05:02 +0100 Subject: [PATCH 2/8] remove logging again --- src/omnisharp/requestQueue.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/omnisharp/requestQueue.ts b/src/omnisharp/requestQueue.ts index fa410e0ea..71ad5aadb 100644 --- a/src/omnisharp/requestQueue.ts +++ b/src/omnisharp/requestQueue.ts @@ -63,9 +63,7 @@ class RequestQueue { request.onError(new Error(`Pending request cancelled: ${request.command}`)); } - console.log(`canceling waiting request ${request.command} ${request.id}`); if (request.id){ - console.log(`dequeueing request ${request.command} with id ${request.id}`); this.dequeue(request.id); } } @@ -89,21 +87,18 @@ class RequestQueue { */ public processPending() { if (this._pending.length === 0) { - console.log("non pending: break"); return; } this.eventStream.post(new OmnisharpServerProcessRequestStart(this._name)); const slots = this._maxSize - this._waiting.size; - console.log(`slots available: ${slots}`); for (let i = 0; i < slots && this._pending.length > 0; i++) { const item = this._pending.shift(); item.startTime = Date.now(); const id = this._makeRequest(item); - console.log(`requested: ${item.command}, id: ${id}`); this._waiting.set(id, item); if (this.isFull()) { @@ -167,36 +162,30 @@ export class RequestQueueCollection { public drain() { if (this._isProcessing) { - console.log("is processing: break"); return false; } if (this._priorityQueue.isFull()) { - console.log("priority queue is full: break"); return false; } if (this._normalQueue.isFull() && this._deferredQueue.isFull()) { - console.log("other queues are full: break"); return false; } this._isProcessing = true; if (this._priorityQueue.hasPending()) { - console.log("processing priority queue"); this._priorityQueue.processPending(); this._isProcessing = false; return; } if (this._normalQueue.hasPending()) { - console.log("processing normal queue"); this._normalQueue.processPending(); } if (this._deferredQueue.hasPending()) { - console.log("processing deferred queue"); this._deferredQueue.processPending(); } From 2dbfad650e566290a2375803de8468cc967a6dbc Mon Sep 17 00:00:00 2001 From: "Kirschner, Andreas {DXRE~Penzberg}" Date: Mon, 21 Dec 2020 17:32:25 +0100 Subject: [PATCH 3/8] update commands for normal queue --- src/omnisharp/prioritization.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/omnisharp/prioritization.ts b/src/omnisharp/prioritization.ts index 98251b3f6..cc441a7a4 100644 --- a/src/omnisharp/prioritization.ts +++ b/src/omnisharp/prioritization.ts @@ -13,6 +13,8 @@ const priorityCommands = [ ]; const normalCommands = [ + protocol.Requests.Completion, + protocol.Requests.CompletionResolve, protocol.Requests.AutoComplete, protocol.Requests.FilesChanged, protocol.Requests.FindSymbols, From 25e641378da2acc4964658689d5340a40668c016 Mon Sep 17 00:00:00 2001 From: "Kirschner, Andreas {DXRE~Penzberg}" Date: Tue, 29 Dec 2020 21:34:53 +0100 Subject: [PATCH 4/8] add cancelevent --- src/observers/OmnisharpDebugModeLoggerObserver.ts | 12 ++++++++++-- src/omnisharp/EventType.ts | 3 ++- src/omnisharp/loggingEvents.ts | 5 +++++ src/omnisharp/server.ts | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/observers/OmnisharpDebugModeLoggerObserver.ts b/src/observers/OmnisharpDebugModeLoggerObserver.ts index 7bbb66577..ddb2aadd4 100644 --- a/src/observers/OmnisharpDebugModeLoggerObserver.ts +++ b/src/observers/OmnisharpDebugModeLoggerObserver.ts @@ -5,7 +5,7 @@ import { BaseLoggerObserver } from "./BaseLoggerObserver"; import * as os from 'os'; -import { BaseEvent, OmnisharpRequestMessage, OmnisharpServerEnqueueRequest, OmnisharpServerDequeueRequest, OmnisharpServerVerboseMessage, OmnisharpServerProcessRequestStart, OmnisharpEventPacketReceived } from "../omnisharp/loggingEvents"; +import { BaseEvent, OmnisharpRequestMessage, OmnisharpServerEnqueueRequest, OmnisharpServerDequeueRequest, OmnisharpServerRequestCanceled, OmnisharpServerVerboseMessage, OmnisharpServerProcessRequestStart, OmnisharpEventPacketReceived } from "../omnisharp/loggingEvents"; import { EventType } from "../omnisharp/EventType"; export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { @@ -20,7 +20,10 @@ export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { case EventType.OmnisharpServerDequeueRequest: this.handleOmnisharpServerDequeueRequest(event); break; - case EventType.OmnisharpServerProcessRequestStart: + case EventType.OmnisharpServerRequestCanceled: + this.handleOmnisharpServerRequestCanceled(event); + break; + case EventType.OmnisharpServerProcessRequestStart: this.handleOmnisharpProcessRequestStart(event); break; case EventType.OmnisharpServerProcessRequestComplete: @@ -53,6 +56,11 @@ export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { this.logger.appendLine(); } + private handleOmnisharpServerRequestCanceled(event: OmnisharpServerRequestCanceled) { + this.logger.appendLine(`Canceled request for ${event.command} (${event.id}).`); + this.logger.appendLine(); + } + private handleOmnisharpProcessRequestStart(event: OmnisharpServerProcessRequestStart) { this.logger.appendLine(`Processing ${event.name} queue`); this.logger.increaseIndent(); diff --git a/src/omnisharp/EventType.ts b/src/omnisharp/EventType.ts index 07dfd98a8..f2a15d440 100644 --- a/src/omnisharp/EventType.ts +++ b/src/omnisharp/EventType.ts @@ -82,7 +82,8 @@ export enum EventType { ProjectDiagnosticStatus = 75, DotNetTestRunInContextStart = 76, DotNetTestDebugInContextStart = 77, - TelemetryErrorEvent = 78 + TelemetryErrorEvent = 78, + OmnisharpServerRequestCanceled = 79 } //Note that the EventType protocol is shared with Razor.VSCode and the numbers here should not be altered diff --git a/src/omnisharp/loggingEvents.ts b/src/omnisharp/loggingEvents.ts index 050d1dfd7..9cb1b6bc1 100644 --- a/src/omnisharp/loggingEvents.ts +++ b/src/omnisharp/loggingEvents.ts @@ -123,6 +123,11 @@ export class OmnisharpServerDequeueRequest implements BaseEvent { constructor(public name: string, public command: string, public id: number) { } } +export class OmnisharpServerRequestCanceled implements BaseEvent { + type = EventType.OmnisharpServerRequestCanceled; + constructor(public command: string, public id: number) { } +} + export class OmnisharpServerProcessRequestStart implements BaseEvent { type = EventType.OmnisharpServerProcessRequestStart; constructor(public name: string) { } diff --git a/src/omnisharp/server.ts b/src/omnisharp/server.ts index 749eb4c42..e54b4ff39 100644 --- a/src/omnisharp/server.ts +++ b/src/omnisharp/server.ts @@ -572,6 +572,7 @@ export class OmniSharpServer { if (token) { token.onCancellationRequested(() => { + this.eventStream.post(new ObservableEvents.OmnisharpServerRequestCanceled(request.command, request.id)); this._requestQueue.cancelRequest(request); }); } From 10b1e7bb4b8ae18057d2776f7dc14968cd465e1e Mon Sep 17 00:00:00 2001 From: "Kirschner, Andreas {DXRE~Penzberg}" Date: Tue, 29 Dec 2020 22:21:52 +0100 Subject: [PATCH 5/8] add slots to request start event --- src/observers/OmnisharpDebugModeLoggerObserver.ts | 2 +- src/omnisharp/loggingEvents.ts | 2 +- .../logging/OmnisharpDebugModeLoggerObserver.test.ts | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/observers/OmnisharpDebugModeLoggerObserver.ts b/src/observers/OmnisharpDebugModeLoggerObserver.ts index ddb2aadd4..be2afb3ba 100644 --- a/src/observers/OmnisharpDebugModeLoggerObserver.ts +++ b/src/observers/OmnisharpDebugModeLoggerObserver.ts @@ -62,7 +62,7 @@ export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { } private handleOmnisharpProcessRequestStart(event: OmnisharpServerProcessRequestStart) { - this.logger.appendLine(`Processing ${event.name} queue`); + this.logger.appendLine(`Processing ${event.name} queue, empty slots ${event.slots}`); this.logger.increaseIndent(); } diff --git a/src/omnisharp/loggingEvents.ts b/src/omnisharp/loggingEvents.ts index 9cb1b6bc1..8575d4ff8 100644 --- a/src/omnisharp/loggingEvents.ts +++ b/src/omnisharp/loggingEvents.ts @@ -130,7 +130,7 @@ export class OmnisharpServerRequestCanceled implements BaseEvent { export class OmnisharpServerProcessRequestStart implements BaseEvent { type = EventType.OmnisharpServerProcessRequestStart; - constructor(public name: string) { } + constructor(public name: string, public slots: number) { } } export class OmnisharpEventPacketReceived implements BaseEvent { diff --git a/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts b/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts index 57c03065e..f0a81f47e 100644 --- a/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts +++ b/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts @@ -46,14 +46,15 @@ suite("OmnisharpDebugModeLoggerObserver", () => { }); test(`OmnisharpProcessRequestStart: Name is logged`, () => { - let event = new OmnisharpServerProcessRequestStart("foobar"); + let event = new OmnisharpServerProcessRequestStart("foobar", 2); observer.post(event); expect(logOutput).to.contain(event.name); + expect(logOutput).to.contain(event.slots); }); test(`OmnisharpServer messages increase and decrease indent`, () => { observer.post(new OmnisharpServerVerboseMessage("!indented_1")); - observer.post(new OmnisharpServerProcessRequestStart("name")); + observer.post(new OmnisharpServerProcessRequestStart("name", 2)); observer.post(new OmnisharpServerVerboseMessage("indented")); observer.post(new OmnisharpServerProcessRequestComplete()); observer.post(new OmnisharpServerVerboseMessage("!indented_2")); From 860e244c0b635848748274ba32882f7e3e9e3ef4 Mon Sep 17 00:00:00 2001 From: "Kirschner, Andreas {DXRE~Penzberg}" Date: Wed, 30 Dec 2020 11:25:08 +0100 Subject: [PATCH 6/8] call OnError, update debug logging --- .../OmnisharpDebugModeLoggerObserver.ts | 14 ++++++------- src/omnisharp/EventType.ts | 2 +- src/omnisharp/loggingEvents.ts | 8 ++++---- src/omnisharp/requestQueue.ts | 10 ++++------ src/omnisharp/server.ts | 4 +++- .../OmnisharpDebugModeLoggerObserver.test.ts | 20 +++++++++++++------ 6 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/observers/OmnisharpDebugModeLoggerObserver.ts b/src/observers/OmnisharpDebugModeLoggerObserver.ts index be2afb3ba..15e070eb3 100644 --- a/src/observers/OmnisharpDebugModeLoggerObserver.ts +++ b/src/observers/OmnisharpDebugModeLoggerObserver.ts @@ -5,7 +5,7 @@ import { BaseLoggerObserver } from "./BaseLoggerObserver"; import * as os from 'os'; -import { BaseEvent, OmnisharpRequestMessage, OmnisharpServerEnqueueRequest, OmnisharpServerDequeueRequest, OmnisharpServerRequestCanceled, OmnisharpServerVerboseMessage, OmnisharpServerProcessRequestStart, OmnisharpEventPacketReceived } from "../omnisharp/loggingEvents"; +import { BaseEvent, OmnisharpRequestMessage, OmnisharpServerEnqueueRequest, OmnisharpServerDequeueRequest, OmnisharpServerRequestCancelled, OmnisharpServerVerboseMessage, OmnisharpServerProcessRequestStart, OmnisharpEventPacketReceived } from "../omnisharp/loggingEvents"; import { EventType } from "../omnisharp/EventType"; export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { @@ -20,8 +20,8 @@ export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { case EventType.OmnisharpServerDequeueRequest: this.handleOmnisharpServerDequeueRequest(event); break; - case EventType.OmnisharpServerRequestCanceled: - this.handleOmnisharpServerRequestCanceled(event); + case EventType.OmnisharpServerRequestCancelled: + this.handleOmnisharpServerRequestCancelled(event); break; case EventType.OmnisharpServerProcessRequestStart: this.handleOmnisharpProcessRequestStart(event); @@ -47,17 +47,17 @@ export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { } private handleOmnisharpServerEnqueueRequest(event: OmnisharpServerEnqueueRequest) { - this.logger.appendLine(`Enqueue ${event.name} request for ${event.command}.`); + this.logger.appendLine(`Enqueue to ${event.queueName} request for ${event.command}.`); this.logger.appendLine(); } private handleOmnisharpServerDequeueRequest(event: OmnisharpServerDequeueRequest) { - this.logger.appendLine(`Dequeue ${event.name} request for ${event.command} (${event.id}).`); + this.logger.appendLine(`Dequeue from ${event.queueName} with status ${event.queueStatus} request for ${event.command}${event.id? ` (${event.id})`: ''}.`); this.logger.appendLine(); } - private handleOmnisharpServerRequestCanceled(event: OmnisharpServerRequestCanceled) { - this.logger.appendLine(`Canceled request for ${event.command} (${event.id}).`); + private handleOmnisharpServerRequestCancelled(event: OmnisharpServerRequestCancelled) { + this.logger.appendLine(`Cancelled request for ${event.command} (${event.id}).`); this.logger.appendLine(); } diff --git a/src/omnisharp/EventType.ts b/src/omnisharp/EventType.ts index f2a15d440..49d3ebf42 100644 --- a/src/omnisharp/EventType.ts +++ b/src/omnisharp/EventType.ts @@ -83,7 +83,7 @@ export enum EventType { DotNetTestRunInContextStart = 76, DotNetTestDebugInContextStart = 77, TelemetryErrorEvent = 78, - OmnisharpServerRequestCanceled = 79 + OmnisharpServerRequestCancelled = 79 } //Note that the EventType protocol is shared with Razor.VSCode and the numbers here should not be altered diff --git a/src/omnisharp/loggingEvents.ts b/src/omnisharp/loggingEvents.ts index 8575d4ff8..fb5c6937f 100644 --- a/src/omnisharp/loggingEvents.ts +++ b/src/omnisharp/loggingEvents.ts @@ -115,16 +115,16 @@ export class OmnisharpServerUnresolvedDependencies implements BaseEvent { export class OmnisharpServerEnqueueRequest implements BaseEvent { type = EventType.OmnisharpServerEnqueueRequest; - constructor(public name: string, public command: string) { } + constructor(public queueName: string, public command: string) { } } export class OmnisharpServerDequeueRequest implements BaseEvent { type = EventType.OmnisharpServerDequeueRequest; - constructor(public name: string, public command: string, public id: number) { } + constructor(public queueName: string, public queueStatus: string, public command: string, public id?: number) { } } -export class OmnisharpServerRequestCanceled implements BaseEvent { - type = EventType.OmnisharpServerRequestCanceled; +export class OmnisharpServerRequestCancelled implements BaseEvent { + type = EventType.OmnisharpServerRequestCancelled; constructor(public command: string, public id: number) { } } diff --git a/src/omnisharp/requestQueue.ts b/src/omnisharp/requestQueue.ts index 71ad5aadb..897b6f386 100644 --- a/src/omnisharp/requestQueue.ts +++ b/src/omnisharp/requestQueue.ts @@ -48,7 +48,7 @@ class RequestQueue { if (request) { this._waiting.delete(id); - this.eventStream.post(new OmnisharpServerDequeueRequest(this._name, request.command, id)); + this.eventStream.post(new OmnisharpServerDequeueRequest(this._name, "waiting", request.command, id)); } return request; @@ -58,9 +58,7 @@ class RequestQueue { let index = this._pending.indexOf(request); if (index !== -1) { this._pending.splice(index, 1); - - // Note: This calls reject() on the promise returned by OmniSharpServer.makeRequest - request.onError(new Error(`Pending request cancelled: ${request.command}`)); + this.eventStream.post(new OmnisharpServerDequeueRequest(this._name, "pending", request.command)); } if (request.id){ @@ -90,9 +88,9 @@ class RequestQueue { return; } - this.eventStream.post(new OmnisharpServerProcessRequestStart(this._name)); - const slots = this._maxSize - this._waiting.size; + + this.eventStream.post(new OmnisharpServerProcessRequestStart(this._name, slots)); for (let i = 0; i < slots && this._pending.length > 0; i++) { const item = this._pending.shift(); diff --git a/src/omnisharp/server.ts b/src/omnisharp/server.ts index e54b4ff39..a3504a8c9 100644 --- a/src/omnisharp/server.ts +++ b/src/omnisharp/server.ts @@ -572,8 +572,10 @@ export class OmniSharpServer { if (token) { token.onCancellationRequested(() => { - this.eventStream.post(new ObservableEvents.OmnisharpServerRequestCanceled(request.command, request.id)); + this.eventStream.post(new ObservableEvents.OmnisharpServerRequestCancelled(request.command, request.id)); this._requestQueue.cancelRequest(request); + // Note: This calls reject() on the promise returned by OmniSharpServer.makeRequest + request.onError(new Error(`Request ${request.command} cancelled, id: ${request.id}`)); }); } diff --git a/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts b/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts index f0a81f47e..36d882573 100644 --- a/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts +++ b/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { use, should, expect } from 'chai'; import { getNullChannel } from '../testAssets/Fakes'; -import { OmnisharpServerVerboseMessage, EventWithMessage, OmnisharpRequestMessage, OmnisharpServerEnqueueRequest, OmnisharpServerDequeueRequest, OmnisharpServerProcessRequestStart, OmnisharpEventPacketReceived, OmnisharpServerProcessRequestComplete } from '../../../src/omnisharp/loggingEvents'; +import { OmnisharpServerVerboseMessage, EventWithMessage, OmnisharpRequestMessage, OmnisharpServerEnqueueRequest, OmnisharpServerDequeueRequest, OmnisharpServerProcessRequestStart, OmnisharpEventPacketReceived, OmnisharpServerProcessRequestComplete, OmnisharpServerRequestCancelled } from '../../../src/omnisharp/loggingEvents'; import { OmnisharpDebugModeLoggerObserver } from '../../../src/observers/OmnisharpDebugModeLoggerObserver'; use(require("chai-string")); @@ -33,25 +33,33 @@ suite("OmnisharpDebugModeLoggerObserver", () => { test(`OmnisharpServerEnqueueRequest: Name and Command is logged`, () => { let event = new OmnisharpServerEnqueueRequest("foo", "someCommand"); observer.post(event); - expect(logOutput).to.contain(event.name); + expect(logOutput).to.contain(event.queueName); expect(logOutput).to.contain(event.command); }); - test(`OmnisharpServerDequeueRequest: Name and Command is logged`, () => { - let event = new OmnisharpServerDequeueRequest("foo", "someCommand", 1); + test(`OmnisharpServerDequeueRequest: QueueName, QueueStatus, Command and Id is logged`, () => { + let event = new OmnisharpServerDequeueRequest("foo", "pending", "someCommand", 1); observer.post(event); - expect(logOutput).to.contain(event.name); + expect(logOutput).to.contain(event.queueName); + expect(logOutput).to.contain(event.queueStatus); expect(logOutput).to.contain(event.command); expect(logOutput).to.contain(event.id); }); - test(`OmnisharpProcessRequestStart: Name is logged`, () => { + test(`OmnisharpProcessRequestStart: Name and slots is logged`, () => { let event = new OmnisharpServerProcessRequestStart("foobar", 2); observer.post(event); expect(logOutput).to.contain(event.name); expect(logOutput).to.contain(event.slots); }); + test(`OmnisharpServerRequestCancelled: Name and Id is logged`, () => { + let event = new OmnisharpServerRequestCancelled("foobar", 23); + observer.post(event); + expect(logOutput).to.contain(event.command); + expect(logOutput).to.contain(event.id); + }); + test(`OmnisharpServer messages increase and decrease indent`, () => { observer.post(new OmnisharpServerVerboseMessage("!indented_1")); observer.post(new OmnisharpServerProcessRequestStart("name", 2)); From d7c2787da7db2d3f0569650cef9bf4b591a3bb2b Mon Sep 17 00:00:00 2001 From: "Kirschner, Andreas {DXRE~Penzberg}" Date: Wed, 30 Dec 2020 11:32:56 +0100 Subject: [PATCH 7/8] adjust format --- src/observers/OmnisharpDebugModeLoggerObserver.ts | 4 ++-- src/omnisharp/requestQueue.ts | 1 - src/omnisharp/server.ts | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/observers/OmnisharpDebugModeLoggerObserver.ts b/src/observers/OmnisharpDebugModeLoggerObserver.ts index 15e070eb3..1ef4e393e 100644 --- a/src/observers/OmnisharpDebugModeLoggerObserver.ts +++ b/src/observers/OmnisharpDebugModeLoggerObserver.ts @@ -23,7 +23,7 @@ export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { case EventType.OmnisharpServerRequestCancelled: this.handleOmnisharpServerRequestCancelled(event); break; - case EventType.OmnisharpServerProcessRequestStart: + case EventType.OmnisharpServerProcessRequestStart: this.handleOmnisharpProcessRequestStart(event); break; case EventType.OmnisharpServerProcessRequestComplete: @@ -52,7 +52,7 @@ export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { } private handleOmnisharpServerDequeueRequest(event: OmnisharpServerDequeueRequest) { - this.logger.appendLine(`Dequeue from ${event.queueName} with status ${event.queueStatus} request for ${event.command}${event.id? ` (${event.id})`: ''}.`); + this.logger.appendLine(`Dequeue from ${event.queueName} with status ${event.queueStatus} request for ${event.command}${event.id ? ` (${event.id})` : ''}.`); this.logger.appendLine(); } diff --git a/src/omnisharp/requestQueue.ts b/src/omnisharp/requestQueue.ts index 897b6f386..4e7a26354 100644 --- a/src/omnisharp/requestQueue.ts +++ b/src/omnisharp/requestQueue.ts @@ -89,7 +89,6 @@ class RequestQueue { } const slots = this._maxSize - this._waiting.size; - this.eventStream.post(new OmnisharpServerProcessRequestStart(this._name, slots)); for (let i = 0; i < slots && this._pending.length > 0; i++) { diff --git a/src/omnisharp/server.ts b/src/omnisharp/server.ts index a3504a8c9..8a5a721de 100644 --- a/src/omnisharp/server.ts +++ b/src/omnisharp/server.ts @@ -709,7 +709,7 @@ export class OmniSharpServer { private _makeRequest(request: Request) { const id = OmniSharpServer._nextId++; request.id = id; - + const requestPacket: protocol.WireProtocol.RequestPacket = { Type: 'request', Seq: id, From aa6fe5ecec4ffe4a0dcb380e2d65574be6e576c3 Mon Sep 17 00:00:00 2001 From: "Kirschner, Andreas {DXRE~Penzberg}" Date: Mon, 4 Jan 2021 17:18:55 +0100 Subject: [PATCH 8/8] requested changes --- src/observers/OmnisharpDebugModeLoggerObserver.ts | 2 +- src/omnisharp/EventType.ts | 2 +- src/omnisharp/loggingEvents.ts | 2 +- src/omnisharp/prioritization.ts | 1 - src/omnisharp/protocol.ts | 1 - src/omnisharp/requestQueue.ts | 6 +++--- .../logging/OmnisharpDebugModeLoggerObserver.test.ts | 2 +- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/observers/OmnisharpDebugModeLoggerObserver.ts b/src/observers/OmnisharpDebugModeLoggerObserver.ts index 1ef4e393e..67dbc350e 100644 --- a/src/observers/OmnisharpDebugModeLoggerObserver.ts +++ b/src/observers/OmnisharpDebugModeLoggerObserver.ts @@ -62,7 +62,7 @@ export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { } private handleOmnisharpProcessRequestStart(event: OmnisharpServerProcessRequestStart) { - this.logger.appendLine(`Processing ${event.name} queue, empty slots ${event.slots}`); + this.logger.appendLine(`Processing ${event.name} queue, available slots ${event.availableRequestSlots}`); this.logger.increaseIndent(); } diff --git a/src/omnisharp/EventType.ts b/src/omnisharp/EventType.ts index 49d3ebf42..4f8c2514f 100644 --- a/src/omnisharp/EventType.ts +++ b/src/omnisharp/EventType.ts @@ -83,7 +83,7 @@ export enum EventType { DotNetTestRunInContextStart = 76, DotNetTestDebugInContextStart = 77, TelemetryErrorEvent = 78, - OmnisharpServerRequestCancelled = 79 + OmnisharpServerRequestCancelled = 79, } //Note that the EventType protocol is shared with Razor.VSCode and the numbers here should not be altered diff --git a/src/omnisharp/loggingEvents.ts b/src/omnisharp/loggingEvents.ts index fb5c6937f..32a6a9430 100644 --- a/src/omnisharp/loggingEvents.ts +++ b/src/omnisharp/loggingEvents.ts @@ -130,7 +130,7 @@ export class OmnisharpServerRequestCancelled implements BaseEvent { export class OmnisharpServerProcessRequestStart implements BaseEvent { type = EventType.OmnisharpServerProcessRequestStart; - constructor(public name: string, public slots: number) { } + constructor(public name: string, public availableRequestSlots: number) { } } export class OmnisharpEventPacketReceived implements BaseEvent { diff --git a/src/omnisharp/prioritization.ts b/src/omnisharp/prioritization.ts index cc441a7a4..ac5c5b7ed 100644 --- a/src/omnisharp/prioritization.ts +++ b/src/omnisharp/prioritization.ts @@ -15,7 +15,6 @@ const priorityCommands = [ const normalCommands = [ protocol.Requests.Completion, protocol.Requests.CompletionResolve, - protocol.Requests.AutoComplete, protocol.Requests.FilesChanged, protocol.Requests.FindSymbols, protocol.Requests.FindUsages, diff --git a/src/omnisharp/protocol.ts b/src/omnisharp/protocol.ts index 5cb73f2c1..8cb6ebaf6 100644 --- a/src/omnisharp/protocol.ts +++ b/src/omnisharp/protocol.ts @@ -8,7 +8,6 @@ import { CompletionTriggerKind, CompletionItemKind, CompletionItemTag, InsertTex export module Requests { export const AddToProject = '/addtoproject'; - export const AutoComplete = '/autocomplete'; export const CodeCheck = '/codecheck'; export const CodeFormat = '/codeformat'; export const ChangeBuffer = '/changebuffer'; diff --git a/src/omnisharp/requestQueue.ts b/src/omnisharp/requestQueue.ts index 4e7a26354..486be14f7 100644 --- a/src/omnisharp/requestQueue.ts +++ b/src/omnisharp/requestQueue.ts @@ -88,10 +88,10 @@ class RequestQueue { return; } - const slots = this._maxSize - this._waiting.size; - this.eventStream.post(new OmnisharpServerProcessRequestStart(this._name, slots)); + const availableRequestSlots = this._maxSize - this._waiting.size; + this.eventStream.post(new OmnisharpServerProcessRequestStart(this._name, availableRequestSlots)); - for (let i = 0; i < slots && this._pending.length > 0; i++) { + for (let i = 0; i < availableRequestSlots && this._pending.length > 0; i++) { const item = this._pending.shift(); item.startTime = Date.now(); diff --git a/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts b/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts index 36d882573..cc7219589 100644 --- a/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts +++ b/test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts @@ -50,7 +50,7 @@ suite("OmnisharpDebugModeLoggerObserver", () => { let event = new OmnisharpServerProcessRequestStart("foobar", 2); observer.post(event); expect(logOutput).to.contain(event.name); - expect(logOutput).to.contain(event.slots); + expect(logOutput).to.contain(event.availableRequestSlots); }); test(`OmnisharpServerRequestCancelled: Name and Id is logged`, () => {