Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is should-filter always return nil ? #140

Open
jadestrong opened this issue May 4, 2020 · 3 comments
Open

Is should-filter always return nil ? #140

jadestrong opened this issue May 4, 2020 · 3 comments

Comments

@jadestrong
Copy link

(and (null company-lsp-cache-candidates)

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
Copy link
Author

company-lsp/company-lsp.el

Lines 432 to 438 in f921ffa

(when (eq company-lsp-cache-candidates 'auto)
;; Only cache candidates on auto mode. If it's t company caches the
;; candidates for us.
(company-lsp--cache-put prefix (company-lsp--cache-item-new candidates incomplete)))
(if should-filter
(company-lsp--filter-candidates candidates prefix)
candidates)))

company-lsp/company-lsp.el

Lines 524 to 528 in f921ffa

(cond
((string= prefix subprefix)
;; Found exact match.
cache-item)
((company-lsp--cache-item-incomplete-p cache-item)

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
Copy link
Author

#141

@jadestrong
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant