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

If table is a function, only passthrough if its result is non-nil #4684

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions lsp-completion.el
Original file line number Diff line number Diff line change
@@ -850,9 +850,19 @@ The return is nil or in range of (0, inf)."
"Disable LSP completion support."
(lsp-completion-mode -1))

(defun lsp-completion-passthrough-try-completion (string table _pred point)
"Passthrough try function, always return the passed STRING and POINT."
(when table
(defun lsp-completion-passthrough-try-completion (string table pred point)
"Passthrough try function.

If TABLE is a function, it is called with STRING, PRED and nil to get
the candidates, otherwise it is treated as the candidates.

If the candidates is non-empty, return the passed STRING and POINT."
(when (pcase table
((pred functionp)
(funcall table string pred nil))
((pred hash-table-p)
(not (hash-table-empty-p table)))
(_ table))
(cons string point)))

(defun lsp-completion-passthrough-all-completions (_string table pred _point)
Loading