Need help with VSCode, GOPATH and intellisense

105 views
Skip to first unread message

Subramanian Sridharan

unread,
May 28, 2019, 6:32:51 AM5/28/19
to golang-nuts
I cannot use intellisense and have my own source packages be recognized at the same time.

Golang Server - ON
Infer GOPATH from root - False
GOPATH - Empty
Result - I get details on hover. But my own source package imports fail.

Golang Server - ON
Infer GOPATH from root - True
GOPATH - Empty
Result - Source package imports don't show error. No information on hover.

Golang Server - ON
Infer GOPATH from root - False
GOPATH - ~/go:~/dc_native   // The src is actually in ~/dc_native/x/y/
Result - I get details on hover. But my own source package imports fail.

Golang Server - ON
Infer GOPATH from root - False
GOPATH - ~/go:~dc_native/x/y  // Inside which src containing own source packages are present.
Result - Source package imports don't show error. No information on hover.

At some point, intellisense was working where I was able to get suggestions for structure members from another file of the same package.
I can't get that to work now.

Where am I going wrong?

PS: The GOPATH paths are actually absolute and not relative.


Trig

unread,
May 28, 2019, 11:06:20 AM5/28/19
to golang-nuts
I only got mine working 99% of the time with a language server configured in my settings:

{
"go.useLanguageServer": true,
"go.languageServerExperimentalFeatures": {
"diagnostics": true // for diagnostics as you type
},
"[go]": {
"editor.snippetSuggestions": "none",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
},
"gopls": {
"usePlaceholders": true, // add parameter placeholders when completing a function
"enhancedHover": true, // experimental to improve quality of hover (will be on by default soon)
},
"eslint.autoFixOnSave": true,
"prettier.eslintIntegration": true
}
Reply all
Reply to author
Forward
0 new messages