@@ -144,7 +144,7 @@ an alternative workspace's treeview."
144
144
lsp-metals-treeview--active-view-workspace
145
145
(not (member lsp-metals-treeview--active-view-workspace
146
146
(lsp-workspaces))))
147
-
147
+
148
148
; ; hide current treeview and show new window associated with
149
149
; ; the current workspace of file in buffer.
150
150
(lsp-metals-treeview--hide-window lsp-metals-treeview--active-view-workspace)
323
323
; ; not initialised.
324
324
(when (and lsp-metals-treeview--view-id
325
325
(not workspace-shutdown?)
326
- (equal 'initialized (lsp--workspace-status cur-workspace)))
326
+ (equal 'initialized (lsp--workspace-status cur-workspace)))
327
327
(lsp-metals-treeview--send-visibility-did-change
328
328
lsp-metals-treeview--current-workspace
329
329
lsp-metals-treeview--view-id
@@ -378,30 +378,31 @@ window by POSITION and is of the form '((side left))."
378
378
(set-window-dedicated-p (selected-window ) t )
379
379
; ; When closing other windows after splitting, prevent our treeview closing.
380
380
(set-window-parameter (selected-window ) 'no-delete-other-windows t ))
381
-
381
+
382
382
(let* ((buffer (get-buffer-create buffer-name))
383
383
(window (display-buffer-in-side-window buffer position)))
384
384
385
385
(with-lsp-workspace workspace
386
386
(with-selected-window window
387
387
(set-window-dedicated-p window t )
388
388
(treemacs-initialize)
389
-
389
+
390
390
(setq-local lsp-metals-treeview--current-workspace workspace)
391
391
(setq-local lsp-metals-treeview--view-id view-id)
392
392
(treemacs-METALS-ROOT-extension)
393
393
(setq-local mode-line-format (lsp-metals-treeview--view-name view-id))
394
-
394
+
395
395
; ; Add buffer to list of treeview buffers associated with this workspace.
396
396
(lsp-metals-treeview--add-buffer workspace buffer)
397
-
397
+
398
398
; ; When closing other windows after splitting, prevent our treeview closing.
399
399
(set-window-parameter window 'no-delete-other-windows t )
400
400
(lsp-metals-treeview-mode 1 )
401
401
402
402
; ; Support for link-hint package with default visit action.
403
403
(setq-local treemacs-default-visit-action 'treemacs-RET-action )
404
-
404
+ (setq-local treemacs-space-between-root-nodes nil )
405
+
405
406
; ; open root of tree after initialisation.
406
407
(treemacs-expand-metals-root)))))))
407
408
@@ -446,7 +447,7 @@ relative to the others. "
446
447
(if (not (null views))
447
448
(progn
448
449
(lsp-metals-treeview--display-views workspace views slot)
449
-
450
+
450
451
(-when-let (buffer (lsp-metals-treeview--get-waiting-message-buffer workspace))
451
452
(kill-buffer buffer))
452
453
@@ -458,10 +459,10 @@ relative to the others. "
458
459
; ; When user switches between files in workspaces automatically switch
459
460
; ; the treeview to the appropriate one.
460
461
(lsp-metals-treeview--add-workspace-switch-hook)
461
-
462
+
462
463
; ; Add hook to close our treeview when the workspace is shutdown.
463
464
(add-hook 'lsp-after-uninitialized-hook #'lsp-metals-treeview--on-workspace-shutdown ))
464
-
465
+
465
466
; ; No views are available - show temp message.
466
467
(lsp-metals-treeview--show-waiting-message workspace (lsp-metals-treeview--position slot))))
467
468
@@ -470,20 +471,20 @@ relative to the others. "
470
471
us a new set of views."
471
472
(lsp-metals-treeview--log " Received metals views for workspace %s"
472
473
(lsp--workspace-root workspace))
473
-
474
+
474
475
; ; Close any current treeview window for this workspace, so we can
475
476
; ; recreate it.
476
477
(when (lsp-metals-treeview--exists? workspace)
477
478
(lsp-metals-treeview--delete-window workspace))
478
-
479
+
479
480
(let ((state (make-lsp-metals-treeview--data
480
481
:views (mapcar
481
482
(lambda (node )
482
483
`((:view-id . ,(ht-get node " viewId" ))
483
484
(:view-name . ,(replace-regexp-in-string " metals" " "
484
485
(ht-get node " viewId" )))))
485
486
(ht-get params " nodes" )))))
486
-
487
+
487
488
(lsp-metals-treeview--log-state state)
488
489
(lsp-metals-treeview--set-data workspace state)
489
490
@@ -530,7 +531,7 @@ cannot be found in the tree make sure we cleanup the cache and remove it."
530
531
(ht-set (treemacs-button-get tree-node :node )
531
532
" label"
532
533
(ht-get node " label" ))
533
-
534
+
534
535
; ; Currently the only way to re-render the label of an item is
535
536
; ; for the parent to call render-node on its children. So
536
537
; ; we update the parent of the node we're changing.
@@ -564,7 +565,7 @@ workspace of the project."
564
565
(lsp-metals-treeview--log " In lsp-metals-treeview--did-change %s\n %s"
565
566
(lsp--workspace-root workspace)
566
567
(json-encode params))
567
-
568
+
568
569
(if (lsp-metals-treeview--views-update-message? params)
569
570
(lsp-metals-treeview--refresh workspace params)
570
571
(lsp-metals-treeview--changed workspace params)))
@@ -658,7 +659,7 @@ expandable node. If the node isn't expandable for now do not show an icon. "
658
659
(if open-form? 'expanded 'collapsed )
659
660
nil
660
661
lsp-treemacs-theme)
661
-
662
+
662
663
; ; leaf node without an icon
663
664
(treemacs-as-icon " " 'face 'font-lock-string-face ))))
664
665
@@ -717,7 +718,7 @@ collapsed or expanded."
717
718
(progn
718
719
; ; root icon
719
720
(treemacs-create-icon :file " logo.png" :extensions (root) :fallback " " )
720
-
721
+
721
722
; ; symbol icons
722
723
(treemacs-create-icon :file " method.png" :extensions (" method" ))
723
724
(treemacs-create-icon :file " class.png" :extensions (" class" ))
@@ -734,7 +735,7 @@ collapsed or expanded."
734
735
; ; replace lsp-metals-treeview--state to return treemacs-metals-node-closed-state
735
736
; ;
736
737
(treemacs-define-leaf-node metals-leaf 'dynamic-icon
737
-
738
+
738
739
:ret-action #'lsp-metals-treeview--exec-node-action
739
740
:mouse1-action (lambda (&rest args )
740
741
(interactive )
@@ -755,7 +756,7 @@ collapsed or expanded."
755
756
(treemacs-button-get (treemacs-node-at-point) :node ) t )
756
757
:icon-closed-form (lsp-metals-treeview--icon
757
758
(treemacs-button-get (treemacs-node-at-point) :node ) nil )
758
-
759
+
759
760
:query-function (lsp-metals-treeview--get-children-current-node)
760
761
761
762
:ret-action 'lsp-metals-treeview--exec-node-action
@@ -764,7 +765,7 @@ collapsed or expanded."
764
765
(treemacs-button-get node :node ) nil )
765
766
:after-collapse (lsp-metals-treeview--on-node-collapsed
766
767
(treemacs-button-get node :node ) t )
767
-
768
+
768
769
:render-action
769
770
(treemacs-render-node
770
771
:icon (lsp-metals-treeview--icon item nil )
0 commit comments