Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Commit 85d1c14

Browse files
committed
Less "jumpy" spinner
1 parent 9160fa4 commit 85d1c14

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/extension.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function startLanguageClient(context: ExtensionContext)
149149
}
150150
warnOnMissingCargoToml();
151151

152-
startSpinner('RLS starting');
152+
startSpinner('RLS', 'Starting');
153153

154154
warnOnRlsToml();
155155
// Check for deprecated env vars.
@@ -219,10 +219,11 @@ function progressCounter() {
219219
runningProgress[progress.id] = true;
220220
}
221221
if (Object.keys(runningProgress).length) {
222-
const msg =
222+
const status =
223223
typeof progress.percentage === 'number' ? asPercent(progress.percentage) :
224-
progress.message ? progress.message : '';
225-
startSpinner(`RLS ${msg}`);
224+
progress.message ? progress.message :
225+
progress.title ? `[${progress.title.toLowerCase()}]` : '';
226+
startSpinner('RLS', status);
226227
} else {
227228
stopSpinner('RLS');
228229
}

src/rustup.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function runRlsViaRustup(env: any): Promise<child_process.ChildProcess> {
2525
}
2626

2727
export async function rustupUpdate() {
28-
startSpinner('Updating RLS...');
28+
startSpinner('RLS', 'Updating…');
2929

3030
try {
3131
const { stdout } = await execChildProcess(CONFIGURATION.rustupPath + ' update');
@@ -74,7 +74,7 @@ async function hasToolchain(): Promise<boolean> {
7474
}
7575

7676
async function tryToInstallToolchain(): Promise<void> {
77-
startSpinner('Installing toolchain...');
77+
startSpinner('RLS', 'Installing toolchain');
7878
try {
7979
const { stdout, stderr } = await execChildProcess(CONFIGURATION.rustupPath + ' toolchain install ' + CONFIGURATION.channel);
8080
console.log(stdout);
@@ -129,7 +129,7 @@ async function hasRlsComponents(): Promise<boolean> {
129129
}
130130

131131
async function installRls(): Promise<void> {
132-
startSpinner('Installing RLS components');
132+
startSpinner('RLS', 'Installing components');
133133

134134
const tryFn: (component: string) => Promise<(Error | null)> = async (component: string) => {
135135
try {

src/spinner.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
import { window } from 'vscode';
1414

15-
export function startSpinner(message: string) {
15+
export function startSpinner(prefix: string, postfix: string) {
1616
if (spinnerTimer != null) {
1717
clearInterval(spinnerTimer);
1818
}
1919
let state = 0;
2020
spinnerTimer = setInterval(function() {
21-
window.setStatusBarMessage(message + ' ' + spinner[state]);
21+
window.setStatusBarMessage(prefix + ' ' + spinner[state] + ' ' + postfix);
2222
state = (state + 1) % spinner.length;
2323
}, 100);
2424
}

0 commit comments

Comments
 (0)