-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict Between GCI and VSCode Go Extension: Blank Line Handling in Import Groups #216
Comments
I guess you do not set the import group, you can read the readme to set the group then vscode extension would not add blank. |
You suggesting a fix that is not by default in vscode go extension rather than fixing this in gci to accomodate the developers workflow. Up to you, but I believe the devs would likely just disable this in .golangciyml if this is how you wanted it to be. |
Hi, I added the GCI formatter like this "go.formatTool": "custom",
"go.alternateTools": {
"customFormatter": "gci",
},
"go.formatFlags": [
"print",
"-s",
"prefix(yourprefix/here)",
"-s",
"standard",
"-s",
"default",
], my .vscode/settings.json{
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.insertSpaces": true,
"editor.detectIndentation": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"[go]": {
"editor.defaultFormatter": "golang.go",
"editor.rulers": [
{
"column": 80,
}
],
"editor.codeActionsOnSave": {
"source.organizeImports": "always",
},
},
"go.toolsManagement.autoUpdate": true,
"go.vetOnSave": "package",
"go.testFlags": [
"-v"
],
"go.lintFlags": [],
"go.formatTool": "custom",
"go.alternateTools": {
"customFormatter": "gci",
},
"go.formatFlags": [
"print",
"-s",
"prefix(desulaid/app)",
"-s",
"standard",
"-s",
"default",
],
"go.useLanguageServer": true,
"gopls": {
"ui.diagnostic.staticcheck": true,
"ui.documentation.linksInHover": false,
"verboseOutput": true,
"ui.codelenses": {
"tidy": true
},
"ui.navigation.importShortcut": "Definition",
"ui.diagnostic.analyses": {
"fieldalignment": false,
"shadow": true,
"unusedvariable": true,
"useany": false
},
},
"go.delveConfig": {
"debugAdapter": "dlv-dap",
},
"go.inlayHints.assignVariableTypes": false,
"go.inlayHints.compositeLiteralFields": true,
"go.inlayHints.compositeLiteralTypes": true,
"go.inlayHints.constantValues": true,
"go.inlayHints.functionTypeParameters": true,
"go.inlayHints.parameterNames": true,
"go.inlayHints.rangeVariableTypes": true,
}
|
Issue:
gci does not allow a blank line between external and local module packages, which conflicts with VSCode's Go extension. The Go extension automatically adds a blank line between different groups of imports (e.g., external and local module packages) for readability. As a result, gci reports that the blank line should be removed, while the Go extension insists on adding it back, causing a conflict between the two tools.
What version of GCI are you using?
Reproduce Steps
Open this in Visual
What did you expect to see?
gci should align with developer workflows and the Go extension's formatting by allowing the blank line between different import groups.
What did you see instead?
gci asks to remove the blank line between external and local module package imports.
The text was updated successfully, but these errors were encountered: