extension/src/language: surface code action error as notification Updated bug fixes in changelog. By default, the vscode-languageserver-node client discard the error returned from the language server. The error is burried in "gopls(server) output". This CL capture the error returned from the gopls and surface them through vscode message notification. Change-Id: I1e0beca6c833ed0c95275de3d0f3c429f0c5b733 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/648937 Reviewed-by: Robert Findley <rfindley@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ced9bb..e082cc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md
@@ -15,6 +15,11 @@ * Added new "Package Outline" explorer view that displays all the symbols in the currently open file's package. +### Fixes + +* Improved Error Reporting: Code action resolution failures now display error messages via notifications from gopls. +* Removed unnecessary prompts for missing formatter tools when gopls is enabled ([Issue 3677](https://github.com/golang/vscode-go/issues/3677)). + ## v0.45.1 (prerelease) Date: 2025-02-11
diff --git a/extension/src/language/goLanguageServer.ts b/extension/src/language/goLanguageServer.ts index 97bc0cb..b446e8c 100644 --- a/extension/src/language/goLanguageServer.ts +++ b/extension/src/language/goLanguageServer.ts
@@ -768,6 +768,20 @@ } return ret; } + }, + resolveCodeAction: async (item, token, next) => { + try { + return await next(item, token); + } catch (e) { + const answer = await vscode.window.showErrorMessage( + `code action resolve failed: ${e}.`, + 'Show Trace' + ); + if (answer === 'Show Trace') { + goCtx.serverOutputChannel?.show(); + } + return null; + } } } } as LanguageClientOptions,