Completion stops working intermittently with lsp-mode #374
-
ProblemSometimes completing a symbol with SetupI use Disclaimer: I'm very much a emacs-beginner, so it's more than likely that this is just some user error or problem in my emacs configuration. How to reproduce and/or resolveWhen testing this I tried to completions on the following Clojure form Unfortunately I don't have a fool-proof way to reproduce this nor how to fix it once it happens. It feels like there's some kind of caching issue. For example, if completion for some form (e.g. I tried playing around with the DebuggingAt first I looked at the communication between the LSP client and the server. I have no idea how the LSP protocol and the completion system in emacs interact, but from what I've deducted: something ( To debug Log - Completion successlsp-completion-at-point@126 => input=223:228:"http/" table=(#("http/*current-middleware*" 0 25 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/*current-middleware*" 0 25 ...) "kind" 6 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "*current-middleware*" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 1119 "name-col" 3))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) #("http/accept-encoding-value" 0 26 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/accept-encoding-value" 0 26 ...) "kind" 3 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "accept-encoding-value" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 732 "name-col" 7))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) #("http/basic-auth-value" 0 21 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/basic-auth-value" 0 21 ...) "kind" 3 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "basic-auth-value" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 821 "name-col" 7))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) #("http/check-url!" 0 15 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/check-url!" 0 15 ...) "kind" 3 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "check-url!" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 1163 "name-col" 12))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) #("http/client-error?" 0 18 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/client-error?" 0 18 ...) "kind" 3 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "client-error?" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 224 "name-col" 7))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) ...) annotation-function=lsp-completion--annotate company-kind=lsp-completion--candidate-kind company-deprecated=lsp-completion--candidate-deprecated company-require-match=never company-prefix-length=t company-match=lsp-completion--company-match company-doc-buffer=# exit-function=# lsp-completion-at-point@126(action=metadata input=223:228:"http/" prefix="http/" ignore-case=nil) => (metadata (category . lsp-capf) (display-sort-function . identity) (cycle-sort-function . identity)) lsp-completion-at-point@126(action=(boundaries . "") input=223:228:"http/" prefix="http/" ignore-case=nil predicate=#) => nil lsp-completion-at-point@126(action=metadata input=223:228:"http/" prefix="http/" ignore-case=nil) => (metadata (category . lsp-capf) (display-sort-function . identity) (cycle-sort-function . identity)) lsp-completion-at-point@126(action=(boundaries . "") input=223:228:"http/" prefix="http/" ignore-case=nil) => nil [2 times] lsp-completion-at-point@126(action=all input=223:228:"http/" prefix="" ignore-case=t regexp=("\\(?:http/\\)")) => (#("http/*current-middleware*" 0 25 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/*current-middleware*" 0 25 ...) "kind" 6 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "*current-middleware*" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 1119 "name-col" 3))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) #("http/accept-encoding-value" 0 26 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/accept-encoding-value" 0 26 ...) "kind" 3 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "accept-encoding-value" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 732 "name-col" 7))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) #("http/basic-auth-value" 0 21 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/basic-auth-value" 0 21 ...) "kind" 3 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "basic-auth-value" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 821 "name-col" 7))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) #("http/check-url!" 0 15 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/check-url!" 0 15 ...) "kind" 3 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "check-url!" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 1163 "name-col" 12))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) #("http/client-error?" 0 18 (lsp-completion-item #s(hash-table size 6 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("label" #("http/client-error?" 0 18 ...) "kind" 3 "data" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("unresolved" [["documentation" #s(hash-table size 4 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "client-error?" "uri" "file:///home/lassemaatta/.emacs.d/workspace/.cache/clj_http.client.clj" "name-row" 224 "name-col" 7))] ["alias" #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("ns-to-add" "clj-http.client" "alias-to-add" "http" "uri" "file:///home/lassemaatta/work/uimaranta_basis/src/uimaranta_basis/core.clj"))]])) "score" 8 "_emacsStartPoint" 223)) lsp-sort-text nil lsp-completion-start-point 223 lsp-completion-markers ... lsp-completion-prefix "http/" match-data ...)) ...) lsp-completion-at-point@126(action=(boundaries . "") input=223:228:"http/" prefix="http/" ignore-case=nil) => nil Log - Completion failurelsp-completion-at-point@93 => input=223:228:"http/" table=nil annotation-function=lsp-completion--annotate company-kind=lsp-completion--candidate-kind company-deprecated=lsp-completion--candidate-deprecated company-require-match=never company-prefix-length=t company-match=lsp-completion--company-match company-doc-buffer=# exit-function=# lsp-completion-at-point@93(action=metadata input=223:228:"http/" prefix="http/" ignore-case=nil) => (metadata (category . lsp-capf) (display-sort-function . identity) (cycle-sort-function . identity)) lsp-completion-at-point@93(action=(boundaries . "") input=223:228:"http/" prefix="http/" ignore-case=nil predicate=#) => nil lsp-completion-at-point@93(action=all input=223:228:"http/" prefix="" ignore-case=t regexp=("\\(?:http/\\)") predicate=#) => nil lsp-completion-at-point@93(action=(boundaries . "") input=223:228:"http/" prefix="http/" ignore-case=nil) => nil lsp-completion-at-point@93(action=try input=223:228:"http/" prefix="http/" ignore-case=nil) => nil lsp-completion-at-point@93(action=(boundaries . "") input=223:228:"http/" prefix="http/" ignore-case=nil) => nil lsp-completion-at-point@93(action=all input=223:228:"http/" prefix="http" ignore-case=nil regexp=("\\`http.*?/")) => nil Comparing the two I can see that the success case has an entry with a bunch of results:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Do you use https://github.com/minad/corfu/wiki#configuring-corfu-for-lsp-clients? |
Beta Was this translation helpful? Give feedback.
I did a bit more testing. I disabled
corfu
and used the default completion method (not sure what it's called, the*Completions*
buffer thing) and the same problem still occurs. Also, starting a "plain LSP" instance withlsp-start-plain
also exhibits this issue. Therefore, I think I'll raise this issue over atlsp-mode
and see if they have any ideas what's going on.