Skip to content

Commit 84e592e

Browse files
DivvyCrbrotzeit
authored andcommitted
Fix `lsp-ui-imenu' sub-title ordering.
1 parent ca195f3 commit 84e592e

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

lsp-ui-imenu.el

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
(let ((ov (make-overlay (point) (point)))
203203
(title-color (lsp-ui-imenu--get-color (+ color-index depth))))
204204
(overlay-put
205-
ov 'after-string
205+
ov 'before-string
206206
(concat (lsp-ui-imenu--pad " " padding bars depth color-index t is-last)
207207
(propertize title 'face `(:foreground ,title-color))
208208
(propertize "\n" 'face '(:height 1))))))
@@ -220,31 +220,30 @@ DEPTH is the depth of the items in the index tree, starting from 0.
220220
COLOR-INDEX is the index of the color of the leftmost bar.
221221
222222
Return the updated COLOR-INDEX."
223-
(let ((len (length items)))
224-
(--each-indexed items
225-
(let ((is-last (= (1+ it-index) len)))
226-
(if (imenu--subalist-p it)
227-
(-let* (((sub-title . entries) it))
228-
(if (= depth 0)
229-
(lsp-ui-imenu--put-toplevel-title sub-title color-index)
230-
(lsp-ui-imenu--put-subtitle sub-title padding bars depth color-index is-last))
231-
(when (and is-last (> depth 0))
232-
(aset bars (1- depth) nil))
233-
(let ((lsp-ui-imenu-kind-position (if (> depth 0) 'top
234-
lsp-ui-imenu-kind-position)))
235-
(lsp-ui-imenu--insert-items sub-title
236-
entries
237-
padding
238-
bars
239-
(1+ depth)
240-
color-index))
241-
(when (and is-last (> depth 0))
242-
(aset bars (1- depth) t))
243-
(when (= depth 0)
244-
(setq color-index (1+ color-index))))
245-
(insert (lsp-ui-imenu--make-line title it-index it
246-
padding bars depth color-index
247-
is-last))))))
223+
(--each-indexed items
224+
(let ((is-last (= (1+ it-index) (length items))))
225+
(if (imenu--subalist-p it)
226+
(-let* (((sub-title . entries) it))
227+
(if (= depth 0)
228+
(lsp-ui-imenu--put-toplevel-title sub-title color-index)
229+
(lsp-ui-imenu--put-subtitle sub-title padding bars depth color-index is-last))
230+
(when (and is-last (> depth 0))
231+
(aset bars (1- depth) nil))
232+
(let ((lsp-ui-imenu-kind-position (if (> depth 0) 'top
233+
lsp-ui-imenu-kind-position)))
234+
(lsp-ui-imenu--insert-items sub-title
235+
entries
236+
padding
237+
bars
238+
(1+ depth)
239+
color-index))
240+
(when (and is-last (> depth 0))
241+
(aset bars (1- depth) t))
242+
(when (= depth 0)
243+
(setq color-index (1+ color-index))))
244+
(insert (lsp-ui-imenu--make-line title it-index it
245+
padding bars depth color-index
246+
is-last)))))
248247
color-index)
249248

250249
(defun lsp-ui-imenu--get-padding (items)

0 commit comments

Comments
 (0)