Skip to content

Commit

Permalink
src/goLanguageServer: remove gopls start progress bar
Browse files Browse the repository at this point in the history
This was purely cosmetic, but conflicts with the other important
notification messages such as missing gopls warning messages.

And, use the exact comparison when checking 'go.useLanguageServer'.
This can be any value - users can enter arbitrary values by mistake.

Change-Id: Ie20c875e984dff00e1287774dd8b5da8d976b520
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/286792
Trust: Hyang-Ah Hana Kim <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
Reviewed-by: Rebecca Stambler <[email protected]>
TryBot-Result: kokoro <[email protected]>
hyangah committed Jan 26, 2021
1 parent d04d4cf commit b665d37
Showing 2 changed files with 12 additions and 39 deletions.
47 changes: 10 additions & 37 deletions src/goLanguageServer.ts
Original file line number Diff line number Diff line change
@@ -143,46 +143,19 @@ export async function startLanguageServerWithFallback(ctx: vscode.ExtensionConte
}

languageServerStartInProgress = true;
const progressMsg = languageServerIsRunning ? 'Restarting language service' : 'Starting language service';
await vscode.window.withProgress({
title: progressMsg,
cancellable: !activation,
location: vscode.ProgressLocation.Notification,
}, async (progress, token) => {
let disposable: vscode.Disposable;
if (token) {
disposable = token.onCancellationRequested(async () => {
const choice = await vscode.window.showErrorMessage(
'Language service restart request was interrupted and language service may be in a bad state. ' +
'Please reload the window.',
'Reload Window');
if (choice === 'Reload Window') {
await vscode.commands.executeCommand('workbench.action.reloadWindow');
}
});
}

const started = await startLanguageServer(ctx, cfg);
const started = await startLanguageServer(ctx, cfg);

if (!started && goConfig['useLanguageServer'] === true) {
// We already created various notification - e.g. missing gopls, ...
// So, just leave a log message here instead of issuing one more notification.
outputChannel.appendLine(
`Failed to start the language server (gopls). Falling back to default language providers...`);
outputChannel.show();
}
// If the server has been disabled, or failed to start,
// fall back to the default providers, while making sure not to
// re-register any providers.
if (!started && defaultLanguageProviders.length === 0) {
registerDefaultProviders(ctx);
}
// If the server has been disabled, or failed to start,
// fall back to the default providers, while making sure not to
// re-register any providers.
if (!started && defaultLanguageProviders.length === 0) {
registerDefaultProviders(ctx);
}

if (disposable) { disposable.dispose(); }
languageServerIsRunning = started;
updateLanguageServerIconGoStatusBar(started, goConfig['useLanguageServer']);
languageServerStartInProgress = false;
});
languageServerIsRunning = started;
updateLanguageServerIconGoStatusBar(started, goConfig['useLanguageServer'] === true);
languageServerStartInProgress = false;
}

// scheduleGoplsSuggestions sets timeouts for the various gopls-specific
4 changes: 2 additions & 2 deletions src/goStatus.ts
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ export async function expandGoStatusBar() {
const goplsVersion = await getLocalGoplsVersion(cfg);
options.push({label: `${languageServerIcon}Open 'gopls' trace`, description: `${goplsVersion}`});
}
if (!languageServerIsRunning && !cfg.serverName && goConfig['useLanguageServer']) {
if (!languageServerIsRunning && !cfg.serverName && goConfig['useLanguageServer'] === true) {
options.push({
label: `Install Go Language Server`,
description: `${languageServerErrorIcon}'gopls' is required but missing`});
@@ -114,7 +114,7 @@ export async function initGoStatusBar() {
// icon will be updated on an attempt to start.
const goConfig = getGoConfig();
const cfg = buildLanguageServerConfig(goConfig);
updateLanguageServerIconGoStatusBar(languageServerIsRunning, goConfig['useLanguageServer']);
updateLanguageServerIconGoStatusBar(languageServerIsRunning, goConfig['useLanguageServer'] === true);

showGoStatusBar();
}

0 comments on commit b665d37

Please sign in to comment.