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

show containername with comment-face #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions lsp-ivy.el
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
:group 'lsp-ivy
:type 'boolean)

(defcustom lsp-ivy-show-containername
t
"Whether to show the containername to a symbol's point of definition."
:group 'lsp-ivy
:type 'boolean)

(defcustom lsp-ivy-filter-symbol-kind
nil
"A list of LSP SymbolKind's to filter out."
Expand Down Expand Up @@ -132,7 +138,7 @@ SymbolKind (defined in the LSP)."
(forward-char character))

(lsp-defun lsp-ivy--format-symbol-match
((sym &as &SymbolInformation :kind :location (&Location :uri))
((sym &as &SymbolInformation :kind :container-name? :location (&Location :uri))
project-root)
"Convert the match returned by `lsp-mode` into a candidate string."
(let* ((sanitized-kind (if (< kind (length lsp-ivy-symbol-kind-to-face)) kind 0))
Expand All @@ -142,8 +148,15 @@ SymbolKind (defined in the LSP)."
""))
(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 (lsp-render-symbol-information sym ".") pathstr)))
'face font-lock-comment-face)
""))
(containerstr (if (and lsp-ivy-show-containername
container-name?
(not (string-empty-p container-name?)))
(propertize (format " %s" container-name?)
'face font-lock-comment-face)
"")))
(concat typestr (lsp-render-symbol-information sym nil) containerstr pathstr)))

(lsp-defun lsp-ivy--transform-candidate ((symbol-information &as &SymbolInformation :kind)
filter-regexps? workspace-root)
Expand Down