|
150 | 150 | (goto-char (point-min)) |
151 | 151 | (forward-line (lsp-diagnostic-line diag)) |
152 | 152 | (lsp-execute-code-action-by-kind "quickfix"))))) |
153 | | - (user-error "Not no a diagnostic")))) |
| 153 | + (user-error "Not on a diagnostic")))) |
154 | 154 |
|
155 | 155 | (defun lsp-treemacs-cycle-severity () |
156 | 156 | "Cycle through the severity levels shown in the errors list" |
|
331 | 331 | :keymap lsp-treemacs-error-list-mode-map |
332 | 332 | :group 'lsp-treeemacs) |
333 | 333 |
|
334 | | -(define-derived-mode lsp-treemacs-errors-mode treemacs-mode "LSP Errors View" |
335 | | - "A major mode for displaying LSP Errors.") |
336 | | - |
337 | 334 | ;;;###autoload |
338 | 335 | (defun lsp-treemacs-errors-list () |
339 | 336 | "Display error list." |
|
348 | 345 | (select-window window) |
349 | 346 | (set-window-dedicated-p window t) |
350 | 347 | (treemacs-initialize) |
351 | | - (lsp-treemacs-errors-mode) |
| 348 | + (lsp-treemacs--set-mode-line-format buffer " LSP Errors View ") |
352 | 349 | (lsp-treemacs-error-list-mode 1) |
353 | 350 |
|
354 | 351 | (setq-local treemacs-default-visit-action 'treemacs-RET-action) |
|
559 | 556 | (lsp-treemacs--symbols->tree |
560 | 557 | lsp-treemacs--symbols |
561 | 558 | nil) |
562 | | - "LSP Symbols" |
| 559 | + " LSP Symbols " |
563 | 560 | (and lsp-treemacs--symbols (> 30 (length lsp-treemacs--symbols))) |
564 | 561 | "*LSP Symbols List*" )) |
565 | 562 |
|
|
780 | 777 | (lsp--info "Refresh completed"))) |
781 | 778 | (error))) |
782 | 779 |
|
783 | | -(define-derived-mode lsp-treemacs-java-deps-mode treemacs-mode "Java Dependencies" |
784 | | - "A major mode for displaying Java Dependencies.") |
785 | | - |
786 | 780 | ;;;###autoload |
787 | 781 | (defun lsp-treemacs-java-deps-list () |
788 | 782 | "Display error list." |
|
796 | 790 | (select-window window) |
797 | 791 | (set-window-dedicated-p window t) |
798 | 792 | (treemacs-initialize) |
799 | | - (lsp-treemacs-java-deps-mode) |
| 793 | + (lsp-treemacs--set-mode-line-format buffer " Java Dependencies ") |
800 | 794 | (lsp-treemacs-deps-list-mode t) |
801 | 795 |
|
802 | 796 | (setq-local treemacs-space-between-root-nodes nil) |
|
1139 | 1133 | (lsp-treemacs--open-file-in-mru path))))))) |
1140 | 1134 |
|
1141 | 1135 | (defun lsp-treemacs--show-references (tree title expand? &optional buffer-name) |
1142 | | - (with-current-buffer (get-buffer-create (or buffer-name "*LSP Lookup*")) |
1143 | | - (lsp-treemacs-initialize) |
1144 | | - (setq-local lsp-treemacs-tree tree) |
1145 | | - (setq-local face-remapping-alist '((button . default))) |
1146 | | - (lsp-treemacs-generic-refresh) |
1147 | | - (when expand? (lsp-treemacs--expand 'LSP-Generic)) |
1148 | | - (setq-local mode-name title) |
1149 | | - (current-buffer))) |
| 1136 | + (let ((search-buffer (get-buffer-create (or buffer-name "*LSP Lookup*")))) |
| 1137 | + (with-current-buffer search-buffer |
| 1138 | + (lsp-treemacs-initialize) |
| 1139 | + (lsp-treemacs--set-mode-line-format search-buffer title) |
| 1140 | + (setq-local lsp-treemacs-tree tree) |
| 1141 | + (setq-local face-remapping-alist '((button . default))) |
| 1142 | + (lsp-treemacs-generic-refresh) |
| 1143 | + (when expand? (lsp-treemacs--expand 'LSP-Generic)) |
| 1144 | + (current-buffer)))) |
| 1145 | + |
| 1146 | +(defun lsp-treemacs--set-mode-line-format (buffer title) |
| 1147 | + "Set the mode line format of BUFFER to TITLE. |
| 1148 | +This function sets the `mode-name' or `mode-line-format' |
| 1149 | +depending on if a custom mode line is detected." |
| 1150 | + (with-current-buffer buffer |
| 1151 | + (cond ((or (fboundp 'spaceline-install) |
| 1152 | + (memq 'moody-mode-line-buffer-identification |
| 1153 | + (default-value 'mode-line-format)) |
| 1154 | + (and (fboundp 'doom-modeline) |
| 1155 | + (fboundp 'doom-modeline-def-modeline))) |
| 1156 | + (setq mode-name title)) |
| 1157 | + (t |
| 1158 | + (setq mode-line-format title))))) |
1150 | 1159 |
|
1151 | 1160 | (defun lsp-treemacs--do-search (method params title expand?) |
1152 | | - (display-buffer-in-side-window (get-buffer-create "*LSP Lookup*") |
1153 | | - '((side . bottom))) |
1154 | | - (lsp-request-async |
1155 | | - method |
1156 | | - params |
1157 | | - (lambda (refs) |
1158 | | - (setq-local mode-name "Rendering results...") |
1159 | | - (lsp-with-cached-filetrue-name |
1160 | | - (let ((lsp-file-truename-cache (ht))) |
1161 | | - (lsp-treemacs--show-references (lsp-treemacs--handle-references refs) |
1162 | | - (format title (length refs)) |
1163 | | - expand?))) |
1164 | | - (lsp--info "Refresh completed!")) |
1165 | | - :mode 'detached |
1166 | | - :cancel-token :treemacs-lookup) |
1167 | | - |
1168 | | - (with-current-buffer "*LSP Lookup*" |
1169 | | - (lsp-treemacs-initialize) |
1170 | | - (setq-local mode-name "Loading...") |
1171 | | - (setq-local lsp-treemacs-tree nil) |
1172 | | - (lsp-treemacs-generic-refresh))) |
| 1161 | + (let ((search-buffer (get-buffer-create "*LSP Lookup*"))) |
| 1162 | + (display-buffer-in-side-window search-buffer |
| 1163 | + '((side . bottom))) |
| 1164 | + (lsp-request-async |
| 1165 | + method |
| 1166 | + params |
| 1167 | + (lambda (refs) |
| 1168 | + (lsp-treemacs--set-mode-line-format search-buffer " Rendering results... ") |
| 1169 | + (lsp-with-cached-filetrue-name |
| 1170 | + (let ((lsp-file-truename-cache (ht))) |
| 1171 | + (lsp-treemacs--show-references (lsp-treemacs--handle-references refs) |
| 1172 | + (format title (length refs)) |
| 1173 | + expand?))) |
| 1174 | + (lsp--info "Refresh completed!")) |
| 1175 | + :mode 'detached |
| 1176 | + :cancel-token :treemacs-lookup) |
| 1177 | + |
| 1178 | + (with-current-buffer search-buffer |
| 1179 | + (lsp-treemacs-initialize) |
| 1180 | + (lsp-treemacs--set-mode-line-format search-buffer " Loading... ") |
| 1181 | + (setq-local lsp-treemacs-tree nil) |
| 1182 | + (lsp-treemacs-generic-refresh)))) |
1173 | 1183 |
|
1174 | 1184 | ;;;###autoload |
1175 | 1185 | (defun lsp-treemacs-references (arg) |
| 1186 | + "Show the references for the symbol at point. |
| 1187 | +With a prefix argument, expand the tree of references automatically." |
1176 | 1188 | (interactive "P") |
1177 | 1189 | (lsp-treemacs--do-search "textDocument/references" |
1178 | 1190 | `(:context (:includeDeclaration t) ,@(lsp--text-document-position-params)) |
1179 | | - "Found %s references" |
| 1191 | + " Found %s references " |
1180 | 1192 | arg)) |
1181 | 1193 |
|
1182 | 1194 | ;;;###autoload |
1183 | 1195 | (defun lsp-treemacs-implementations (arg) |
| 1196 | + "Show the implementations for the symbol at point. |
| 1197 | +With a prefix argument, expand the tree of implementations automatically." |
1184 | 1198 | (interactive "P") |
1185 | 1199 | (lsp-treemacs--do-search "textDocument/implementation" |
1186 | 1200 | (lsp--text-document-position-params) |
1187 | | - "Found %s implementations" |
| 1201 | + " Found %s implementations " |
1188 | 1202 | arg)) |
1189 | 1203 |
|
1190 | 1204 |
|
|
1219 | 1233 |
|
1220 | 1234 | ;;;###autoload |
1221 | 1235 | (defun lsp-treemacs-call-hierarchy (outgoing) |
| 1236 | + "Show the incoming call hierarchy for the symbol at point. |
| 1237 | +With a prefix argument, show the outgoing call hierarchy." |
1222 | 1238 | (interactive "P") |
1223 | 1239 | (unless (lsp--find-workspaces-for "textDocument/prepareCallHierarchy") |
1224 | 1240 | (user-error "Call hierarchy not supported by the current servers: %s" |
|
0 commit comments