-
Notifications
You must be signed in to change notification settings - Fork 645
After upgrade to Go 1.10 intellisense autocompletion stops working #1723
Comments
I have the same problem with 1.10 on Windows 7/amd64. |
Same problem on Windows 10/amd64. |
Same with me.. on Mac |
Is everyone here on the latest version of the Go extension (0.6.82)? @ddrake17 You mentioned that To get the offset, you can use the extension https://marketplace.visualstudio.com/items?itemName=ramyaraoa.show-offset Others, can you check if you are using |
FYI from command line use |
Mine For
For
|
The
|
I really don't understand. This what I do:
And everything works like a charm. I think there are issue on migration from old gocode to new gocode. |
I ended up reinstalling |
So I manually installed
Command 1. gives the right output, where as the 2. gives wrong output. I think if vscode can switch to using 1., then it should work properly Obviously, code has to put the latest buffer into a temp file and then use that file and |
Please do things below:
Probably previously we missed the |
as @ZeroFTW suggested, switch to nsf and everything is fine. mdempsky version is buggy right now as it only works with built-in packages and not externally installed ones. |
@uudashr Adding the @MintyOwl,
Can you share the output of both? Me, @uudashr and @m90 are able to get completions for external installed packages as well. My gut feel is that @uudashr's findings of issues with migration must be causing this. Can you follow the steps in #1723 (comment) and let us know if this is still a problem? |
Also, let's first ensure that the right
|
@ramya-rao-a
But when I executed
|
I second what @uudashr says, I also think this is the automated migration not working as we'd like it to. I cannot repro any of the malfunctions locally. I installed This is my setup:
Unfortunately I think switching back to Also: one possible caveat that also had me trip and think Intellisense is broken a few times already: it is important to know that autocompletion on unimported packages will only be triggered if the package name is completely unabmiguous on the system. So if you type |
Alright, so I just started my Windows 10 64 bit machine running But, vscode (atleast on my machine) cannot autocomplete I tested on both version by completely killing the process one at a time, renaming them at |
@MintyOwl
Do you not see completions only for external packages or even for pkgs from std lib when using the |
@ramya-rao-a ok I tried running the json command as you suggested however gocode just hangs when I run
Although I deleted the |
I deleted the For
For
I'll try using the |
Confirmed, switching to Let me know if you need more info. Thanks! |
Thanks for those details @ddrake17! I've pushed a fix that will close any currently running I was able to replicate the issue of not getting any completions if there is a currently running gocode process of These 2 cases together should take care of a clean install and a possible explanation of gocode failure Everybody in this issue, please give the below a try and share what you find.
Note that I wasn't able to repro the |
@ramya-rao-a Do we know if this upstream issue is related: mdempsky/gocode#32 (it sounds very much like it)? |
@ramya-rao-a I followed your instructions and I still see the EDIT: After checking the JSON output from
Note that the type is properly recognized. In VS Code however I see this: What are the implications of using |
@ramya-rao-a I am noticing that even with the workaround above, in Mac, I can complete stdlib, but can't complete dep installed libraries (vendored dependencies)... I think it is an upstream issue with https://github.com/mdempsky/gocode Can you verify it works for you with dep installed dependencies I verified that it works for globally installed dependencies |
UPDATE: I found the issue with dep installed dependencies, gocode has an experimental feature to auto-compile the dependencies if they aren't compiled, this was user error on my end For anyone else running into this, all you need to do is run:
I would personally say this issue can be closed, I think everything is good now 👍 |
@LiPengfei19820619 I moved your comments to #1838. Let's continue there and save this thread from the noise |
I'm still seeing this on OSX 10.13.5, VS Code 1.26.0 4e9361845dc28659923a300945f84731393e210d x64, Go extension 0.6.88, golang 1.10.3. I delete the gocode binary from bin (nothing in src or pkg under mdempsky for that), verify the timestamp on the binary is new after running the package install, and I still seem to get the issue. When I run gocode in server / debug mode, it outputs: 2018/08/16 20:27:25 Error parsing input file (outer block): I think the ';' is something it does to work with vendored packages? (The function I'm trying to auto-complete is in this repository however) If I type it out manually I can build / test with no problems. |
It looks like gocode expects you to have dependencies installed ( |
The dependency is just a file one directory above, in the same repository. I know that they're different packages from go's perspective, but go get or go install don't seem to have any effect. |
@SpencerMacKinnon When you are trying to get completions for an external package, |
Looking in my package directory, it does look like I have the pkg file, telemetry.a. Here is the output of gocode when I run in debug / server:
And my source file:
|
And is that package recent. Run |
Looks like an issue has been created already, mdempsky/gocode#32 |
I have solved this problem luckily.. my machine=> I found there are I also delete mdempsky folder in GOPATH/src/github.com/mdempsky finally, after run |
I completely uninstalled vscode and all extensions, then reinstalled vscode, the go extension, and ran the go extension command to install / update tools. Seemed to have done the trick this time and I'm getting autocomplete now. Thanks for the support :) |
In my case I removed last backslash ("") from GOROOT and GOPATH environment variables to make it work. |
Completion of external packages was disabled in @mdempsky version of gocode because no caching was implemented: mdempsky/gocode#32 I've created a pull request with the caching and external packages enabled by default. The pull request is here: mdempsky/gocode#48 Just waiting on him to merge it. |
Did anyone make it work with projects residing outside of |
Is there any way to tell VS Code to pass |
use mdempsky/gocode instead of mdempsky/gocod solve my problem. |
Given that the former is already what's used I doubt that's the solution 😶. |
@daenney Can you try the below?
|
|
VSCode starts
Solution
😛 |
@weeezes Do you get prompted to install |
On my case, after 5-10 minutes VSCode stops autocompleting. I had to restart VSCode workspace over and over again. I do not know if my case is related to this issue but it makes me nuts here. Every project, just 5 minutes then no autocomplete anymore. Either click few files and wait 1-2 mins. to go restart itself (i think thats what it does) or close and reopen project. |
Not sure if this is related to the above. For me (go 1.11, Windows 10) auto-complete is not working for any packages outside of GOROOT. Debugging gocode I traced the issue to importer.joinPath in importer.go. This function is converting underscores to dashes in the GOOS_GOARCH part of the path. It is not clear to me why this is being done, but causes the search for binaries to fail, as the directory in my case has underscores (i.e. pkg/windows_amd64). Can anybody shed some light as to why this conversion is being done (maybe I'm missing something obvious)? |
@jcalvarado1965 Are you using modules? If yes, then please log an issue at https://github.com/mdempsky/gocode/, else log it at https://github.com/stamblerre/gocode @gencer What version of Go are you using? Please try the below to figure out if
|
This thread has gone too long and each person here might be facing completion issues for different reasons. Half of us here have already found solutions one way or the other. Therefore, I will be closing this thread. The If you see any issues follow the below which I have also captured in our FAQ:
|
I upgraded my Go distribution to
1.10
onWindows 7/amd64
and intellisense autocompletion stopped working for my custom packages. It is working for the standard library however. I've researched and tried solutions (#441) but nothing is working. I uninstalled all the Go tools and reinstalled, didn't fix it. Eventually I complete deleted all the%APPDATA%
andextensions
data for VS Code, uninstalled and reinstalled and this still did not fix the problem!My issue is pretty much like this old one: #167
Using the example from that issue fails to work on my setup. That is, with a custom
lib
package:and the following main:
I don't get any intellisense for the
lib
package. FWIW the intellisense on a.t says "invalid type".I kept looking into this further and eventually tried running
gocode
directly from the command line (both from the terminal inside VS code and a powershell window outside VS code) The thing is, this works perfectly. Here's the output I get with the exact code shown above:I thought it might be GOPATH related but I only have one GOPATH I ever use and running
Go: Current GOPATH
from VS Code shows the correct one.I'm pretty much out of ideas but I think this shows that this is
vscode-go
related and notgocode
. Please help. Thanks!The text was updated successfully, but these errors were encountered: