I was looking for autocomplete support that would be aware of all relevant Go 
packages (in GOPATH, in project and vendor'd); I played a bit with ctags but 
couldn't get anything out of it.

So here I am proposing to add autocomplete support through 
[gocode](https://github.com/nsf/gocode) which is pretty much what other editors 
use (although I find gocode buggy itself, but that is another topic).

## General idea of this PR
* we would need an option to use gocode, either enabled or disabled by default; 
possibly gocode port too in case you're running multiple gocode daemons
* once this feature is enabled, the `autocomplete_scope` radically changes 
behavior and instead of using `tm_workspace_find_scope_members` it would rely 
on a gocode CLI call for each autocomplete resolution request (yes, pricey, but 
useful)
* the gocode CLI call receives the current buffer text via stdin and the 
results are parsed into `TMTag` structures
* once tags are generated the autocomplete feature is pretty much unchanged (I 
am thinking of adding something for calltips, but not sure yet)

By the way, nice work with the block folding feature, I just noticed by 
compiling master.

## Feedback request
Please notice this is a few ours work (kind of a POC), but I would like to have 
early feedback.

## Known issues of this PR
* the tag creation should be improved and possibly moved to tagmanager (please 
advise on that)
* the feature should be configurable and better packaged
* not much used to C/GTK, so I don't even know how many leaks I am introducing 
here (possibly need to check with proper debug options or valgrind)
* will adjust to proper coding style (yes I noticed the style you are using)

It works already (in this shaky version), see screenshot:
![screen_geany1](https://cloud.githubusercontent.com/assets/7117866/24683195/e62fe3ac-199d-11e7-8422-4221aaf55c00.png)

You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany/pull/1457

-- Commit Summary --

  * Preliminary work to add gocode support for autocomplete

-- File Changes --

    M src/editor.c (242)

-- Patch Links --

https://github.com/geany/geany/pull/1457.patch
https://github.com/geany/geany/pull/1457.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1457

Reply via email to