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

args-out-of-range in function lsp-ivy--format-symbol-match #19

Open
a1406 opened this issue Aug 29, 2020 · 4 comments
Open

args-out-of-range in function lsp-ivy--format-symbol-match #19

a1406 opened this issue Aug 29, 2020 · 4 comments

Comments

@a1406
Copy link

a1406 commented Aug 29, 2020

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)))
@sebastiansturm
Copy link
Contributor

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?

@a1406
Copy link
Author

a1406 commented Aug 30, 2020

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.

sebastiansturm added a commit to sebastiansturm/lsp-ivy that referenced this issue Aug 31, 2020
sebastiansturm added a commit to sebastiansturm/lsp-ivy that referenced this issue Aug 31, 2020
@sebastiansturm
Copy link
Contributor

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?

@a1406
Copy link
Author

a1406 commented Sep 1, 2020

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.

sebastiansturm added a commit to sebastiansturm/lsp-ivy that referenced this issue Nov 4, 2020
sebastiansturm added a commit that referenced this issue Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants