From e60be18873bf6b2ecdd648efb82bc65e9f662b25 Mon Sep 17 00:00:00 2001 From: Alexey Alekhin Date: Sat, 4 Nov 2017 22:34:16 +0100 Subject: [PATCH 1/2] Added busy-signal logging --- lib/main.js | 38 ++++++++++++++++++++++++++++++++++++++ package.json | 5 +++++ 2 files changed, 43 insertions(+) diff --git a/lib/main.js b/lib/main.js index 174c51f..d22ea20 100644 --- a/lib/main.js +++ b/lib/main.js @@ -47,6 +47,44 @@ class ScalaLanguageClient extends AutoLanguageClient { // Currently we just turn off these notifications, because sbt doesn't // recognize them anyway filterChangeWatchedFiles(filePath) { return false; } + + preInitialization(connection) { + connection.onLogMessage(params => { + if (params.type === 4 && params.message === 'Done') { + this.updateBusyMessage(); + } else { + const init = (params.type === 4 && params.message === 'Processing'); + this.updateBusyMessage(params.message, init); + } + }); + } + + consumeBusySignal(busySignal) { + this.busySignal = busySignal; + } + + busyMessageFormat(text) { + return `${this.getServerName()}: ${text}`; + } + + updateBusyMessage(text = '', init = false, reveal = false) { + if (this.busyMessage != null) { + if (text === '') { + this.busyMessage.dispose(); + this.busyMessage = null; + } else { + this.busyMessage.setTitle( + this.busyMessageFormat(text), + { revealTooltip: reveal } + ); + } + } else if (init) { + this.busyMessage = this.busySignal.reportBusy( + this.busyMessageFormat(text), + { revealTooltip: reveal } + ); + } + } } module.exports = new ScalaLanguageClient() diff --git a/package.json b/package.json index ee95618..cd15d9c 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,11 @@ "versions": { "2.0.0": "consumeLinterV2" } + }, + "atom-ide-busy-signal": { + "versions": { + "0.1.0": "consumeBusySignal" + } } } } From 1fbc62263fec4d4fe1894dead6208808885e6217 Mon Sep 17 00:00:00 2001 From: Alexey Alekhin Date: Fri, 2 Feb 2018 03:31:23 +0100 Subject: [PATCH 2/2] Updated busy signal service name --- lib/main.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/main.js b/lib/main.js index 8fff711..f2f3ce9 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,7 +18,6 @@ class ScalaLanguageClient extends AutoLanguageClient { const serverProcess = this.spawnChildNode([serverPath], { cwd: projectPath }); - this.captureServerErrors(serverProcess); return serverProcess; } @@ -57,10 +56,6 @@ class ScalaLanguageClient extends AutoLanguageClient { }); } - consumeBusySignal(busySignal) { - this.busySignal = busySignal; - } - busyMessageFormat(text) { return `${this.getServerName()}: ${text}`; } @@ -77,7 +72,7 @@ class ScalaLanguageClient extends AutoLanguageClient { ); } } else if (init) { - this.busyMessage = this.busySignal.reportBusy( + this.busyMessage = this.busySignalService.reportBusy( this.busyMessageFormat(text), { revealTooltip: reveal } );