From 55edc90a809f52a50c40a8f4042027c62a35f947 Mon Sep 17 00:00:00 2001 From: Evgeny Kurnevsky Date: Sun, 1 Oct 2023 11:17:34 +0300 Subject: [PATCH] Align nodes with no icons. --- lsp-metals-treeview.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lsp-metals-treeview.el b/lsp-metals-treeview.el index 8788ab1..951d0da 100644 --- a/lsp-metals-treeview.el +++ b/lsp-metals-treeview.el @@ -549,6 +549,16 @@ with values converted from json to hash tables." ;; UI tree view using treemacs ;; +(defun lsp-metals-treeview--xpm-pad (width) + "Return an XPM image with the specified WIDTH." + (format "/* XPM */ +static char * pad_xpm[] = { +\"%d 1 1 1\", +\". c none\", +\"%s\" +}; +" width (make-string width ?.))) + (defun lsp-metals-treeview--icon (metals-node open-form?) "Return icon based on METALS-NODE. The icon will depend on the individual METALS-NODE and whether the @@ -566,7 +576,11 @@ do not show an icon." lsp-treemacs-theme) ;; leaf node without an icon - " "))) + (concat (propertize " " 'display (create-image + (lsp-metals-treeview--xpm-pad treemacs--icon-size) + 'xpm t + :mask 'heuristic)) + " ")))) (defun lsp-metals-treeview--send-execute-command-async (command &optional args) "Create and send a `workspace/executeCommand'.