Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
237 changes: 232 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@
"dependencies": {
"jmespath": "0.15.0",
"semver": "7.5.2",
"elegant-spinner": "2.0.0"
"ora": "9.3.0"
}
}
11 changes: 7 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as process from "process";
import { AzService, CompletionKind, Arguments, Status } from './azService';
import { parse, findNode } from './parser';
import { exec } from './utils';
import * as spinner from 'elegant-spinner';

export function activate(context: ExtensionContext) {
const azService = new AzService(azNotFound);
Expand Down Expand Up @@ -156,13 +155,17 @@ class RunLineInEditor {
private disposables: Disposable[] = [];
private commandRunningStatusBarItem: StatusBarItem;
private statusBarUpdateInterval!: NodeJS.Timeout;
private statusBarSpinner = spinner();
private spinnerFrame: () => string = () => '';
private hideStatusBarItemTimeout! : NodeJS.Timeout;
private statusBarItemText : string = '';
// using backtick (`) as continuation character on Windows, backslash (\) on other systems
private continuationCharacter : string = process.platform === "win32" ? "`" : "\\";

constructor(private status: StatusBarInfo) {
void import('ora').then(({ default: ora }) => {
const spinner = ora();
this.spinnerFrame = () => spinner.frame();
});
this.disposables.push(commands.registerTextEditorCommand('ms-azurecli.toggleLiveQuery', editor => this.toggleQuery(editor)));
this.disposables.push(commands.registerTextEditorCommand('ms-azurecli.runLineInEditor', editor => this.run(editor)));
this.disposables.push(workspace.onDidCloseTextDocument(document => this.close(document)));
Expand All @@ -183,10 +186,10 @@ class RunLineInEditor {
this.statusBarItemText = l10n.t('Azure CLI: Waiting for response');
this.statusBarUpdateInterval = setInterval(() => {
if (this.runningCommandCount === 1) {
this.commandRunningStatusBarItem.text = `${this.statusBarItemText} ${this.statusBarSpinner()}`;
this.commandRunningStatusBarItem.text = `${this.statusBarItemText} ${this.spinnerFrame()}`;
}
else {
this.commandRunningStatusBarItem.text = `${this.statusBarItemText} [${this.runningCommandCount}] ${this.statusBarSpinner()}`;
this.commandRunningStatusBarItem.text = `${this.statusBarItemText} [${this.runningCommandCount}] ${this.spinnerFrame()}`;
}
}, 50);
}
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "node16",
"moduleResolution": "node16",
"target": "es6",
"strict": true,
"noUnusedLocals": true,
Expand Down
Loading