@@ -404,6 +404,12 @@ will be rendered an empty line between them."
404404 (lsp-treemacs--expand-recursively btn (if (booleanp depth) depth (1- depth))))
405405 (treemacs-collect-child-nodes root)))))
406406
407+
408+ ; ; deps
409+ (eval-and-compile
410+ (lsp-interface
411+ (java:Node (:projectUri :rootPath :path :kind :name :uri :entryKind ))))
412+
407413(defmacro lsp-treemacs-deps-with-jdtls (&rest body )
408414 " Helper macro for invoking BODY against WORKSPACE context."
409415 (declare (debug (form body))
@@ -416,17 +422,17 @@ will be rendered an empty line between them."
416422 (if-let ((dep (-some-> (treemacs-node-at-point)
417423 (button-get :dep ))))
418424 (lsp-treemacs--open-file-in-mru
419- (or (-some-> (gethash " uri " dep)
425+ (or (-some-> (lsp-get dep :uri )
420426 (lsp--uri-to-path))
421- (when (f-exists? (gethash " path " dep))
422- (gethash " path " dep))
423- (concat (f-parent (lsp--uri-to-path (gethash " projectUri " dep)))
424- (gethash " path " dep))))
427+ (when (f-exists? (lsp-get dep :path ))
428+ (lsp-get dep :path ))
429+ (concat (f-parent (lsp--uri-to-path (lsp-get dep :projectUri )))
430+ (lsp-get dep :path ))))
425431 (user-error " No element under point." )))
426432
427433(defun lsp-treemacs-deps--icon (dep expanded )
428434 " Get the symbol for the the kind."
429- (-let (((&hash " uri" " kind" " entryKind " entry-kind) dep))
435+ (-let (((&java:Node : uri : kind : entry-kind ) dep))
430436 (concat
431437 (if expanded " ▾ " " ▸ " )
432438 (if (or (= kind 8 )
@@ -446,7 +452,7 @@ will be rendered an empty line between them."
446452
447453(defun lsp-treemacs-deps--get-children (dep )
448454 (lsp-treemacs-deps-with-jdtls
449- (-let* (((&hash " projectUri " project-uri " rootPath " root-path " path" " kind" " name" " uri" ) dep)
455+ (-let* (((&java:Node : project-uri : root-path : path : kind : name : uri ) dep)
450456 (project-uri (if (eq kind 2 ) uri project-uri)))
451457 (unless (or (= kind 6 )
452458 (= kind 8 ))
@@ -461,68 +467,64 @@ will be rendered an empty line between them."
461467 (or root-path path)))
462468 (" projectUri" project-uri))))
463469 (-mapcat (lambda (inner-dep )
464- (puthash " projectUri" project-uri inner-dep )
470+ (lsp-put inner-dep : projectUri project-uri)
465471 (when (= kind 4 )
466- (puthash " rootPath " path inner-dep))
467- (if (eq (gethash " entryKind " inner-dep) 3 )
472+ (lsp-put inner-dep :rootPath path ))
473+ (if (eq (lsp-get inner-dep :entryKind ) 3 )
468474 (lsp-treemacs-deps--get-children inner-dep)
469475 (list inner-dep)))))))))
470476
471477(defun lsp-treemacs-deps--java-file? (dep )
472- (-let [(&hash " kind" " entryKind " entry-kind) dep]
478+ (-let [(&java:Node : kind : entry-kind ) dep]
473479 (and (eq kind 6 )
474480 (or (eq entry-kind 1 )
475481 (eq entry-kind 2 )))))
476482
477483(treemacs-define-expandable-node lsp-treemacs-deps
478484 :icon-open-form (lsp-treemacs-deps--icon (treemacs-button-get node :dep ) t )
479485 :icon-closed-form (lsp-treemacs-deps--icon (treemacs-button-get node :dep ) nil )
480- :query-function (-let (((dep &as &hash " uri" ) (treemacs-button-get node :dep )))
486+ :query-function (-let (((dep &as &java:Node : uri ) (treemacs-button-get node :dep )))
481487 (if (lsp-treemacs-deps--java-file? dep)
482488 (lsp-treemacs-deps-with-jdtls
483489 (lsp-request " textDocument/documentSymbol"
484490 (lsp-make-document-symbol-params :text-document
485491 (lsp-make-text-document-item :uri uri))))
486492 (lsp-treemacs-deps--get-children dep)))
487493 :ret-action 'lsp-treemacs-deps--goto-element
488- :render-action (if (lsp-treemacs-deps--java-file? (treemacs-button-get node :dep ))
494+ :render-action (-let (((&java:Node :name :uri :path ) item))
495+ (if (lsp-treemacs-deps--java-file? (treemacs-button-get node :dep ))
496+ (treemacs-render-node
497+ :icon (lsp-treemacs--symbol-icon item nil )
498+ :label-form (propertize name 'face 'default )
499+ :state treemacs-lsp-symbol-closed-state
500+ :key-form (list name uri path)
501+ :more-properties (:symbol item))
489502 (treemacs-render-node
490- :icon (lsp-treemacs--symbol-icon item nil )
491- :label-form (propertize (gethash " name" item) 'face 'default )
492- :state treemacs-lsp-symbol-closed-state
493- :key-form (list (gethash " name" item)
494- (gethash " uri" item)
495- (gethash " path" item))
496- :more-properties (:symbol item))
497- (treemacs-render-node
498- :icon (lsp-treemacs-deps--icon item nil )
499- :label-form (propertize (gethash " name" item) 'face 'default )
500- :state treemacs-lsp-treemacs-deps-closed-state
501- :key-form (list (gethash " name" item)
502- (gethash " uri" item)
503- (gethash " path" item))
504- :more-properties (:dep item))))
503+ :icon (lsp-treemacs-deps--icon item nil )
504+ :label-form (propertize name 'face 'default )
505+ :state treemacs-lsp-treemacs-deps-closed-state
506+ :key-form (list name uri path)
507+ :more-properties (:dep item)))))
505508
506509(defun lsp-treemacs-deps--root-folders ()
507510 (lsp-treemacs-deps-with-jdtls
508511 (-mapcat (lambda (root-path )
509512 (let ((project-uri (lsp--path-to-uri root-path)))
510513 (->> project-uri
511514 (lsp-send-execute-command " java.project.list" )
512- (--map (--doto it (puthash " projectUri" project-uri it ))))))
515+ (--map (--doto it (lsp-put it : projectUri project-uri))))))
513516 (lsp-session-folders (lsp-session)))))
514517
515518(treemacs-define-variadic-node lsp-treemacs-deps-list
516519 :query-function (lsp-treemacs-deps--root-folders)
517520 :render-action
518- (treemacs-render-node
519- :icon (lsp-treemacs-deps--icon item nil )
520- :label-form (propertize (gethash " name" item) 'face 'default )
521- :state treemacs-lsp-treemacs-deps-closed-state
522- :key-form (list (gethash " name" item)
523- (gethash " uri" item)
524- (gethash " path" item))
525- :more-properties (:dep item))
521+ (-let (((&java:Node :name :uri :path ) item))
522+ (treemacs-render-node
523+ :icon (lsp-treemacs-deps--icon item nil )
524+ :label-form (propertize name 'face 'default )
525+ :state treemacs-lsp-treemacs-deps-closed-state
526+ :key-form (list name uri path)
527+ :more-properties (:dep item)))
526528 :root-key-form 'LSP-Java-Dependency )
527529
528530(defun lsp-treemacs-java-deps-refresh ()
@@ -586,7 +588,7 @@ will be rendered an empty line between them."
586588 (get-buffer-window )
587589 (marker-position
588590 (-reduce-from
589- (-lambda (node (&hash " path" " name" " uri" ))
591+ (-lambda (node (&java:Node : path : name : uri ))
590592 (unless (treemacs-is-node-expanded? node)
591593 (save-excursion
592594 (goto-char (marker-position node))
@@ -598,7 +600,6 @@ will be rendered an empty line between them."
598600 (get-buffer-window )))
599601 (recenter nil ))))
600602
601-
602603
603604; ; treemacs synchronization
604605
0 commit comments