Skip to content

Commit 7ac2701

Browse files
committed
Fixed several issues regarding lsp-treemacs-render
1 parent b3b3fdb commit 7ac2701

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

lsp-treemacs.el

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@
158158
(-let [(&DocumentSymbol :kind :children?) symbol]
159159
(concat
160160
(if (seq-empty-p children?)
161-
" "
162-
(if expanded " " " "))
161+
" "
162+
(if expanded "" ""))
163163
(lsp-treemacs-symbol-icon kind))))
164164

165165
(treemacs-define-expandable-node lsp-symbol
@@ -414,7 +414,7 @@ will be rendered an empty line between them."
414414
"Get the symbol for the the kind."
415415
(-let (((&hash "uri" "kind" "entryKind" entry-kind) dep))
416416
(concat
417-
(if expanded " " " ")
417+
(if expanded "" "")
418418
(if (or (= kind 8)
419419
(= kind 6))
420420
(treemacs-icon-for-file uri)
@@ -698,10 +698,11 @@ will be rendered an empty line between them."
698698
(puthash node-key (cons t result) lsp-treemacs--generic-cache)
699699
(let ((lsp-treemacs-use-cache t))
700700
(treemacs-update-node (cons :custom node-key) t)))))))
701-
(or (cl-rest (gethash node-key lsp-treemacs--generic-cache))
702-
`((:label ,(propertize "Loading..." 'face 'shadow)
703-
:icon-literal " "
704-
:key "Loading..."))))
701+
(if-let ((cache (gethash node-key lsp-treemacs--generic-cache)))
702+
(cl-rest cache)
703+
`((:label ,(propertize "Loading..." 'face 'shadow)
704+
:icon-literal " "
705+
:key "Loading..."))))
705706
(t children)))
706707
:ret-action #'lsp-treemacs-perform-ret-action
707708
:render-action
@@ -728,11 +729,12 @@ will be rendered an empty line between them."
728729

729730
(defun lsp-treemacs--generic-icon (item expanded?)
730731
"Get the symbol for the the kind."
732+
(message ">>> %s exp = %s" (plist-get item :label) expanded?)
731733
(concat
732734
(if (or (plist-get item :children)
733735
(plist-get item :children-async))
734-
(if expanded? " " " ")
735-
" ")
736+
(if expanded? "" "")
737+
" ")
736738
(or (plist-get item :icon-literal)
737739
(if-let ((icon (plist-get item :icon)))
738740
(treemacs-get-icon-value
@@ -881,13 +883,16 @@ will be rendered an empty line between them."
881883
(interactive)
882884
(lsp-treemacs--open-file-in-mru path)))))))
883885

884-
(defun lsp-treemacs-render (tree title expand-depth &optional buffer-name right-click-actions)
886+
(defun lsp-treemacs-render (tree title expand-depth &optional buffer-name right-click-actions clear-cache?)
885887
(let ((search-buffer (get-buffer-create (or buffer-name "*LSP Lookup*"))))
886888
(with-current-buffer search-buffer
887889
(lsp-treemacs-initialize)
888890
(setq-local treemacs-default-visit-action 'treemacs-RET-action)
889891
(setq-local lsp-treemacs--right-click-actions right-click-actions)
890-
(setq-local lsp-treemacs--generic-cache (or lsp-treemacs--generic-cache (ht)))
892+
(setq-local lsp-treemacs--generic-cache (if (and lsp-treemacs--generic-cache
893+
(not clear-cache?))
894+
lsp-treemacs--generic-cache
895+
(ht)))
891896
(setq-local lsp-treemacs-tree tree)
892897
(setq-local face-remapping-alist '((button . default)))
893898
(lsp-treemacs--set-mode-line-format search-buffer title)
@@ -979,7 +984,7 @@ With a prefix argument, select the new window expand the tree of implementations
979984
callback
980985
(seq-map
981986
(-lambda (node)
982-
(-let* (((child-item &as &CallHierarchyItem :name :kind :detail? :uri :selection-range (&Range :start))
987+
(-let* (((child-item &as &CallHierarchyItem :kind :uri :selection-range (&Range :start))
983988
(if outgoing
984989
(lsp:call-hierarchy-outgoing-call-to node)
985990
(lsp:call-hierarchy-incoming-call-from node)))
@@ -1026,8 +1031,7 @@ With a prefix argument, show the outgoing call hierarchy."
10261031
(lsp-request "textDocument/prepareCallHierarchy"
10271032
(lsp--text-document-position-params)))
10281033
(concat (if outgoing "Outgoing" "Incoming") " Call Hierarchy")
1029-
nil
1030-
"*Call Hierarchy*") nil))))
1034+
nil "*Call Hierarchy*" nil t) nil))))
10311035

10321036

10331037

0 commit comments

Comments
 (0)