lsp-ivy
lsp-ivy copied to clipboard
args-out-of-range in function lsp-ivy--format-symbol-match
because the args kind may be 255, and it is args-out-of-range of lsp-ivy-symbol-kind-to-face.
Mybe it should check the args kind like this:
(lsp-defun lsp-ivy--format-symbol-match
((&SymbolInformation :name :kind :container-name? :location (&Location :uri))
project-root)
"Convert the match returned by lsp-mode into a candidate string."
(let* ((type (if (>= kind (length lsp-ivy-symbol-kind-to-face))
nil
(elt lsp-ivy-symbol-kind-to-face kind)))
(typestr (if lsp-ivy-show-symbol-kind
(propertize (format "[%s] " (car type)) 'face (cdr type))
""))
(pathstr (if lsp-ivy-show-symbol-filename
(propertize (format " · %s" (file-relative-name (lsp--uri-to-path uri) project-root))
'face font-lock-comment-face) "")))
(concat typestr (if (or (null container-name?) (string-empty-p container-name?))
(format "%s" name)
(format "%s.%s" container-name? name)) pathstr)))
thanks, that seems reasonable. If symbol kinds that large are in use, maybe lsp-ivy-symbol-kind-to-face should also be changed to an alist or something. With what language server did you get a symbolKind of 255, and does 255 represent something that users might want to add to lsp-ivy-symbol-kind-to-face?
It is "C" language, use ccls as the language server . The souce code is in 'openresty', file name is ngx_http_lua_common.h at line 127, the correspond souce code is #define NGX_HTTP_LUA_CONTEXT_INIT_WORKER 0x0100
When I use command lsp-ivy-global-workspace-symbol with param ngx_http_lua_init_worker, I can trigger this err.
thanks. I see that ccls defines 4 symbol kinds > 26 that users will probably want to be shown; still unsure as to whether I should change lsp-ivy-symbol-kind-to-face though. For the time being I'll just open a minimal PR that remaps symbol kinds beyond lsp-ivy-symbol-kind-to-face to unknown (so at least the symbols will remain horizontally aligned with labelled ones), could you please test if that works for you?
I tested the new version in the openresty souce code project with CCLS. It works very well. Although some symbol type shows [ ] (I found they are all in #define code), but I think it is acceptable. Thank you.