Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

The editor cannot import package automatically #2918

Closed
watsonnnnn opened this issue Nov 27, 2019 · 2 comments
Closed

The editor cannot import package automatically #2918

watsonnnnn opened this issue Nov 27, 2019 · 2 comments

Comments

@watsonnnnn
Copy link

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

  • Run go version to get version of Go
    • go version go1.13.4 darwin/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.40.2
  • Check your installed extensions to get the version of the VS Code Go extension
    • vscode-go 0.11.9
  • Run go env GOOS GOARCH to get the operating system and processor arhcitecture details
    • darwin amd64

Share the Go related settings you have added/edited

{
"go.useLanguageServer": true,
"[go]": {
"editor.formatOnSave": true,
"editor.snippetSuggestions": "top",
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"gopls": {
"usePlaceholders": true,
"enhancedHover": true,
"completeUnimported": true
},
"go.languageServerExperimentalFeatures": {
"autoComplete": false,
"rename": true,
"goToDefinition": true,
"hover": true,
"signatureHelp": true,
"goToTypeDefinition": true,
"goToImplementation": true,
"documentSymbols": true,
"workspaceSymbols": true,
"findReferences": true,
"diagnostics": false
},
"go.autocompleteUnimportedPackages": true
}

Describe the bug

the editor cannot show import list automatically
image

Hoping your reply.

@stamblerre
Copy link
Contributor

Autocompletion inside of import blocks isn't something that we've considered supporting gopls. Filed an issue upstream for this (golang/go#35877). In the meantime, the best approach here would be rely on the import on save behavior. The import "fmt" should be added for you automatically on save, based on your settings.

@watsonnnnn
Copy link
Author

Thanks for your reply. @stamblerre It's nice of you.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants