Skip to content

Commit f0d9221

Browse files
committed
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 <[email protected]> kokoro-CI: kokoro <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent e10c953 commit f0d9221

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
1515

1616
* Added new "Package Outline" explorer view that displays all the symbols in the currently open file's package.
1717

18+
### Fixes
19+
20+
* Improved Error Reporting: Code action resolution failures now display error messages via notifications from gopls.
21+
* Removed unnecessary prompts for missing formatter tools when gopls is enabled ([Issue 3677](https://github.com/golang/vscode-go/issues/3677)).
22+
1823
## v0.45.1 (prerelease)
1924

2025
Date: 2025-02-11

extension/src/language/goLanguageServer.ts

+14
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,20 @@ export async function buildLanguageClient(
768768
}
769769
return ret;
770770
}
771+
},
772+
resolveCodeAction: async (item, token, next) => {
773+
try {
774+
return await next(item, token);
775+
} catch (e) {
776+
const answer = await vscode.window.showErrorMessage(
777+
`code action resolve failed: ${e}.`,
778+
'Show Trace'
779+
);
780+
if (answer === 'Show Trace') {
781+
goCtx.serverOutputChannel?.show();
782+
}
783+
return null;
784+
}
771785
}
772786
}
773787
} as LanguageClientOptions,

0 commit comments

Comments
 (0)