-
Notifications
You must be signed in to change notification settings - Fork 9
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
finding symbols fails - (wrong-type-argument stringp) #19
Comments
I need the logs from client/server. Check lsp-mode's bug template for information how to obtain it. |
i'm working on a not-so-tiny workspace and enabling the logs generates hundreds of entries many of which containing information about the under the hood implementation of the corporate code base 😞 so i decided to try and track it down myself. here's what i could understand: ;;;;; helm-lsp.el
(defun helm-lsp--workspace-symbol (workspaces name input)
"Search against WORKSPACES NAME with default INPUT."
(setq helm-lsp-symbols-result nil)
(if workspaces
(with-lsp-workspaces workspaces
(helm
:sources
(helm-build-sync-source
name
:candidates (lambda () ...) ;; [1] ;;;;; helm.el
(defun helm-fuzzy-matching-default-sort-fn-1 (candidates &optional use-real basename preserve-tie-order)
...
(data1 (or (gethash cand1 table-scr)
(puthash cand1
(list (helm-score-candidate-for-pattern ;; [2]
cand1 helm-pattern)
(length (helm-stringify cand1)))
table-scr)))
...
(defun helm-score-candidate-for-pattern (candidate pattern)
...
(let* ((cand (if (stringp candidate)
candidate (helm-stringify candidate))) ;; [3] ;;;;; helm-lib.el
(defun helm-stringify (elm) ;; [4]
(string elm)
(number (number-to-string elm))
(symbol (symbol-name elm))))
later on, when what do you think? makes sense? |
I saw that in the callstack - what I cannot figure out is what is the value that causes that behavior. |
ok. i found a non-sensitive log i can share. does this help?
|
I encountered the same issue. |
FWIW, disabling fuzzy searching makes it work for me: ; :fuzzy-match t |
@malb where to disable "fuzzy searching"? Can you please elaborate it? Thanks! |
I just commented out the line reading (defun helm-lsp--workspace-symbol (workspaces name input)
"Search against WORKSPACES NAME with default INPUT."
(setq helm-lsp-symbols-result nil)
(if workspaces
(with-lsp-workspaces workspaces
(helm
:sources
(helm-build-sync-source
name
:candidates (lambda ()
(if helm-lsp-symbols-result-p
helm-lsp-symbols-result
(with-lsp-workspaces workspaces
(-let (((request &as &plist :id request-id) ))
(setq helm-lsp-symbols-request-id request-id)
(lsp-request-async
"workspace/symbol"
(list :query helm-pattern)
(lambda (candidates)
(setq helm-lsp-symbols-request-id nil)
(and helm-alive-p
(let ((helm-lsp-symbols-result-p t))
(setq helm-lsp-symbols-result candidates)
(helm-update))))
:mode 'detached
:cancel-token :workspace-symbols)
helm-lsp-symbols-result))))
:action 'helm-lsp-workspace-symbol-action
:volatile t
;; :fuzzy-match t
:match (-const t)
:keymap helm-map
:candidate-transformer
(lambda (candidates)
(-map
(-lambda ((candidate &as
&SymbolInformation :container-name? :name :kind :location (&Location :uri)))
(let ((type (or (alist-get kind lsp-symbol-kinds) "Unknown")))
(cons
(if (and (featurep 'lsp-treemacs)
helm-lsp-treemacs-icons)
(concat
(or (helm-lsp--get-icon kind)
(helm-lsp--get-icon 'fallback))
(if (s-blank? container-name?)
name
(concat name " " (propertize container-name? 'face 'helm-lsp-container-face)))
(propertize " · " 'face 'success)
(helm-lsp--extract-file-name uri))
(concat (if (s-blank? container-name?)
name
(concat name " " (propertize container-name? 'face 'helm-lsp-container-face) " -" ))
" "
(propertize (concat "(" type ")") 'face 'font-lock-type-face)
(propertize " · " 'face 'success)
(helm-lsp--extract-file-name uri)))
candidate)))
(-take helm-candidate-number-limit candidates)))
:candidate-number-limit nil
:requires-pattern 0)
:input input))
(user-error "No LSP workspace active"))) Neither right nor elegant but I can use it while this is getting fixed. |
@malb it doesn't work for me. issue still exists. Thank you anyway! |
hey 👋 running
helm-lsp-workspace-symbol
orhelm-lsp-global-workspace-symbol
invariably fails withError processing message (wrong-type-argument stringp nil).
as i type the symbol name.i'm using emacs-27.2 with helm, projectile and company. what could i be missing?
here's a sample backtrace. i didn't find a way to switch to the backtrace window w/o it being cleared by helm; hence the screenshot:
The text was updated successfully, but these errors were encountered: