diff --git a/lsp-treemacs.el b/lsp-treemacs.el index 6413fcd..6d97841 100644 --- a/lsp-treemacs.el +++ b/lsp-treemacs.el @@ -961,27 +961,30 @@ With prefix 2 show both." (ht-keys) (-keep (lambda (file) - (when (and (lsp-f-ancestor-of? folder file) - (lsp-treemacs-errors--diags? (lsp-diagnostics-stats-for file))) - (list :id file - :label (format "%s %s %s" - (f-filename file) - (->> (append (lsp-diagnostics-stats-for file) ()) - (-map-indexed - (lambda (index count) - (unless (zerop count) - (propertize - (number-to-string count) - 'face (alist-get index lsp-treemacs-file-face-map))))) - (-filter #'identity) - (s-join "/")) - (propertize (f-dirname (f-relative file folder)) - 'face 'lsp-details-face)) - :icon (if (f-directory? file) 'dir-closed (f-ext file)) - :children (-partial #'lsp-treemacs--error-list-diags folder file) - :ret-action (lambda (&rest _) - (interactive) - (lsp-treemacs--open-file-in-mru file)))))))) + (if (and (lsp-f-ancestor-of? folder file) + (lsp-treemacs-errors--diags? (lsp-diagnostics-stats-for file))) + (list (list :id file + :label (format "%s %s %s" + (f-filename file) + (->> (append (lsp-diagnostics-stats-for file) ()) + (-map-indexed + (lambda (index count) + (unless (zerop count) + (propertize + (number-to-string count) + 'face (alist-get index lsp-treemacs-file-face-map))))) + (-filter #'identity) + (s-join "/")) + (propertize (f-dirname (f-relative file folder)) + 'face 'lsp-details-face)) + :icon (if (f-directory? file) 'dir-closed (f-ext file)) + :children (-partial #'lsp-treemacs--error-list-diags folder file) + :ret-action (lambda (&rest _) + (interactive) + (lsp-treemacs--open-file-in-mru file)))) + (if (lsp-f-same? folder file) + (lsp-treemacs--error-list-diags folder file))))) + (-flatten-n 1))) (lsp-treemacs-define-action lsp-treemacs-quick-fix (:file :diag) "Select the element under cursor."