Skip to content

Commit faa600e

Browse files
committed
Change to use lsp-workspace-folders
1 parent c22e604 commit faa600e

File tree

1 file changed

+36
-43
lines changed

1 file changed

+36
-43
lines changed

lsp-treemacs.el

Lines changed: 36 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,51 +1208,44 @@ With prefix 2 show both."
12081208
count)))
12091209
(seq-some #'identity)))
12101210

1211-
(defun lsp-treemacs--build-error-list (folders)
1212-
(-keep
1213-
(lambda (folder)
1214-
(when-let ((diags (append (lsp-diagnostics-stats-for folder) ())))
1215-
(when (lsp-treemacs-errors--diags? diags)
1216-
(list :label (format
1217-
(propertize "%s %s %s" 'face 'default)
1218-
(f-filename folder)
1219-
(->> diags
1220-
(-map-indexed
1221-
(lambda (index count)
1222-
(when (and (not (zerop count))
1223-
(<= index lsp-treemacs-error-list-severity))
1224-
(propertize
1225-
(number-to-string count)
1226-
'face (alist-get index lsp-treemacs-file-face-map)))))
1227-
(-filter #'identity)
1228-
(s-join "/"))
1229-
(propertize (f-dirname folder)
1230-
'face 'lsp-lens-face))
1231-
:id folder
1232-
:icon 'root
1233-
:children (-partial #'lsp-treemacs-errors--list-files folder)
1234-
:ret-action (lambda (&rest _)
1235-
(interactive)
1236-
(lsp-treemacs--open-file-in-mru folder))))))
1237-
folders))
1238-
1239-
1240-
(defvar lsp-treemacs--current-project-roots nil)
1211+
(defun lsp-treemacs--build-error-list (folder)
1212+
(when-let ((diags (append (lsp-diagnostics-stats-for folder) ())))
1213+
(when (lsp-treemacs-errors--diags? diags)
1214+
(list :label (format
1215+
(propertize "%s %s %s" 'face 'default)
1216+
(f-filename folder)
1217+
(->> diags
1218+
(-map-indexed
1219+
(lambda (index count)
1220+
(when (and (not (zerop count))
1221+
(<= index lsp-treemacs-error-list-severity))
1222+
(propertize
1223+
(number-to-string count)
1224+
'face (alist-get index lsp-treemacs-file-face-map)))))
1225+
(-filter #'identity)
1226+
(s-join "/"))
1227+
(propertize (f-dirname folder)
1228+
'face 'lsp-lens-face))
1229+
:id folder
1230+
:icon 'root
1231+
:children (-partial #'lsp-treemacs-errors--list-files folder)
1232+
:ret-action (lambda (&rest _)
1233+
(interactive)
1234+
(lsp-treemacs--open-file-in-mru folder))))))
1235+
1236+
(defvar lsp-treemacs--current-workspaces nil)
12411237

12421238
(defun lsp-treemacs-errors-list--refresh ()
1243-
(message "->%s" lsp-treemacs--current-project-roots)
12441239
(lsp-treemacs-render
1245-
(if (and lsp-treemacs--current-project-roots
1246-
lsp-treemacs-error-list-current-project-only)
1247-
(->> (lsp-session)
1248-
(lsp-session-folders)
1249-
(-filter (lambda (folder)
1250-
(--any (f-equal-p it folder)
1251-
lsp-treemacs--current-project-roots)))
1252-
(lsp-treemacs--build-error-list))
1253-
(->> (lsp-session)
1254-
(lsp-session-folders)
1255-
(lsp-treemacs--build-error-list)))
1240+
(if lsp-treemacs-error-list-current-project-only
1241+
(->> lsp-treemacs--current-workspaces
1242+
(-map #'lsp-workspace-folders)
1243+
(-flatten)
1244+
(-keep #'lsp-treemacs--build-error-list))
1245+
(->> lsp-treemacs--current-workspaces
1246+
(-map #'lsp-workspace-folders)
1247+
(-flatten)
1248+
(-keep #'lsp-treemacs--build-error-list)))
12561249
"Errors List"
12571250
nil
12581251
lsp-treemacs-errors-buffer-name
@@ -1261,7 +1254,7 @@ With prefix 2 show both."
12611254
;;;###autoload
12621255
(defun lsp-treemacs-errors-list ()
12631256
(interactive)
1264-
(setq lsp-treemacs--current-project-roots (-map #'lsp--workspace-root (lsp-workspaces)))
1257+
(setq lsp-treemacs--current-workspaces (lsp-workspaces))
12651258
(-if-let (buffer (get-buffer lsp-treemacs-errors-buffer-name))
12661259
(progn
12671260
(select-window (display-buffer-in-side-window buffer '((side . bottom))))

0 commit comments

Comments
 (0)