-
Notifications
You must be signed in to change notification settings - Fork 645
goimports is not used as the default format tool in Go module-enabled environment #2416
Comments
@ramya-rao-a any info I'm missing which could help? |
@nezorflame Apologies for the delay
When you remove the From this point, if I reload the VS Code window, then I get the prompt on using the Below are the cases where this may not happen and instead one would get prompted about goreturns not being available
Did you land in any of the above cases? |
Regarding the prompt on multiple formatters, can you share what your Go related settings were when you got that prompt? Based on your screenshots it looks like 2 formatting providers were registered by the Go extension. I'd like to know the settings that lead to that |
Thanks for clearing this out.
Indeed, case 2 as in
As for the prompt: "go.autocompleteUnimportedPackages": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.docsTool": "godoc",
"go.formatTool": "goimports",
"go.formatFlags": [
"--local=github.com/nezorflame"
],
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--config=/home/nezorflame/.config/.golangci.yml"
],
"go.buildOnSave": "off",
"go.vetOnSave": "off",
"go.lintOnSave": "off",
"go.coverageDecorator": {
"type": "gutter",
},
"go.coverageOptions": "showUncoveredCodeOnly",
"go.coverOnTestPackage": true,
"go.coverOnSingleTest": false,
"go.testFlags": [
"-v",
"-cover"
],
"go.addTags": {
"tags": "json",
"promptForTags": false,
"transform": "snakecase"
},
"go.enableCodeLens": {
"references": false,
"runtest": true
},
"go.useLanguageServer": true,
"go.languageServerExperimentalFeatures": {
"autoComplete": true,
"diagnostics": true,
"documentSymbols": true,
"findReferences": true,
"format": false,
"goToDefinition": true,
"goToTypeDefinition": true,
"hover": true,
"rename": true,
"signatureHelp": true,
"workspaceSymbols": true,
},
"[go]": {
"editor.snippetSuggestions": "top",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
} Setting the |
I've pushed a fix so that
Setting "format" to |
Logged microsoft/vscode#72315 to track the second issue |
#2446 is tracking the issue of multiple formatters being registered. |
This issue is created due to the discussion at #2410 (comment)
It seems like the
goreturns
is still being preferred instead ofgoimports
for me in spite of change from #2309.Removing
"go.formatTool": "goimports"
instantly makes the editor ask to installgoreturns
. This doesn't go away after the IDE restart or after I open a new project.My setup:
10.14.4
1.12.1
1.33.0
(same happens in1.32.3
)0.9.3-beta.7
GO111MODULE=on
is globally set in my ENV in.zprofile
, so modules are enabledWarning:
The text was updated successfully, but these errors were encountered: