golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.9k stars 757 forks source link

When saving code, gopls is suspended and there is an error in OUTPUT #3545

Open Tiper-In-Github opened 2 months ago

Tiper-In-Github commented 2 months ago

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_. - go 1.22.5 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - v0.16.2 * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - * Check your installed extensions to get the version of the VS Code Go extension - v0.42.1 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. -

Share the Go related settings you have added/edited

{
    "workbench.colorTheme": "Default Dark Modern",
    "editor.quickSuggestionsDelay": 50,
    "editor.tabSize": 2,
    "todo-tree.general.tags": [
        "BUG",
        "HACK",
        "FIXME",
        "TODO",
        "XXX",
        "[x]"
    ],
    "telemetry.telemetryLevel": "error",
    "gitlens.outputLevel": "error",
    "go.toolsManagement.autoUpdate": true,
    "[proto3]": {
        "editor.defaultFormatter": "zxh404.vscode-proto3"
    },
    "[vue]": {
        "editor.defaultFormatter": "Vue.volar",
        "editor.tabSize": 2
    },
    "[javascript]": {
        "editor.tabSize": 2
    },
    "editor.indentSize": "tabSize"
}

Describe the bug

I saved the file but nothing happened after a long wait, so I checked OUTPUT->gopls(server)

[Error - 11:28:09 AM] Request textDocument/codeAction failed.
  Message: context canceled
  Code: 0 
[Error - 11:28:10 AM] 2024/09/24 11:28:10 imports fixes: allImportsFixes: D:\a1-PublisherAdvertisingPlatform\go-admin\common\three\oceanengine\oe_client_files.go:12:87: mixed named and unnamed parameters
    file="D:\\a1-PublisherAdvertisingPlatform\\go-admin\\common\\three\\oceanengine\\oe_client_files.go"

Steps to reproduce the behavior:

I saved the file but nothing happened after a long wait, so I checked OUTPUT->gopls(server)

[Error - 11:28:09 AM] Request textDocument/codeAction failed.
  Message: context canceled
  Code: 0 
[Error - 11:28:10 AM] 2024/09/24 11:28:10 imports fixes: allImportsFixes: D:\a1-PublisherAdvertisingPlatform\go-admin\common\three\oceanengine\oe_client_files.go:12:87: mixed named and unnamed parameters
    file="D:\\a1-PublisherAdvertisingPlatform\\go-admin\\common\\three\\oceanengine\\oe_client_files.go"

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

hyangah commented 1 month ago

@Tiper-In-Github thanks for reaching out. Do you see a pending progress popup? If so, can you share the full gopls log with us? Thanks!

The second error (fixes: allImportsFixes...) is as expected - that is an error in the code and cannot be fixed with the imports.

Tiper-In-Github commented 1 month ago

I'm sorry, I think I provided all the output related to the error when the problem occurred. There is no more information above what I provided, of course, it may be that I misread it. If this problem comes up next time, I will add it. Thank you for everything you do for this.