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

Commit ed6896c

Browse files
committed
Less "jumpy" spinner
1 parent fffe938 commit ed6896c

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
@@ -151,7 +151,7 @@ function startLanguageClient(context: ExtensionContext)
151151
}
152152
warnOnMissingCargoToml();
153153

154-
startSpinner('RLS starting');
154+
startSpinner('RLS', 'Starting');
155155

156156
warnOnRlsToml();
157157
// Check for deprecated env vars.
@@ -222,10 +222,11 @@ function progressCounter() {
222222
runningProgress[progress.id] = true;
223223
}
224224
if (Object.keys(runningProgress).length) {
225-
const msg =
225+
const status =
226226
typeof progress.percentage === 'number' ? asPercent(progress.percentage) :
227-
progress.message ? progress.message : '';
228-
startSpinner(`RLS ${msg}`);
227+
progress.message ? progress.message :
228+
progress.title ? `[${progress.title.toLowerCase()}]` : '';
229+
startSpinner('RLS', status);
229230
} else {
230231
stopSpinner('RLS');
231232
}

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)