tigersoldier / company-lsp

Company completion backend for lsp-mode
GNU General Public License v3.0
251 stars 26 forks source link

Company: backend company-lsp error "Wrong type argument: char-or-string-p, nil #136

Open netjune opened 4 years ago

netjune commented 4 years ago

I set company-lsp-cache-candidates to t.

For example, in a go-mode buffer, the content:

package "main"

main () {

    ch|
}

Cursor is at the char '|' and there are completions with prefix "ch". After a command(yas-expand), "ch" becomes "<-".

package "main"

main () {

    <-|
}

Now the completion prefix is nil. company-mode still call the backend with arg 'match. Then company-lsp gets the prefix. The prefix is nil which cause the error.

It runs the code: (downcase nil)

netjune commented 4 years ago

It seems that whether the cache is enabled or not, the issue happens.

Now I think it is bug of company-mode. It only compares the current point with the saved one to decide whether to refresh candicates. In this case, the point doesn't change, but the prefix has changed (to nil).