Skip to content

Commit b665d37

Browse files
committed
src/goLanguageServer: remove gopls start progress bar
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]>
1 parent d04d4cf commit b665d37

File tree

2 files changed

+12
-39
lines changed

2 files changed

+12
-39
lines changed

src/goLanguageServer.ts

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -143,46 +143,19 @@ export async function startLanguageServerWithFallback(ctx: vscode.ExtensionConte
143143
}
144144

145145
languageServerStartInProgress = true;
146-
const progressMsg = languageServerIsRunning ? 'Restarting language service' : 'Starting language service';
147-
await vscode.window.withProgress({
148-
title: progressMsg,
149-
cancellable: !activation,
150-
location: vscode.ProgressLocation.Notification,
151-
}, async (progress, token) => {
152-
let disposable: vscode.Disposable;
153-
if (token) {
154-
disposable = token.onCancellationRequested(async () => {
155-
const choice = await vscode.window.showErrorMessage(
156-
'Language service restart request was interrupted and language service may be in a bad state. ' +
157-
'Please reload the window.',
158-
'Reload Window');
159-
if (choice === 'Reload Window') {
160-
await vscode.commands.executeCommand('workbench.action.reloadWindow');
161-
}
162-
});
163-
}
164146

165-
const started = await startLanguageServer(ctx, cfg);
147+
const started = await startLanguageServer(ctx, cfg);
166148

167-
if (!started && goConfig['useLanguageServer'] === true) {
168-
// We already created various notification - e.g. missing gopls, ...
169-
// So, just leave a log message here instead of issuing one more notification.
170-
outputChannel.appendLine(
171-
`Failed to start the language server (gopls). Falling back to default language providers...`);
172-
outputChannel.show();
173-
}
174-
// If the server has been disabled, or failed to start,
175-
// fall back to the default providers, while making sure not to
176-
// re-register any providers.
177-
if (!started && defaultLanguageProviders.length === 0) {
178-
registerDefaultProviders(ctx);
179-
}
149+
// If the server has been disabled, or failed to start,
150+
// fall back to the default providers, while making sure not to
151+
// re-register any providers.
152+
if (!started && defaultLanguageProviders.length === 0) {
153+
registerDefaultProviders(ctx);
154+
}
180155

181-
if (disposable) { disposable.dispose(); }
182-
languageServerIsRunning = started;
183-
updateLanguageServerIconGoStatusBar(started, goConfig['useLanguageServer']);
184-
languageServerStartInProgress = false;
185-
});
156+
languageServerIsRunning = started;
157+
updateLanguageServerIconGoStatusBar(started, goConfig['useLanguageServer'] === true);
158+
languageServerStartInProgress = false;
186159
}
187160

188161
// scheduleGoplsSuggestions sets timeouts for the various gopls-specific

src/goStatus.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export async function expandGoStatusBar() {
5555
const goplsVersion = await getLocalGoplsVersion(cfg);
5656
options.push({label: `${languageServerIcon}Open 'gopls' trace`, description: `${goplsVersion}`});
5757
}
58-
if (!languageServerIsRunning && !cfg.serverName && goConfig['useLanguageServer']) {
58+
if (!languageServerIsRunning && !cfg.serverName && goConfig['useLanguageServer'] === true) {
5959
options.push({
6060
label: `Install Go Language Server`,
6161
description: `${languageServerErrorIcon}'gopls' is required but missing`});
@@ -114,7 +114,7 @@ export async function initGoStatusBar() {
114114
// icon will be updated on an attempt to start.
115115
const goConfig = getGoConfig();
116116
const cfg = buildLanguageServerConfig(goConfig);
117-
updateLanguageServerIconGoStatusBar(languageServerIsRunning, goConfig['useLanguageServer']);
117+
updateLanguageServerIconGoStatusBar(languageServerIsRunning, goConfig['useLanguageServer'] === true);
118118

119119
showGoStatusBar();
120120
}

0 commit comments

Comments
 (0)