tigersoldier / company-lsp

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

Is should-filter always return nil ? #140

Open jadestrong opened 4 years ago

jadestrong commented 4 years ago

https://github.com/tigersoldier/company-lsp/blob/f921ffa0cdc542c21dc3dd85f2c93df4288e83bd/company-lsp.el#L427

null is a function defined in C source code.

Signature
(null OBJECT)

Documentation
Return t if OBJECT is nil, and return nil otherwise.

I think there should be if company-lsp-cache-candidates not nil, then get config from filter candidates , so the code should be:

(and (not (null company-lsp-cache-candidates))
                                 (company-lsp--get-config company-lsp-filter-candidates server-id))
jadestrong commented 4 years ago

https://github.com/tigersoldier/company-lsp/blob/f921ffa0cdc542c21dc3dd85f2c93df4288e83bd/company-lsp.el#L432-L438

https://github.com/tigersoldier/company-lsp/blob/f921ffa0cdc542c21dc3dd85f2c93df4288e83bd/company-lsp.el#L524-L528

Here also has an another problem, when should-filter is t, but company-lsp--cache-put only cached the unfiltered candidates. Then company-lsp--cache-get will return the unfiltered candidates.

jadestrong commented 4 years ago

141

jadestrong commented 4 years ago

Maybe we should filter cache-item in company-lsp--cache-get , not cache filtered candidates? Then we can reuse the candidates when there had a prefix closed to the cached prefix.