company-lsp
company-lsp copied to clipboard
Completion not in the correct order?
Hello!
This has been bugging me for a while but, when I use auto-completion, it seems to me that the results are in a reversed order.
Example:
This is the output of company-diag
:
Emacs 28.0.50 (x86_64-pc-linux-gnu) of 2020-01-08 on xerxes
Company 0.9.12
company-backends: ((company-lsp company-files))
Used backend: (company-lsp company-files)
Major mode: c++-mode
Prefix: (#("re" 0 1
(fontified t)
1 2
(fontified t))
. t)
Completions:
#("req" 0 3 (lsp-completion-prefix #("re" 0 1 (fontified t) 1 2 (fontified t)) lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" "req" "kind" 9 "detail" "channer" "sortText" " !" "insertTextFormat" 1 "textEdit" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("range" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("start" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 19)) "end" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 21)))) "newText" "req")))))) " channer (Module)"
#("repo" 0 4 (lsp-completion-prefix #("re" 0 1 (fontified t) 1 2 (fontified t)) lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" "repo" "kind" 9 "detail" "channer" "sortText" " \"" "insertTextFormat" 1 "textEdit" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("range" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("start" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 19)) "end" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 21)))) "newText" "repo")))))) " channer (Module)"
#("execute_request(F &&request, std::function<void (T)> success, std::function<void (const std::string &)> failure) -> void" 0 120 (lsp-completion-prefix #("re" 0 1 (fontified t) 1 2 (fontified t)) lsp-completion-item #s(hash-table size 7 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" "execute_request(F &&request, std::function<void (T)> success, std::function<void (const std::string &)> failure) -> void" "kind" 3 "detail" "channer" "sortText" " #" "filterText" "execute_request" "insertTextFormat" 1 "textEdit" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("range" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("start" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 19)) "end" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 21)))) "newText" "execute_request")))))) " channer (Function)"
#("execute_request<typename T>(F &&request, G &&success, H &&failure) -> void" 0 74 (lsp-completion-prefix #("re" 0 1 (fontified t) 1 2 (fontified t)) lsp-completion-item #s(hash-table size 7 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" "execute_request<typename T>(F &&request, G &&success, H &&failure) -> void" "kind" 3 "detail" "channer" "sortText" " $" "filterText" "execute_request" "insertTextFormat" 1 "textEdit" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("range" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("start" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 19)) "end" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 21)))) "newText" "execute_request")))))) " channer (Function)"
#("get_thread(const std::string &board, const std::string &thread, std::function<void (std::optional<Thread>)> &&success, std::function<void (const std::string &)> &&failure) -> void" 0 179 (lsp-completion-prefix #("re" 0 1 (fontified t) 1 2 (fontified t)) lsp-completion-item #s(hash-table size 8 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" "get_thread(const std::string &board, const std::string &thread, std::function<void (std::optional<Thread>)> &&success, std::function<void (const std::string &)> &&failure) -> void" "kind" 3 "detail" "channer" "documentation" "Get Thread information" "sortText" " %" "filterText" "get_thread" "insertTextFormat" 1 "textEdit" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("range" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("start" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 19)) "end" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 21)))) "newText" "get_thread")))))) " channer (Function)"
#("get_thread_files(const std::string &board, const std::string &thread, std::function<void (std::vector<File>)> &&success, std::function<void (const std::string &)> &&failure) -> void" 0 181 (lsp-completion-prefix #("re" 0 1 (fontified t) 1 2 (fontified t)) lsp-completion-item #s(hash-table size 8 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" "get_thread_files(const std::string &board, const std::string &thread, std::function<void (std::vector<File>)> &&success, std::function<void (const std::string &)> &&failure) -> void" "kind" 3 "detail" "channer" "documentation" "Get list of files in Thread" "sortText" " &" "filterText" "get_thread_files" "insertTextFormat" 1 "textEdit" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("range" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("start" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 19)) "end" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("line" 14 "character" 21)))) "newText" "get_thread_files")))))) " channer (Function)"
This is my company-lsp
configuration:
(use-package company-lsp
:ensure t
:commands company-lsp
:custom
(company-lsp-cache-candidates t) ;; auto, t(always using a cache), or nil
(company-lsp-async t)
(company-lsp-enable-recompletion t)
:config (push 'company-lsp company-backends))
Thank you very much!
Can confirm. Did you manage to find a fix for this?
Hey @steven-lang
I did not find any fix for this. What I did was to uninstall CCLS and Company-LSP.
Now I use normal LSP mode with Clangd and, honestly, it works very well. I don't see the need of additional stuff when the default settings are pretty great.
@steven-lang company-lsp repo is not active - it is recommended to switch to company-capf.