Skip to content

Commit 7a6ef1b

Browse files
committed
Set treemacs-space-between-root-nodes to nil
Fixes syl20bnr/spacemacs#12880
1 parent 982bab9 commit 7a6ef1b

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

lsp-metals-treeview.el

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ an alternative workspace's treeview."
144144
lsp-metals-treeview--active-view-workspace
145145
(not (member lsp-metals-treeview--active-view-workspace
146146
(lsp-workspaces))))
147-
147+
148148
;; hide current treeview and show new window associated with
149149
;; the current workspace of file in buffer.
150150
(lsp-metals-treeview--hide-window lsp-metals-treeview--active-view-workspace)
@@ -323,7 +323,7 @@ t."
323323
;; not initialised.
324324
(when (and lsp-metals-treeview--view-id
325325
(not workspace-shutdown?)
326-
(equal 'initialized (lsp--workspace-status cur-workspace)))
326+
(equal 'initialized (lsp--workspace-status cur-workspace)))
327327
(lsp-metals-treeview--send-visibility-did-change
328328
lsp-metals-treeview--current-workspace
329329
lsp-metals-treeview--view-id
@@ -378,30 +378,31 @@ window by POSITION and is of the form '((side left))."
378378
(set-window-dedicated-p (selected-window) t)
379379
;; When closing other windows after splitting, prevent our treeview closing.
380380
(set-window-parameter (selected-window) 'no-delete-other-windows t))
381-
381+
382382
(let* ((buffer (get-buffer-create buffer-name))
383383
(window (display-buffer-in-side-window buffer position)))
384384

385385
(with-lsp-workspace workspace
386386
(with-selected-window window
387387
(set-window-dedicated-p window t)
388388
(treemacs-initialize)
389-
389+
390390
(setq-local lsp-metals-treeview--current-workspace workspace)
391391
(setq-local lsp-metals-treeview--view-id view-id)
392392
(treemacs-METALS-ROOT-extension)
393393
(setq-local mode-line-format (lsp-metals-treeview--view-name view-id))
394-
394+
395395
;; Add buffer to list of treeview buffers associated with this workspace.
396396
(lsp-metals-treeview--add-buffer workspace buffer)
397-
397+
398398
;; When closing other windows after splitting, prevent our treeview closing.
399399
(set-window-parameter window 'no-delete-other-windows t)
400400
(lsp-metals-treeview-mode 1)
401401

402402
;; Support for link-hint package with default visit action.
403403
(setq-local treemacs-default-visit-action 'treemacs-RET-action)
404-
404+
(setq-local treemacs-space-between-root-nodes nil)
405+
405406
;; open root of tree after initialisation.
406407
(treemacs-expand-metals-root)))))))
407408

@@ -446,7 +447,7 @@ relative to the others. "
446447
(if (not (null views))
447448
(progn
448449
(lsp-metals-treeview--display-views workspace views slot)
449-
450+
450451
(-when-let (buffer (lsp-metals-treeview--get-waiting-message-buffer workspace))
451452
(kill-buffer buffer))
452453

@@ -458,10 +459,10 @@ relative to the others. "
458459
;; When user switches between files in workspaces automatically switch
459460
;; the treeview to the appropriate one.
460461
(lsp-metals-treeview--add-workspace-switch-hook)
461-
462+
462463
;; Add hook to close our treeview when the workspace is shutdown.
463464
(add-hook 'lsp-after-uninitialized-hook #'lsp-metals-treeview--on-workspace-shutdown))
464-
465+
465466
;; No views are available - show temp message.
466467
(lsp-metals-treeview--show-waiting-message workspace (lsp-metals-treeview--position slot))))
467468

@@ -470,20 +471,20 @@ relative to the others. "
470471
us a new set of views."
471472
(lsp-metals-treeview--log "Received metals views for workspace %s"
472473
(lsp--workspace-root workspace))
473-
474+
474475
;; Close any current treeview window for this workspace, so we can
475476
;; recreate it.
476477
(when (lsp-metals-treeview--exists? workspace)
477478
(lsp-metals-treeview--delete-window workspace))
478-
479+
479480
(let ((state (make-lsp-metals-treeview--data
480481
:views (mapcar
481482
(lambda (node)
482483
`((:view-id . ,(ht-get node "viewId"))
483484
(:view-name . ,(replace-regexp-in-string "metals" ""
484485
(ht-get node "viewId")))))
485486
(ht-get params "nodes")))))
486-
487+
487488
(lsp-metals-treeview--log-state state)
488489
(lsp-metals-treeview--set-data workspace state)
489490

@@ -530,7 +531,7 @@ cannot be found in the tree make sure we cleanup the cache and remove it."
530531
(ht-set (treemacs-button-get tree-node :node)
531532
"label"
532533
(ht-get node "label"))
533-
534+
534535
;; Currently the only way to re-render the label of an item is
535536
;; for the parent to call render-node on its children. So
536537
;; we update the parent of the node we're changing.
@@ -564,7 +565,7 @@ workspace of the project."
564565
(lsp-metals-treeview--log "In lsp-metals-treeview--did-change %s\n%s"
565566
(lsp--workspace-root workspace)
566567
(json-encode params))
567-
568+
568569
(if (lsp-metals-treeview--views-update-message? params)
569570
(lsp-metals-treeview--refresh workspace params)
570571
(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. "
658659
(if open-form? 'expanded 'collapsed)
659660
nil
660661
lsp-treemacs-theme)
661-
662+
662663
;; leaf node without an icon
663664
(treemacs-as-icon " " 'face 'font-lock-string-face))))
664665

@@ -717,7 +718,7 @@ collapsed or expanded."
717718
(progn
718719
;; root icon
719720
(treemacs-create-icon :file "logo.png" :extensions (root) :fallback "")
720-
721+
721722
;; symbol icons
722723
(treemacs-create-icon :file "method.png" :extensions ("method"))
723724
(treemacs-create-icon :file "class.png" :extensions ("class"))
@@ -734,7 +735,7 @@ collapsed or expanded."
734735
;; replace lsp-metals-treeview--state to return treemacs-metals-node-closed-state
735736
;;
736737
(treemacs-define-leaf-node metals-leaf 'dynamic-icon
737-
738+
738739
:ret-action #'lsp-metals-treeview--exec-node-action
739740
:mouse1-action (lambda (&rest args)
740741
(interactive)
@@ -755,7 +756,7 @@ collapsed or expanded."
755756
(treemacs-button-get (treemacs-node-at-point) :node) t)
756757
:icon-closed-form (lsp-metals-treeview--icon
757758
(treemacs-button-get (treemacs-node-at-point) :node) nil)
758-
759+
759760
:query-function (lsp-metals-treeview--get-children-current-node)
760761

761762
:ret-action 'lsp-metals-treeview--exec-node-action
@@ -764,7 +765,7 @@ collapsed or expanded."
764765
(treemacs-button-get node :node) nil)
765766
:after-collapse (lsp-metals-treeview--on-node-collapsed
766767
(treemacs-button-get node :node) t)
767-
768+
768769
:render-action
769770
(treemacs-render-node
770771
:icon (lsp-metals-treeview--icon item nil)

lsp-treemacs.el

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@
352352
(lsp-treemacs-error-list-mode 1)
353353

354354
(setq-local treemacs-default-visit-action 'treemacs-RET-action)
355+
(setq-local treemacs-space-between-root-nodes nil)
355356

356357
(treemacs-LSP-ERROR-LIST-extension)
357358

@@ -597,6 +598,7 @@
597598
(treemacs-initialize)
598599
(lsp-treemacs-symbols-mode)
599600
(setq-local treemacs-default-visit-action 'treemacs-RET-action)
601+
(setq-local treemacs-space-between-root-nodes nil)
600602
(treemacs-LSP-SYMBOLS-LIST-extension)
601603
(setq lsp-treemacs--symbols-timer (run-at-time 0 1.0 #'lsp-treemacs--update))
602604
(add-hook 'kill-buffer-hook 'lsp-treemacs--kill-symbols-buffer nil t)))
@@ -763,7 +765,10 @@
763765
(treemacs-initialize)
764766
(lsp-treemacs-java-deps-mode)
765767
(lsp-treemacs-deps-list-mode t)
768+
769+
(setq-local treemacs-space-between-root-nodes nil)
766770
(setq-local treemacs-default-visit-action 'treemacs-RET-action)
771+
767772
(treemacs-LSP-TREEMACS-DEPS-LIST-extension))))
768773

769774
(defun lsp-treemacs--deps-find-children-for-key (node key)

0 commit comments

Comments
 (0)