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

autocomplete not working for local packages #526

Closed
keyurva opened this issue Apr 14, 2014 · 51 comments

Comments

@keyurva
Copy link

commented Apr 14, 2014

I'm using ST3 on windows with the gosublime plugin. I'm developing an app engine application. Auto-complete works fine for packages from the standard library as well as from the app engine SDK. But it does not for local packages.

I've gone through a couple of issues related to this topic but to no avail. Appreciate your help.

Thanks,
Keyur

@mackross

This comment has been minimized.

Copy link

commented Jun 26, 2014

+1

@tj

This comment has been minimized.

Copy link

commented Jul 15, 2014

I get this pretty often as well, works once or twice then fails to pick up changes or fails all together

@mackross

This comment has been minimized.

Copy link

commented Jul 16, 2014

I've found if you import the packages all the way from your src folder it works. For example I'm working on a project in GO_PATH/src/github.com/mackross/projectA and I have two local packages GO_PATH/src/github.com/mackross/projectA/localPackageB and
GO_PATH/src/github.com/mackross/localPackageC.

I can get autocomplete by importing "github.com/mackross/projectA/localPackageB" & "github.com/mackross/localPackageC" rather than relative paths.

@amativos

This comment has been minimized.

Copy link

commented Sep 12, 2014

+1 for the issue. Gets really annoying. I always import from the src folder - still doesn't work.

@rshmelev

This comment has been minimized.

Copy link

commented Sep 12, 2014

+1, quite irritating.

@iamthemovie

This comment has been minimized.

Copy link

commented Sep 14, 2014

+1

I'm assuming this is the same issue. From what I can tell, you have to rebuild / reinstall the local package for it to update the autocomplete.

I have: $GOPATH/github.com/myapp/package/functions.go and to get an updated autocomplete I have to:

go install myapp/package

Autocomplete then updates. Is this to do with it reading binaries rather than source?

@rshmelev

This comment has been minimized.

Copy link

commented Sep 15, 2014

i'm calling "go install" on each ctrl+s using sublime "Command on Save" plugin.
it works almost perfectly (each save leads to 1-second lag now).

@iamthemovie

This comment has been minimized.

Copy link

commented Sep 15, 2014

@rshmelev I wonder if the process can be run in the background rather than causing any visible lag.

@iamthemovie

This comment has been minimized.

Copy link

commented Sep 15, 2014

I have a quick fix for it based on @rshmelev's comment.

https://github.com/iamthemovie/GoSublimeAutocompleteUpdate

@DisposaBlackSwan

This comment has been minimized.

Copy link

commented Sep 15, 2014

Assuming you're all using the main GS repo and go install is all it takes to make it work, you can run it using the on_save setting https://github.com/DisposaBoy/GoSublime/blob/master/articles/golint.md

@codepushr

This comment has been minimized.

Copy link

commented Sep 30, 2014

+1

1 similar comment
@zainhoda

This comment has been minimized.

Copy link

commented Oct 23, 2014

+1

@veegee

This comment has been minimized.

Copy link

commented Nov 17, 2014

+1

This plug in isn't well maintained anymore, is it? Are there any alternatives?

@ivpusic

This comment has been minimized.

Copy link

commented Dec 5, 2014

+1

4 similar comments
@Volox

This comment has been minimized.

Copy link

commented Feb 3, 2015

+1

@lukewilliamboswell

This comment has been minimized.

Copy link

commented Feb 17, 2015

+1

@Graha

This comment has been minimized.

Copy link

commented Feb 22, 2015

+1

@jaytaylor

This comment has been minimized.

Copy link

commented Apr 1, 2015

+1

@jaytaylor

This comment has been minimized.

Copy link

commented Apr 1, 2015

Local package auto-completion was working fine in ST3 until yesterday..now it is completely broken for me. Anyone have any advice or ideas on how to resolve?

I didn't know how much I appreciated this until I no longer had it. It's very annoying to go around opening files all the time to see what functions are available.

@jaytaylor

This comment has been minimized.

Copy link

commented Apr 1, 2015

Additional note: local-package auto-completion also no longer works for me in ST2.

@jaytaylor

This comment has been minimized.

Copy link

commented Apr 1, 2015

Alright, so I was able to fix it by taking the following steps:

  • Upgrading from go 1.4 to go 1.4.2
  • rm -rf ~/go/pkg/darwin_amd64

Cheers!

@coredump

This comment has been minimized.

Copy link

commented Apr 13, 2015

Is there a way to do the gs9o_open solution work without opening the bottom console?

@tylerl

This comment has been minimized.

Copy link

commented May 4, 2015

This problem goes away if you remove and re-create your personal GOPATH dir after go 1.4.2 upgrade.

@jaytaylor

This comment has been minimized.

Copy link

commented May 4, 2015

Great info, thanks!

On May 3, 2015, at 11:28 PM, Tyler Larson notifications@github.com wrote:

This problem goes away if you remove and re-create your personal GOPATH dir after go 1.4.2 upgrade.


Reply to this email directly or view it on GitHub.

@coredump

This comment has been minimized.

Copy link

commented May 4, 2015

What do you mean by recreate the path?

@codepushr

This comment has been minimized.

Copy link

commented May 5, 2015

Like remove my go directory or my GOPATH env variable?

@jaytaylor

This comment has been minimized.

Copy link

commented May 5, 2015

The directory - you want everything under $GOPATH/pkg to be wiped.

On May 4, 2015, at 5:31 PM, Aleksandar Palic notifications@github.com wrote:

Like remove my go directory or my GOPATH env variable?


Reply to this email directly or view it on GitHub.

@codepushr

This comment has been minimized.

Copy link

commented May 5, 2015

Alright but it's still not working for me. I just refactored a function name and it's still suggesting the old name even after relaunching Sublime. I guess the point is not to always recreate the pkg folder.

@jaytaylor

This comment has been minimized.

Copy link

commented May 5, 2015

I feel your pain, when it wasn't working for me I was pretty upset about it!

You may also try removing $GOHOME/pkg

e.g. /usr/local/go/pkg

On May 4, 2015, at 6:05 PM, Aleksandar Palic notifications@github.com wrote:

Alright but it's still not working for me. I just refactored a function name and it's still suggesting the old name even after relaunching Sublime. I guess the point is not to always recreate the pkg folder.


Reply to this email directly or view it on GitHub.

@robertobc

This comment has been minimized.

Copy link

commented Jan 26, 2016

Any ideas? This just started happening. Seems like it was after I upgraded to go v1.5.3.

@jaytaylor

This comment has been minimized.

Copy link

commented Jan 26, 2016

I definitely had similar issues the last time I upgraded go versions. Make sure to clear out previously compiled content from $GOPATH/pkg/*.

On Jan 25, 2016, at 9:10 PM, robertobc notifications@github.com wrote:

Any ideas? This just started happening. Seems like it was after I upgraded to go v1.5.3.


Reply to this email directly or view it on GitHub.

@tj

This comment has been minimized.

Copy link

commented Jan 26, 2016

@robertobc might be hitting #670. I didn't touch a single thing on my machine, it was fine, I saw GoSublime update and display the changelog, and then had issues, nothing to do with GOPATH etc unless GoSublime is fiddling with things.

@robertobc

This comment has been minimized.

Copy link

commented Jan 26, 2016

@tj It could be. I even tried reinstalling Sublime, Go and GoSublime. Still no luck.
The built in packages auto complete perfectly. The local ones don't.
I'm on OSX in case others are having issues on different platforms.

@codepushr

This comment has been minimized.

Copy link

commented Jan 26, 2016

@robertobc Try building your projects without errors, this sometimes fixed it for me. I found switching to vim-go a better alternative anyway.

@robertobc

This comment has been minimized.

Copy link

commented Jan 26, 2016

@codepushr In the past that usually fixed it for me as well. This time no luck though :(

@DisposaBoy

This comment has been minimized.

Copy link
Owner

commented Jan 26, 2016

Some potentially useful information should be printed in the console after attempting completion on a package for the first time... other than that, and with no way to re-produce this, I can't help much

@robertobc

This comment has been minimized.

Copy link

commented Jan 26, 2016

@DisposaBoy Thanks! I checked the console and for whatever reason this time I saw errors I never saw before. Seems like there was an error in the $GOPATH even though I hadn't changed it. Changing it to something new and then back fixed the issue.

@paulcwarren

This comment has been minimized.

Copy link

commented Mar 4, 2016

+1 pls!

@monissiddiqui

This comment has been minimized.

Copy link

commented Mar 8, 2016

+1

1 similar comment
@GeekyVenkat

This comment has been minimized.

Copy link

commented Mar 11, 2016

+1

@nishanttotla

This comment has been minimized.

Copy link

commented Mar 18, 2016

I started having this issue recently after updating to Go version 1.6. Tried @robertobc's idea of updating and changing back GOPATH, but local package changes aren't being updated for autocomplete. Anyone have suggestions?

UPDATE: Running a go install on Mac for the repo fixed it.

@wolfgangmeyers

This comment has been minimized.

Copy link

commented Aug 18, 2016

Also having this issue on 1.6. Importing from src makes no difference. Also not getting any autocomplete for some other packages, such as "github.com/stretchr/testify/mock". On ubuntu 16.04

@songleo

This comment has been minimized.

Copy link

commented Sep 1, 2016

+1

@RomanMinkin

This comment has been minimized.

Copy link

commented Oct 23, 2016

For govendor I have to ran following command every time I add a new package:

govendor install +vendor

fixed issue for me

Update: the correct command is govendor install +vendor, and i'm on OS X

@sharathbj

This comment has been minimized.

Copy link

commented Feb 5, 2017

I think the only solution to this problem is https://packagecontrol.io/packages/All%20Autocomplete

Enjoy!!!

@ishanray

This comment has been minimized.

Copy link

commented Jun 11, 2017

In Visual Studio Code, I can get autocomplete of builtin packages before importing.

package main

func main() {
    fmt.|
}

From here I can choose Println and after saving will autoimport the fmt package.

In GoSublime I need to import the package first before I see any completion. Is there a way to avoid that?

@songleo

This comment has been minimized.

Copy link

commented Jun 22, 2017

@ishanray u can use goimports, add a configuration in GoSublime.sublime-settings:

    "fmt_cmd": ["goimports"],

you can get it by run cmd go get golang.org/x/tools/cmd/goimports

@ishanray

This comment has been minimized.

Copy link

commented Jun 22, 2017

@songleo yes I do use goimports, but it requires me to save the file. In vscode even before saving the file I get autocomplete of local packages.

@darkwingg

This comment has been minimized.

Copy link

commented Aug 15, 2017

+1

@paulwalker

This comment has been minimized.

Copy link

commented Aug 22, 2017

FYI, for users of virtualgo (https://github.com/GetStream/vg), I found out that I needed to make sure to start sublime in the project directory and/or within a package directory located in the virtual GOPATH, so that sublime recognized the virtual GOPATH. You can user the "open log file" command to see the value that GoSublime (margo) uses.

@morganwu277

This comment has been minimized.

Copy link

commented May 30, 2018

@DisposaBoy DisposaBoy closed this Nov 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.