Skip to content
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

x/tools/cmd/gopls: goimport and gofmt do not execute on save #33089

Closed
bobhancock opened this issue Jul 12, 2019 · 8 comments
Closed

x/tools/cmd/gopls: goimport and gofmt do not execute on save #33089

bobhancock opened this issue Jul 12, 2019 · 8 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Milestone

Comments

@bobhancock
Copy link

What version of Go are you using (go version)?

1.12.5

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

Linu

What did you do?

@gopherbot gopherbot added this to the Unreleased milestone Jul 12, 2019
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Jul 12, 2019
@stamblerre
Copy link
Contributor

Have you configured your settings according to https://github.com/golang/go/wiki/gopls? In particular,

"[go]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.organizeImports": true
    }
},

@bobhancock
Copy link
Author

bobhancock commented Jul 14, 2019 via email

@stamblerre
Copy link
Contributor

Do the other features work for you? Does formatting work if you right-click and "Format Document"? Can you share a gopls log? See https://github.com/golang/go/wiki/gopls#troubleshooting.

@bobhancock
Copy link
Author

bobhancock commented Jul 14, 2019 via email

@stamblerre
Copy link
Contributor

Can you share a log from when you save and expect goimports to work? Note that you can set

"[go]": {
  "editor.codeActionsOnSaveTimeout": 3000
}

to increase the timeout for goimports, which may solve your problem.

@bobhancock
Copy link
Author

bobhancock commented Jul 14, 2019 via email

@stamblerre
Copy link
Contributor

Based on these log messages, it seems like the response coming from gopls is correct. See the "newText" field of the response, which adds "fmt". This doesn't seem to be a gopls issue, but rather something to do with VSCode. It may be worth opening an issue with https://github.com/microsoft/vscode-go or https://github.com/microsoft/vscode-languageserver-node.

@bobhancock
Copy link
Author

bobhancock commented Jul 14, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Projects
None yet
Development

No branches or pull requests

3 participants