Skip to content

Commit 772cdae

Browse files
committed
Add a command to remove workspace folders
Sometimes it is useful to remove a lot of workspace folders at once. Calling `lsp-workspace-folders-remove' repeatedly is not very convenient though, so wrap it in `ivy', allowing the user to simply invoke `ivy-call'.
1 parent c70ee8b commit 772cdae

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lsp-ivy.el

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,17 @@ When called with prefix ARG the default selection will be symbol at point."
220220
"Global workspace symbols: "
221221
(when arg (thing-at-point 'symbol))))
222222

223+
224+
;;;###autoload
225+
(defun lsp-ivy-workspace-folder-remove ()
226+
"Remove a project-root from the list of workspace folders."
227+
(interactive)
228+
(let ((session (lsp-session)))
229+
(ivy-read "Select workspace folder to remove: " (lsp-session-folders session)
230+
:preselect (-some->> default-directory (lsp-find-session-folder session))
231+
:action (lambda (x)
232+
(lsp-workspace-folders-remove x)
233+
(ivy--kill-current-candidate)))))
234+
223235
(provide 'lsp-ivy)
224236
;;; lsp-ivy.el ends here

0 commit comments

Comments
 (0)