[vscode-go] src/commands: catch errors when starting language server

3 views
Skip to first unread message

Jamal Carvalho (Gerrit)

unread,
Jun 21, 2022, 3:24:52 PM6/21/22
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Hyang-Ah Hana Kim, kokoro, golang-co...@googlegroups.com

Jamal Carvalho submitted this change.

View Change



3 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: src/commands/startLanguageServer.ts
Insertions: 3, Deletions: 1.

@@ -96,7 +96,9 @@
updateStatus(goCtx, goConfig, true);
console.log(`Server: ${JSON.stringify(goCtx.serverInfo, null, 2)}`);
} catch (e) {
- console.log(`Error starting language server: ${e}`);
+ const msg = `Error starting language server: ${e}`;
+ console.log(msg);
+ goCtx.serverOutputChannel?.append(msg);
} finally {
goCtx.latestConfig = cfg;
unlock();
```

Approvals: Jamal Carvalho: Run TryBots Hyang-Ah Hana Kim: Looks good to me, approved
src/commands: catch errors when starting language server

Added a catch block to the start language server logic
to ensure the rest of the extension activation completes.

Change-Id: I1664da130a981ef8034d1f0e8723b72a4be2d594
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/413424
Run-TryBot: Jamal Carvalho <ja...@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hya...@gmail.com>
---
M src/commands/startLanguageServer.ts
M src/goMain.ts
2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/commands/startLanguageServer.ts b/src/commands/startLanguageServer.ts
index 466cbdf..703c5ee 100644
--- a/src/commands/startLanguageServer.ts
+++ b/src/commands/startLanguageServer.ts
@@ -95,6 +95,10 @@
goCtx.serverInfo = toServerInfo(goCtx.languageClient.initializeResult);
updateStatus(goCtx, goConfig, true);
console.log(`Server: ${JSON.stringify(goCtx.serverInfo, null, 2)}`);
+ } catch (e) {
+ const msg = `Error starting language server: ${e}`;
+ console.log(msg);
+ goCtx.serverOutputChannel?.append(msg);
} finally {
goCtx.latestConfig = cfg;
unlock();
diff --git a/src/goMain.ts b/src/goMain.ts
index af0a716..0213e03 100644
--- a/src/goMain.ts
+++ b/src/goMain.ts
@@ -102,13 +102,13 @@
offerToInstallLatestGoVersion();
offerToInstallTools();

+ const registerCommand = commands.createRegisterCommand(ctx, goCtx);
+ registerCommand('go.languageserver.restart', commands.startLanguageServer);
+
await commands.startLanguageServer(ctx, goCtx)(RestartReason.ACTIVATION);

initCoverageDecorators(ctx);

- const registerCommand = commands.createRegisterCommand(ctx, goCtx);
-
- registerCommand('go.languageserver.restart', commands.startLanguageServer);
registerCommand('go.builds.run', commands.runBuilds);

const activeDoc = vscode.window.activeTextEditor?.document;

To view, visit change 413424. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: vscode-go
Gerrit-Branch: master
Gerrit-Change-Id: I1664da130a981ef8034d1f0e8723b72a4be2d594
Gerrit-Change-Number: 413424
Gerrit-PatchSet: 5
Gerrit-Owner: Jamal Carvalho <ja...@golang.org>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Jamal Carvalho <ja...@golang.org>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-MessageType: merged

Hyang-Ah Hana Kim (Gerrit)

unread,
Jun 29, 2022, 4:51:54 PM6/29/22
to Jamal Carvalho, Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Suzy Mueller, kokoro, golang-co...@googlegroups.com

Hyang-Ah Hana Kim submitted this change.

View Change


Approvals: Suzy Mueller: Looks good to me, approved Hyang-Ah Hana Kim: Run TryBots kokoro: TryBots succeeded
[release] src/commands: catch errors when starting language server


Added a catch block to the start language server logic
to ensure the rest of the extension activation completes.

Change-Id: I1664da130a981ef8034d1f0e8723b72a4be2d594
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/413424
Run-TryBot: Jamal Carvalho <ja...@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hya...@gmail.com>
(cherry picked from commit 8dfd39349da7a523b4ed0f781c9d10c753be76bf)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/414458
Run-TryBot: Hyang-Ah Hana Kim <hya...@gmail.com>
TryBot-Result: kokoro <noreply...@google.com>
Reviewed-by: Suzy Mueller <suz...@golang.org>

---
M src/commands/startLanguageServer.ts
M src/goMain.ts
2 files changed, 27 insertions(+), 3 deletions(-)

To view, visit change 414458. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: vscode-go
Gerrit-Branch: release
Gerrit-Change-Id: I1664da130a981ef8034d1f0e8723b72a4be2d594
Gerrit-Change-Number: 414458
Gerrit-PatchSet: 2
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Jamal Carvalho <ja...@golang.org>
Gerrit-Reviewer: Suzy Mueller <suz...@golang.org>
Reply all
Reply to author
Forward
0 new messages