Closed ulrichSchreiner closed 10 years ago
I guess new integration docs are a bit confusing. The full command spec you usually run from a text editor looks like this: gocode autocomplete <path> <cursor offset>
, and of course you pass the current buffer via stdin. The important part here is <path>
. While gocode doesn't support passing in multiple unsaved files, it will look for other files of the package on the file system using that path as a pointer to the directory.
For example, let's say you have a directory with your Go project: ~/mygo/src/proj
. And it has files a.go
and b.go
. In order for gocode to work properly you should invoke it like this: gocode autocomplete ~/mygo/src/proj/a.go 123
and pass a.go
contents via stdin. That way gocode will deduce the directory of your project to ~/mygo/src/proj
and will look for other .go
files there with matching package
clause.
Hopefully it makes sense.
Works like a charm.
Thanks.
hi
if i have multiple files in a package and send one of them via stdin to gocode, gocode seems to ignore all content of the other files of the same package.
For example: I have a package "mymodule" and there i have "mymodule.go" and "mymodule_test.go", both contain "package mymodule". if i send the "mymodule_test.go" via stdin to gocode, nothing from "mymodule.go" is recognized; all structs, functions ... no autocompletion for this elements is contained in the result.
how can i work around this problem?
thx