diff --git a/README.md b/README.md
index d1836bb..4aea57d 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,8 @@ extension fits your needs and enhances your development experience.
and the [VS Code Groovy extension].
* [Managing extensions in VS Code].
* **Step 2.** To activate the extension, open any directory or workspace
- containing Groovy code.
+ containing Groovy code and look for the thumbs up! 👍
+
You are ready to get Groovy :-) 🎉🎉🎉
@@ -24,9 +25,9 @@ You are ready to get Groovy :-) 🎉🎉🎉
The extension is currently a work-in-progress but does provide basic IntelliSense. We plan to extend this extension to include code navigation and code editing.
-- Code completion and Signature help
+- Code completion and Signature help
-- See GroovyDoc strings on Classes, Fields, Methods and Functions.
+- See GroovyDoc strings on Classes, Fields, Methods and Functions.
## Build from source
diff --git a/docs/images/status-bar.png b/docs/images/status-bar.png
new file mode 100755
index 0000000..2eb21dd
Binary files /dev/null and b/docs/images/status-bar.png differ
diff --git a/src/extension.ts b/src/extension.ts
index 0c46bf9..0dfb6e1 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -20,6 +20,7 @@
import findJava from "./utils/findJava";
import * as path from "path";
import * as vscode from "vscode";
+import { extensionStatusBar } from "./gui/extensionStatusBarProvider";
import {
LanguageClient,
LanguageClientOptions,
@@ -49,6 +50,9 @@ function onDidChangeConfiguration(event: vscode.ConfigurationChangeEvent) {
}
function restartLanguageServer() {
+
+ extensionStatusBar.restart();
+
if (!languageClient) {
startLanguageServer();
return;
@@ -75,7 +79,13 @@ function restartLanguageServer() {
export function activate(context: vscode.ExtensionContext) {
extensionContext = context;
+
+ // Enable the status bar and tell it to display.
+ context.subscriptions.push(extensionStatusBar);
+ extensionStatusBar.startUp();
+
javaPath = findJava();
+
vscode.workspace.onDidChangeConfiguration(onDidChangeConfiguration);
vscode.commands.registerCommand(
@@ -98,10 +108,12 @@ function startLanguageServer() {
if (!extensionContext) {
//something very bad happened!
resolve();
+ extensionStatusBar.setError();
vscode.window.showErrorMessage(STARTUP_ERROR);
return;
}
if (!javaPath) {
+ extensionStatusBar.setError();
resolve();
let settingsJavaHome = vscode.workspace
.getConfiguration("groovy")
@@ -155,10 +167,12 @@ function startLanguageServer() {
);
languageClient.onReady().then(resolve, (reason: any) => {
resolve();
+ extensionStatusBar.setError();
vscode.window.showErrorMessage(STARTUP_ERROR);
});
let disposable = languageClient.start();
extensionContext.subscriptions.push(disposable);
+ extensionStatusBar.running();
});
}
);
diff --git a/src/gui/extensionStatusBarProvider.ts b/src/gui/extensionStatusBarProvider.ts
new file mode 100644
index 0000000..ee1d39b
--- /dev/null
+++ b/src/gui/extensionStatusBarProvider.ts
@@ -0,0 +1,79 @@
+////////////////////////////////////////////////////////////////////////////////
+// Copyright 2021 DontShaveTheYak
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License
+//
+// Author: DontShaveTheYak
+// No warranty of merchantability or fitness of any kind.
+// Use this software at your own risk.
+////////////////////////////////////////////////////////////////////////////////
+
+import { StatusBarItem, window, StatusBarAlignment } from "vscode";
+import { Disposable } from "vscode-languageclient";
+
+class ExtensionStatusBarProvider implements Disposable {
+ private statusBarItem: StatusBarItem;
+
+ constructor() {
+ this.statusBarItem = window.createStatusBarItem(StatusBarAlignment.Right, Number.MIN_VALUE);
+ }
+
+ public startUp(): void {
+ this.statusBarItem.text = StatusIcon.Launching;
+ this.statusBarItem.tooltip = 'Groovy-Guru is Starting.';
+ this.statusBarItem.show();
+ }
+
+ public restart(): void {
+ this.statusBarItem.text = StatusIcon.Busy;
+ this.statusBarItem.tooltip = 'Groovy-Guru is Restarting.';
+ }
+
+ public running(): void {
+ this.statusBarItem.text = StatusIcon.Ready;
+ this.statusBarItem.tooltip = 'Groovy-Guru is running.';
+ }
+
+ public updateText(text: string): void {
+ this.statusBarItem.text = text;
+ }
+
+ public setBusy(): void {
+ this.statusBarItem.text = StatusIcon.Busy;
+ }
+
+ public setError(): void {
+ this.statusBarItem.text = StatusIcon.Error;
+ }
+
+ public setReady(): void {
+ this.statusBarItem.text = StatusIcon.Ready;
+ }
+
+ public updateTooltip(tooltip: string): void {
+ this.statusBarItem.tooltip = tooltip;
+ }
+
+ public dispose(): void {
+ this.statusBarItem.dispose();
+ }
+}
+
+enum StatusIcon {
+ Busy = "$(sync~spin)",
+ Ready = "$(thumbsup)",
+ Error = "$(thumbsdown)",
+ Launching = "$(rocket)",
+}
+
+export const extensionStatusBar: ExtensionStatusBarProvider = new ExtensionStatusBarProvider();