Skip to content

Commit

Permalink
Fixes #1205 using StatusBarItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamido-san committed Jun 24, 2021
1 parent 5621327 commit 2c98ba1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Changes to Calva.

## [Unreleased]
- Fix: [clojure-lsp statusbar messages move the nREPL button around](https://github.com/BetterThanTomorrow/calva/issues/1205)

## [2.0.201] - 2021-06-24
- [Add nrepl and clojure-lsp versions to Calva says greetings](https://github.com/BetterThanTomorrow/calva/issues/1199)
Expand Down
9 changes: 7 additions & 2 deletions src/lsp/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as fs from 'fs';

const LSP_CLIENT_KEY = 'lspClient';
const RESOLVE_MACRO_AS_COMMAND = 'resolve-macro-as';
const lspStatus = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, -1);

function createClient(clojureLspPath: string): LanguageClient {
const serverOptions: ServerOptions = {
Expand Down Expand Up @@ -272,9 +273,11 @@ async function startClient(clojureLspPath: string, context: vscode.ExtensionCont
const client = createClient(clojureLspPath);
console.log('Starting clojure-lsp at', clojureLspPath);
const onReadyPromise = client.onReady();
vscode.window.setStatusBarMessage('$(sync~spin) Initializing Clojure language features via clojure-lsp', onReadyPromise);
lspStatus.text = '$(sync~spin) Initializing Clojure language features via clojure-lsp';
lspStatus.show();
client.start();
await onReadyPromise;
lspStatus.hide();
setStateValue(LSP_CLIENT_KEY, client);
registerCommands(context, client);
registerEventHandlers(context, client);
Expand Down Expand Up @@ -304,8 +307,10 @@ async function activate(context: vscode.ExtensionContext): Promise<void> {
}
if (currentVersion !== configuredVersion) {
const downloadPromise = downloadClojureLsp(context.extensionPath, configuredVersion);
vscode.window.setStatusBarMessage('$(sync~spin) Downloading clojure-lsp', downloadPromise);
lspStatus.text = '$(sync~spin) Downloading clojure-lsp';
lspStatus.show();
clojureLspPath = await downloadPromise;
lspStatus.hide();
}
}
await startClient(clojureLspPath, context);
Expand Down

0 comments on commit 2c98ba1

Please sign in to comment.