nsf / gocode

An autocompletion daemon for the Go programming language
MIT License
5.01k stars 656 forks source link

go-autocomplete candidate duplicate #379

Open lienhua34 opened 8 years ago

lienhua34 commented 8 years ago

At my emacs, go-autocomplete gave me a duplicate candidate, dup

After I read the go-autocomplete.el, I found the following code,

(add-hook 'go-mode-hook #'(lambda ()
                           (add-to-list 'ac-sources 'ac-source-go)))

Because the ac-sources list default is '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers), the ac-sources will get the candidates both from ac-source-go and ac-source-words-in-samge-mode-buffers in go-mode buffer.

In my copy, I edited the go-autocomplete.el,

(add-hook 'go-mode-hook #'(lambda ()
                         (setq ac-sources '(ac-source-go ac-source-abbrev ac-source-dictionary))))

Then the duplicate candidate is gone, normal

lienhua34 commented 8 years ago

I'm sorry! My english is poor. I have no idea whether you can understand what I say above . ^_^

nsf commented 8 years ago

Well by default gocode adds itself to the list, you can redefine the list to whatever you want I guess. The duplicates you get doesn't seem like they come from gocode. The type is missing, it's more like local code autocompletion. The backends you've added in go-autocomplete.el are not defined there or whatever, I don't know elisp.