Gabage completion items when cursor is at the end of a keyword.
netjune opened this issue · comments
Normal result of company-diag:
Emacs 26.1.50 (x86_64-pc-linux-gnu) of 2018-08-19 on centos7.home
Company 0.9.6
company-backends: (company-go company-dabbrev-code)
Used backend: company-go
Major mode: go-mode
Prefix: "don"
Completions:
#("done_chan" 0 9 (meta "var done_chan chan bool")) " chan bool"
Garbage completion after keyword "case":
Emacs 26.1.50 (x86_64-pc-linux-gnu) of 2018-08-19 on centos7.home
Company 0.9.6
company-backends: (company-go company-dabbrev-code)
Used backend: company-go
Major mode: go-mode
Prefix: "case"
Completions:
#("Client_Handshake_timeout" 0 24 (meta "const Client_Handshake_timeout ")) " "
#("Client_KeepAlive_timeout" 0 24 (meta "const Client_KeepAlive_timeout ")) " "
#("MAX_DATA_pkt_size" 0 17 (meta "const MAX_DATA_pkt_size ")) " "
#("MAX_Http_pkt_size" 0 17 (meta "const MAX_Http_pkt_size ")) " "
#("OP_BINARY" 0 9 (meta "const OP_BINARY ")) " "
#("OP_CLOSE" 0 8 (meta "const OP_CLOSE ")) " "
#("OP_CONTINUE" 0 11 (meta "const OP_CONTINUE ")) " "
#("OP_DATA_MAX" 0 11 (meta "const OP_DATA_MAX ")) " "
#("OP_MAX" 0 6 (meta "const OP_MAX ")) " "
#("OP_PING" 0 7 (meta "const OP_PING ")) " "
#("OP_PONG" 0 7 (meta "const OP_PONG ")) " "
#("OP_TEXT" 0 7 (meta "const OP_TEXT ")) " "
I think this is a bug with the company-go extension, because this doesn't happen for any other editor. I won't be able to investigate this, but will happily look at PRs if you are able to fix this problem.
I traced the function company-go--invoke-autocomplete of company-go. The gocode returns all symbols when cursor is after a space char, which is expected. But it also return all symbols when cursor is after a golang keyword (such as case, default, switch, return), which is not right.
Thanks for following up. I took a look and 7b3487b should fix it.