Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upStatement completion is working haphazardly #1872
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ramya-rao-a
Aug 24, 2018
Member
@leidegre This is due to our move from using nsf/gocode to its fork mdempsky/gocode as the former had issues with go 1.10 and above and the maintainer has no plans at present to fix them.
Do you see issues for symbols from external packages or even for the current package and packages form the std library?
Ensure that all the dependent packages in your current package are built. If you havent disabled the build on save feature, then a simple dummy change followed by file save should do it. Else, run Go: Build Current Package.
|
@leidegre This is due to our move from using Do you see issues for symbols from external packages or even for the current package and packages form the std library? Ensure that all the dependent packages in your current package are built. If you havent disabled the build on save feature, then a simple dummy change followed by file save should do it. Else, run |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
leidegre
Aug 25, 2018
@ramya-rao-a std library appears to be OK (most of the time) symbols from external packages, not so much. Symbols from current package, appear to work fine.
If I look in the statement completion list, it says invalid type for a lot of things.
But it can find the type in the current tcm package
It cannot find the type in a related but different package ddd:
If I change to a file that's in that package it works again.
So, It appears to work for the std library and current package but not my imported package.
leidegre
commented
Aug 25, 2018
|
@ramya-rao-a std library appears to be OK (most of the time) symbols from external packages, not so much. Symbols from current package, appear to work fine. If I look in the statement completion list, it says invalid type for a lot of things. But it can find the type in the current It cannot find the type in a related but different package If I change to a file that's in that package it works again. So, It appears to work for the std library and current package but not my imported package. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ramya-rao-a
Aug 26, 2018
Member
Try this:
- Close all VS Code instances
- Kill any running
gocodeprocess - Remove the
gocodebinary from your$GOPATH/binand the corresponding code form$GOPATH/src/github.com/nsf/gocodeor$GOPATH/src/github.com/mdempsky/gocode - If you added the
go.toolsGopathsetting, then use that instead of the $GOPATH above - Open VS Code, run
Go: Install/Update Tools, selectgocodeto install it - Ensure that you haven't disabled the
go.installDependenciesWhenBuildingsetting - Ensure all dependencies are built by running
Go: Build Current Package(It uses thego build -iso all dependencies will be built and installed) - Now try the completions
|
Try this:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
leidegre
Aug 26, 2018
@ramya-rao-a oh dear, thanks for the help! It did not fix the problem but I noticed something which might have been the root cause. However silly...
I use this script to configure and launch my environment
set GOPATH=%~dp0
set PATH=%PATH%;%GOPATH%\bin
start code .The GOPATH was being set with a trailing backwards slash, i.e.
When I reinstalled gocode
Installing 1 tool at C:\Users\leidegre\Source\tessin\tcm\tcm-backend\\bin
gocode
Note the double backslash \\ at the end there.
I changed by batch script to this
set ROOT=%~dp0
set GOPATH=%ROOT:~0,-1%
set PATH=%PATH%;%GOPATH%\bin
start code .
And now it actually works. It seems silly that such a thing would cause this but I guess it did... I know that backslashes specifically on Windows can cause issues with command lines if they are at the end. If there's a shell execute somewhere in the tooling the there is a trailing backslash that could cause it.
...I could do some further digging on this, at a later point, and see if I can suggest a fix or at the very least a warning for this.
leidegre
commented
Aug 26, 2018
|
@ramya-rao-a oh dear, thanks for the help! It did not fix the problem but I noticed something which might have been the root cause. However silly... I use this script to configure and launch my environment set GOPATH=%~dp0
set PATH=%PATH%;%GOPATH%\bin
start code .The When I reinstalled
Note the double backslash I changed by batch script to this
And now it actually works. It seems silly that such a thing would cause this but I guess it did... I know that backslashes specifically on Windows can cause issues with command lines if they are at the end. If there's a shell execute somewhere in the tooling the there is a trailing backslash that could cause it. ...I could do some further digging on this, at a later point, and see if I can suggest a fix or at the very least a warning for this. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
freman
Aug 28, 2018
Contributor
I had this problem on osx
I had an extra / on my go.gopath in the user settings.
Definitely worth documenting this :D
|
I had this problem on osx I had an extra / on my Definitely worth documenting this :D |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ramya-rao-a
Aug 29, 2018
Member
Well, if it is the extra / or \ in the end that is causing this, then its definitely a bug and we should fix this.
@freman I tried with the extra / in the go.gopath setting on my mac, and I am getting the completions just fine
@leidegre I am away from my Windows machine for the next few days, so I won't be able to figure out the fix just yet. But if you are interested, debugging the Go extension is very easy and you can give it a try.
All completion related code is in the goSuggest.ts file. You can add a breakpoint there to start
|
Well, if it is the extra @freman I tried with the extra @leidegre I am away from my Windows machine for the next few days, so I won't be able to figure out the fix just yet. But if you are interested, debugging the Go extension is very easy and you can give it a try. All completion related code is in the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
leidegre
Aug 29, 2018
@ramya-rao-a I'm crazy busy with a deadline this and next week but if this can remain open until then, I will get around to it, I care deeply for both the tooling and the VS Code ecosystem but since I have a viable workaround I will roll with it for now. If you want to jump on this before then, be my guest.
leidegre
commented
Aug 29, 2018
|
@ramya-rao-a I'm crazy busy with a deadline this and next week but if this can remain open until then, I will get around to it, I care deeply for both the tooling and the VS Code ecosystem but since I have a viable workaround I will roll with it for now. If you want to jump on this before then, be my guest. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ramya-rao-a
Aug 29, 2018
Member
@leidegre No problem. Just one question though. You can consistently repro this issue by adding a training \ in the end of the gopath in the settings correct?
|
@leidegre No problem. Just one question though. You can consistently repro this issue by adding a training |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
freman
Aug 29, 2018
Contributor
@ramya-rao-a I can no longer replicate it but code completion wasn't working for anything other than stdlib until I removed that slash, now it seems I can have the slash on or off.
|
@ramya-rao-a I can no longer replicate it but code completion wasn't working for anything other than stdlib until I removed that slash, now it seems I can have the slash on or off. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
abdullah2993
Sep 22, 2018
I had the same issue turn out it only occur if you set a diffrent GOPATH from the terminal and open vscode from that teminal. The solution is to set go.toolsPath to you original GOPATH
abdullah2993
commented
Sep 22, 2018
|
I had the same issue turn out it only occur if you set a diffrent |




leidegre commentedAug 24, 2018
•
edited
It sometimes work, most of the time not. It looks like it's working relatively well for local variables and types but not package wide stuff.
What would cause this, how do I debug this? What should I do? I'm at loss on how to get to the bottom of this so I thought I'd ask what the common issues are?
I'll gladly root cause the issue I'm just not overly familiar with how everything fits together. I didn't use to have this problem and the tooling has been working fine before but now, this is a new issue for me that is consistent on at least two of my workstations.
I've updated and installed the Go tools, on several occasions, and it is working but not particularly well.