DisposaBoy / GoSublime

A Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features.
MIT License
3.42k stars 302 forks source link

Completion on packages not yet imported #828

Closed fpeterschmitt closed 5 years ago

fpeterschmitt commented 6 years ago

Hello,

Working on some simple code:

package main

func main() {
    fmt.<hit ctrl+space>
}

In vscode, Atom or any other "big" IDE, that triggers completion on the given package fmt.

Any way to enable that in GoSublime or it is not yet supported?

Thanks

fpeterschmitt commented 6 years ago

In addition to the initial issue:

$ cat main.go | gocode autocomplete $(pwd)/main.go 33
Found 25 candidates:
....

Does GoSublime uses gocode?

DisposaBoy commented 6 years ago

Press ctrl+.,ctrl+x to enable the new version of margo. The comments should explain how to enable it in gocode. You will probably need to restart Sublime Text after saving the margo.go file.

fpeterschmitt commented 6 years ago

Hum. Did i missed something when gathering upgrades of GoSublime automatically? I mean, ctrl+.,ctrl+x is alway required?

In the margo.go file completion on unimported packages was already on true, so i didn't saved anything.

Also, is GoImports required?

DisposaBoy commented 6 years ago

The new version (margo.sh) is still in the alpha phase so it's not enabled by default. That's why you need to manually use those key bindings to enable it.

You still need to restart Sublime Text after, but only after, the first time you press those keys. After that, saving the file will automatically re-compile and re-start.

You can use either golang.GoFmt or golang.GoImports.

You can check that it's working by uncommenting // DayTimeStatus, and saving the file. The time should then appear in the status bar.

fpeterschmitt commented 6 years ago

It is currently working as expected, thanks for the infos!

If you think this issue should be closed please do so, i think this could be left opened for now for other users until this feature is enabled by default.

b5 commented 6 years ago

I just followed these instructions for installing the alpha and just wanted to say that it's working SO WELL. Thanks for all your work @DisposaBoy!