Reputation: 11264
I want to write a simple editor with basic autocomplete functionality for the Go language as a pet project. How would one go about doing it? I took a look at the Go plugins for Eclipse and IntelliJ, but they were too big for me to comprehend (not to mention getting one to compile).
Upvotes: 2
Views: 180
Reputation: 91203
The de facto standard approach to this problem is to use nsf's gocode. I have tried it only in Vim - it works very well.
Even though there's ready made support for specific editors, gocode is not editor specific. It's a daemon with a communication protocol. It is thus usable from any program.
Upvotes: 2
Reputation: 57609
The Go standard library offers the building blocks for a Go parser which you can use to parse the source files and look for function definitions and the like.
There's also the godoc
command which
already does what you want: extracting method definitions and it's documentation. You may look in the
source code to see how godoc
is
working or use godoc
directly.
This editor written in Go projects has a manageable amount of code, you may look into it.
Upvotes: 2