Skip to content

Commit

Permalink
Add customization group for lsp-imenu.
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhavp committed Jun 16, 2018
1 parent 8e1d896 commit 434240d
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions lsp-imenu.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,32 @@
(require 'lsp-methods)
(require 'seq)

(defgroup lsp-imenu nil
"Customization group for `lsp-imenu'."
:group 'lsp-mode)

(defcustom lsp-imenu-show-container-name t
"Display the symbol's container name in an imenu entry."
:type 'boolean
:group 'lsp-imenu)

(defcustom lsp-imenu-container-name-separator "/"
"Separator string to use to separate the container name from the symbol while displaying imenu entries."
:type 'string
:group 'lsp-imenu)

(define-inline lsp--point-to-marker (p)
(inline-quote (save-excursion (goto-char ,p) (point-marker))))

(defun lsp--symbol-to-imenu-elem (sym)
(let ((pt (lsp--position-to-point (gethash "start"
(gethash "range" (gethash "location" sym))))))
(cons (gethash "name" sym) (if imenu-use-markers (lsp--point-to-marker pt) pt))))
(let ((pt (lsp--position-to-point
(gethash "start" (gethash "range" (gethash "location" sym)))))
(name (gethash "name" sym))
(container (gethash "containerName" sym)))
(cons (if (and lsp-imenu-show-container-name container)
(concat container lsp-imenu-container-name-separator name)
name)
(if imenu-use-markers (lsp--point-to-marker pt) pt))))

(defun lsp--symbol-filter (sym)
(not
Expand Down

0 comments on commit 434240d

Please sign in to comment.