Thanks for your effort on lspce. I wonder if there is any plan to support imenu.
I have made a simple try with the help of eglot as below (no robustness considered):
(defun lspce-imenu-create ()
(mapcar
(lambda (obj)
(cons
(cdr (assoc (car obj) lspce--symbol-kind-names))
(mapcar
(lambda (obj)
(let ((content
(cons (gethash "name" obj)
(lspce--lsp-position-to-point
(gethash "start"
(gethash "range"
(gethash "location"
obj))))))
(container (gethash "containerName" obj)))
(if container
(list container content)
content)))
(cdr obj))))
(seq-group-by
(lambda (obj) (gethash "kind" obj))
(lspce--request "textDocument/documentSymbol" (list :textDocument (lspce--textDocumentIdenfitier (lspce--uri)))))))
(add-function :before-until (local 'imenu-create-index-function) #'lspce-imenu-create)
It works like

However, it remains two problems:
lspce--request returns range without selectRange (compared with eglot), which leads to jumping to "|class CLS" instead of "class |CLS" (| denotes for the cursor)
containerName only includes the direct father node. So just fun::var instead of CLS::fun::var.
Do you have any suggestions for them? Or maybe the whole part can be written in the rust part? (Sorry I haven't learned the rust)
Thanks for your effort on lspce. I wonder if there is any plan to support imenu.
I have made a simple try with the help of eglot as below (no robustness considered):
It works like

However, it remains two problems:
lspce--requestreturnsrangewithoutselectRange(compared with eglot), which leads to jumping to "|class CLS" instead of "class |CLS" (| denotes for the cursor)containerNameonly includes the direct father node. So justfun::varinstead ofCLS::fun::var.Do you have any suggestions for them? Or maybe the whole part can be written in the rust part? (Sorry I haven't learned the rust)