Giter VIP home page Giter VIP logo

gocode's People

Contributors

adamfaulkner avatar antifuchs avatar bad-ptr avatar bradwright avatar contextualist avatar danielmorsing avatar dougm avatar ebfe avatar fumiyas avatar ghiden avatar kodx avatar mattn avatar mikelikespie avatar mk0x9 avatar myitcv avatar negronjl avatar nhooyr avatar nicot avatar nrvnrvn avatar nsf avatar purcell avatar ryboe avatar sergey-shambir avatar syohex avatar tiziano88 avatar vanackere avatar wilfred avatar wmji avatar yasuyk avatar zchee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gocode's Issues

make install fails on Mac OS X 10.66

When running make install, I am getting

make install
6g -o go.6 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
config.go:4: import /Users/Jacob/gocode/configfile.a: object is [darwin amd64 release.r56 7666] expected [darwin amd64 release.2011-03-07 7666]
make: *** [go.6] Error 1

I updated the go compiler to the latest version as well as the gocode source.
I am not so keen on make files. Can someone help me out?

don't handle Chinese correctly

I am not sure whether this is a gocode issue.I am using eclipse+goclipse.
I have a struct

type Struct1 struct {
Content string
Action string
}


1 s:=new(Struct1)
2 s.Content="花大把时间精力,金钱学习Oracle" <----Chinese
3 s.Action="SUPPORT"


For above code snippet(same package with Struct1),in line 3,"s."---->ctrl+space,nothing got popuped,but if switch line3 with line2,everything works fine.I have checked,in a page(or a go file),not only a function,once Chinese comes up,gocode doesn't work after this line.

lib-path

lib-path merely overrides path to library.
adding path to packages would be great.
something like

$gocode set lib-path "/my/package/A/path;my/package/B/path" etc.

and just adding this paths to the search.

Doesn't compile

GOARCH=amd64
GOOS=linux

gocode version: aad94f
go version:
$ 6v -V
6g version 5777+

$ make install
gomake -C goremote
make[1]: Entering directory /home/temoto/src/gocode/goremote' /home/temoto/bin/6g -o _go_.6 goremote.go /home/temoto/bin/6l -o goremote _go_.6 make[1]: Leaving directory/home/temoto/src/gocode/goremote'
./goremote/goremote server.go > rpc.go
gomake -C goconfig
make[1]: Entering directory /home/temoto/src/gocode/goconfig' /home/temoto/bin/6g -o _go_.6 configfile.go configfile.go:307: cannot use perm (type uint32) as type int in function argument make[1]: *** [_go_.6] Error 1 make[1]: Leaving directory/home/temoto/src/gocode/goconfig'
make: *** [configfile.a] Error 2

Anonymous field as a child don't get proposed

If a type contains an anonymous field, methods of that field are being proposed, but not the field itself.

Example:
var hosts struct {
sync.Mutex
data map[string][]string
time int64
path string
}

Methods of sync.Mutex are being proposed, but not the Mutex field itself. It is legal to access that field directly, e.g.: hosts.Mutex.Lock()

Makefile only works with GNU make

OK, this actually is not a bug, but it would be great if you could mention it in the README file somehow - there are systems out there, where make is not the GNU one (e. g. FreeBSD). On these systems, gmake install would be the correct invocation.

build problem

Hi,
in your last commit you changed the following:

_, err = os.ForkExec(path, args, os.Environ(), "", []_os.File{nil, nil, nil})
to:
_, err = os.StartProcess(path, args, os.Environ(), "", []_os.File{nil, nil, nil})

Now i get a error at line 270:
gocode.go:270: undefined: os.StartProcess

I still works with the old pice of code.

Moddus

GOPATH support?

Hello,

You've got support in gocode for setting a lib-path in a config file, and support
for automatically picking up GOROOT and piecing together the path to the
pkg/${GOOS}_${GOARCH} directory.

I was wondering if you've considered adding in support for GOPATH, the new
variable used by goinstall to allow the separation of the go src tree from local
packages?

For example, gocode might check for lib-path, then fall back to checking for
GOPATH, and finally fall back to checking for GOROOT.

Jim

Autocompletion ignores unexported anonymous fields

A good example for that is reflect.*Value types. Autocompletion proposal on these doesn't include corresponding Value interface.

This bug is related to the type embedding. It caused by the fact that I intentionally ignore all unexported fields in imported modules (should fix that).

gocode compile error

hi all!
i get error when i try to make install gocode:

gocode$ make install
8g -o go.8 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
gocode.go:288: undefined: os.ProcAttr
gocode.go:289: not enough arguments in call to os.StartProcess
autocompletefile.go:239: lastCursorAfter.List undefined (type ast.CaseClause has no field or method List)
autocompletefile.go:240: lastCursorAfter.List undefined (type *ast.CaseClause has no field or method List)
make: *
* [go.8] Error 1

go$ hg identify
b84e614e2516 weekly/weekly.2011-03-28

2.6.35-25-generic #44-Ubuntu

help plz!

Compile error

$GOOS = linux
$GOARCH = 386

The error:

~/src/gocode$ make install
gomake -C goremote
make[1]: Entering directory /home/ali/src/gocode/goremote' 8g -o _go_.8 goremote.go goremote.go:19: undefined: reflect.Typeof make[1]: *** [_go_.8] Error 1 make[1]: Leaving directory/home/ali/src/gocode/goremote'
make: *** [goremote/goremote] Error 2

And compiler version:

~/src/gocode$ 8g -V
8g version weekly.2011-04-13 8238

I can use gocode with vim

Hi friend:

I been following all of steps for configure gocode with editor vim , and it not works.

only shows i.e. if I write "pack" then presents "package",

but if write "fmt." (not shows nothing)

any idea?

PANIC when completing in vim

Hi,

First of all I'd like to say I'm completely new to go, so apologies if this report is stupid. I just find your package so nice that I really want to use it!

Anyways, I get "PANIC" as the only suggestion when completing from vim. Using gocode -s gives the following trace:

[joel@mouton test]$ gocode -s
panic: expected "@", got String ("""")
1(runtime.panic): /build/src/release-build/src/pkg/runtime/proc.c:1235
2(main.(_gcParser).error): /home/joel/workspace/gocode/package.go:256
3(main.(_gcParser).errorf): /home/joel/workspace/gocode/package.go:260
4(main.(_gcParser).expect): /home/joel/workspace/gocode/package.go:267
5(main.(_gcParser).parseExportedName): /home/joel/workspace/gocode/package.go:331
6(main.(_gcParser).parseConstDecl): /home/joel/workspace/gocode/package.go:648
7(main.(_gcParser).parseDecl): /home/joel/workspace/gocode/package.go:803
8(main.(_gcParser).parseExport): /home/joel/workspace/gocode/package.go:832
9(main.(_PackageFileCache).processPackageData): /home/joel/workspace/gocode/package.go:131
10(main.(*PackageFileCache).updateCache): /home/joel/workspace/gocode/package.go:89
11(main._func_008): /home/joel/workspace/gocode/autocompletecontext.go:283
12(runtime.goexit): /build/src/release-build/src/pkg/runtime/proc.c:246

panic: One of the package cache updaters panicked
1(runtime.panic): /build/src/release-build/src/pkg/runtime/proc.c:1235
2(main.updatePackages): /home/joel/workspace/gocode/autocompletecontext.go:291
3(main.(_AutoCompleteContext).updateCaches): /home/joel/workspace/gocode/autocompletecontext.go:159
4(main.(_AutoCompleteContext).Apropos): /home/joel/workspace/gocode/autocompletecontext.go:209
5(main.Server_AutoComplete): /home/joel/workspace/gocode/server.go:82
6(main.(_RPCRemote).RPCServer_AutoComplete): /home/joel/workspace/gocode/rpc.go:27
7(reflect.internalValue.call): /build/src/release-build/src/pkg/reflect/value.go:583
8(reflect.Value.Call): /build/src/release-build/src/pkg/reflect/value.go:433
9(rpc.(_service).call): /build/src/release-build/src/pkg/rpc/server.go:341
10(runtime.goexit): /build/src/release-build/src/pkg/runtime/proc.c:246

I'm using go r60 as packaged by Arch Linux, and the git version of your package. Any idea what might be wrong?

vim as submodule

Feel free to ignore this suggestion, but many people use things like pathogen to manage their vim bundles and it helps to be able to point a git submodule to a folder that has just the vim code. It would be nice if your vim folder was a submodule of a branch of gocode so that people can submodule gocode into their vim bundles without having to change anything.

I did an example of what I mean in my fork:
https://github.com/doug/gocode

Which as an example I submodule into something like this:
https://github.com/doug/vimfiles

If there is a better way to do this I'm all ears.

Error 'undefined: os.ProcAttr' running make install.

I get the following error when running make install.

8g -o go.8 goremote.go
8l -o goremote go.8
make[1]: Leaving directory /home/dave/gocode/goremote' ./goremote/goremote server.go | gofmt > rpc.go gomake -C goconfig make[1]: Entering directory/home/dave/gocode/goconfig'
8g -o go.8 configfile.go
rm -f _obj/configfile.a
gopack grc _obj/configfile.a go.8
make[1]: Leaving directory `/home/dave/gocode/goconfig'
cp goconfig/_obj/configfile.a .
8g -o go.8 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
gocode.go:288: undefined: os.ProcAttr
gocode.go:289: not enough arguments in call to os.StartProcess
autocompletefile.go:239: lastCursorAfter.List undefined (type ast.CaseClause has no field or method List)
autocompletefile.go:240: lastCursorAfter.List undefined (type *ast.CaseClause has no field or method List)
make: *
* [go.8] Error 1

I'm using GNU make 3.81. Fresh install of go.

Let me know if you need any more information.

Could you tag and/or branch against go release tags?

Would you consider tagging your repository with names that match the go tags?

I know that the go source is in hg and gocode is in git, but if you could have some indication which release you've built against, that would be really helpful.

Using gocode from command-line

Hi,

I'm interested in providing autocomplete support for the SciTE editor. Passing the current cursor position and file, and parsing the output for a drop-down is not likely to be difficult. But I have hit an immediate snag: I always get a panic in the server by invoking 'gocode autocomplete full-path-to.go cursor-pos' directly.

This appears in ripper.go, line 40, presumably out of range on the slice there.

(Using the latest Go release )

steve d.

Splitting vim configuration out of gocode

I would find it useful for the vim configuration to be installable by pathogen. I believe the vim/ directory just needs to be split out to a top level directory.

Regards,
Ryan

Broken for weekly.2011-04-27

It is broken, and it cannot be fixed with gofix. I don't have time to do that. What's more sadly, it's broken because of the change in packages format, my parser simply cannot parse Go's libraries anymore. Suddenly in interfaces there are entries like:

"reflect".common() *"reflect".commonType

And it doesn't make sense to me. Frankly, I don't want to know, since I don't use Go anymore.

Feel free to fix it by yourself or better fork gocode and maintain it.

Can't build on Mac OS X 10.6.4

Hi,
when I run make, I get this:
make
gomake -C goremote
6l -o goremote go.6
panic: asmand: bad address (GS)
panic: asmand: bad address (GS)
schedinit: asmand: bad address 8(GS)
schedinit: asmand: bad address 8(GS)
schedinit: asmand: bad address 8(GS)
goexit: asmand: bad address (GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
nextgandunlock: asmand: bad address 8(GS)
mstart: asmand: bad address (GS)
mstart: asmand: bad address 8(GS)
mstart: asmand: bad address 8(GS)
mstart: asmand: bad address 8(GS)
too many errors
make[1]: *** [goremote] Error 1
make: *** [goremote/goremote] Error 2

I'm running Mac OS X 10.6.4, with the latest go from the repository.

Unicode characters are not handled properly

I am using gocode via GoSublime, but I've tested this out by running gocode manually as well.

Consider the following program:

package main

import (
  "os"
)

// U+03C0: π
func main() {
  os.
}

If I ask gocode for autocomplete suggestions at position 65 (right after 'os.') it returns
[2, [{"class": "package", "name": "os", "type": ""}]]

If I ask gocode for autocomplete suggestions at position 66 (the next line, right before the '}') it returns everything from the os package. If the 'π' is replaced by any ASCII character the autocomplete returns all of this at position 65 as expected.

Panic in filePackageName when directory has `.go` extension

While doing autocomplete within certain files, sometimes it would fail by just supplying PANIC as the only completion. Here is an example with fmt:
package main

import (
    "fmt"
)

func main() {
    fmt.PANIC
    println("Hello, world!")
}

Here is the error as reported by gocode -s:
panic: runtime error: invalid memory address or nil pointer dereference
1(runtime.panic): /Users/sday/go/src/pkg/runtime/proc.c:1010
2(runtime.panicstring): /Users/sday/go/src/pkg/runtime/runtime.c:86
3(runtime.sigpanic): /Users/sday/go/src/pkg/runtime/darwin/thread.c:460
4(main.filePackageName): /Users/sday/go/gocode/autocompletecontext.go:398
5(main.findOtherPackageFiles): /Users/sday/go/gocode/autocompletecontext.go:387
6(main.getOtherPackageFiles): /Users/sday/go/gocode/autocompletecontext.go:332
7(main._AutoCompleteContext·updateCaches): /Users/sday/go/gocode/autocompletecontext.go:153
8(main._AutoCompleteContext·Apropos): /Users/sday/go/gocode/autocompletecontext.go:208
9(main.Server_AutoComplete): /Users/sday/go/gocode/server.go:85
10(main._RPCRemote·RPCServer_AutoComplete): /Users/sday/go/gocode/rpc.go:25
11(reflect._FuncValue·Call): /Users/sday/go/src/pkg/reflect/value.go:817
12(rpc.*service·call): /Users/sday/go/src/pkg/rpc/server.go:335
13(runtime.goexit): /Users/sday/go/src/pkg/runtime/proc.c:142

The problem arises when one has a directory named with the extension .go in the current directory:

$ ls -l
total 8
drwxr-xr-x  2 sday  staff  68 Dec  5 12:36 somedir.go
-rw-r--r--  1 sday  staff  73 Dec  5 12:36 test.go

In this case, parser.ParseFile returns nil, with an error and the daemon panics when trying to dereference the nil value. A simple fix like this solved the problem:
diff --git a/autocompletecontext.go b/autocompletecontext.go
index 7e3b8dd..aeb9a0b 100644
--- a/autocompletecontext.go
+++ b/autocompletecontext.go
@@ -395,7 +395,13 @@ func findOtherPackageFiles(filename, packageName string) []string {
}

 func filePackageName(filename string) string {
-       file, _ := parser.ParseFile(filename, nil, parser.PackageClauseOnly)
+       file, err := parser.ParseFile(filename, nil, parser.PackageClauseOnly)
+
+    if err != nil {
+        fmt.Printf("Error parsing %s: %v\n", filename, err)
+        return ""
+    }
+
        return file.Name.Name
 }

However, you may want to not even pass directories to this function.

Got errors when make install

I use “8g version weekly.2011-03-15 7807” to make the gocode.
But I got:

8g -o go.8 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
autocompletefile.go:230: undefined: ast.TypeCaseClause
autocompletefile.go:232: undefined: ast.TypeCaseClause
autocompletefile.go:246: typechecking loop
make: *** [go.8] error 1

allow gorun hashbang

it would be cool if gocode could ignore the
#!/usr/bin/gorun
line, so that it works with gorun scripts.
As there exists an alternative to gorun maybe it would be good just to ignore #!/bin/ when it's in the first line.

PANIC PANIC PANIC

In following code, and cursor at //

package main

type Foo struct {
    Boo func();
    Baz string;
}

func foo() *Foo {
    return &Foo {}
}

func main() {
    foo(). // type CTRL-X CTRL-O in vim
}

it make candidate PANIC PANIC PANIC

Compilation Error

OS: Ubutnu 10.10 amd64
COMPILER: 6g version release.r57.2 8306

I got this error

6g -o go.6 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
os_posix.go:14: undefined: os.Signal
os_posix.go:19: undefined: os.SIGINT
os_posix.go:19: undefined: os.SIGTERM
make: *** [go.6] Error 1

Compilation problem

I am trying to compile the code, but once I download gocode, I get an error:

$ cd gocode
$ make
Makefile:1: /src/Make.inc: No such file or directory
Makefile:24: /src/Make.cmd: No such file or directory
make: *** No rule to make target `/src/Make.cmd'. Stop.

How can I compile the code?

Does not compile

6g version weekly.2011-04-04 8081
GOOS=darwin
GOARCH=amd64

6g -o go.6 configfile.go
configfile.go:256: too many arguments in call to os.Open
configfile.go:307: undefined: os.O_CREAT
configfile.go:307: too many arguments in call to os.Open
make[1]: *** [go.6] Error 1
make: *** [configfile.a] Error 2

config.go compilation problem.

config.go:107: invalid operation: nm == name (mismatched types reflect.StructTag and string)
config.go:179: cannot use name (type reflect.StructTag) as type string in function argument

Go's been updated so that tags on fields are not simple strings, but encoded key-value pairs.

type Foo struct {
bar int "This is not a description"
baz int "desc": "This is a correct tag"
}

The first tag cannot be retrieved from the reflection API.

Type detection for :=

Could it be possible to detect the type with :=?

a := myfunc() should be form the type of return of the function.

Regards

Compiler error when installing gocode on Mac Os X

I get the following error message when trying to compile gocode on Mac Os X, 10.6 snow leopard, mac book pro.

6g -o go.6 gocode.go autocompletefile.go package.go autocompletecontext.go server.go rpc.go decl.go apropos.go scope.go ripper.go config.go declcache.go os_posix.go
gocode.go:288: undefined: os.ProcAttr
gocode.go:289: not enough arguments in call to os.StartProcess
autocompletefile.go:239: lastCursorAfter.List undefined (type ast.CaseClause has no field or method List)
autocompletefile.go:240: lastCursorAfter.List undefined (type *ast.CaseClause has no field or method List)
make: *
* [go.6] Error 1

I have checked the paths etc.

compilation fails with release.2010-12-15.1

~/gocode$ make install
gomake -C goremote
make[1]: Entering directory /home/xxx/gocode/goremote' 6g -o _go_.6 goremote.go goremote.go:221: undefined: token.NewFileSet goremote.go:222: cannot use nil as uint goremote.go:222: cannot convert nil to type uint goremote.go:222: cannot use nil as type uint in function argument goremote.go:222: too many arguments to function call make[1]: *** [_go_.6] Error 1 make[1]: Leaving directory/home/xxx/gocode/goremote'
make: *** [goremote/goremote] Error 2

two suggestions(Sorry,didn't find a place to post suggestions)

First of all,thank you for fantastic work.
Eclipse+gocode is used here.Two suggestions:
1,After picking a suggested entry,parentheses should be added automatically.
2,Handle case issue.I mean,when type 'p',both suggestions that begins with 'P' and 'p' should be shown,of course,sorting them.And if no suggestions begins with 'p',show entries begins with 'P'...

Unable to install using goinstall

Trying to install gocode using goinstall, one gets the following error message:

$ goinstall github.com/nsf/gocode
goinstall: : path "~/configfile" not inside a GOPATH

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.