|
|
@@ -197,16 +197,25 @@ returned by `request`." |
|
|
|
#+BEGIN_SRC elisp |
|
|
|
(defun path! (&rest components) |
|
|
|
(apply #'f-join components)) |
|
|
|
|
|
|
|
(defun home! (&rest components) |
|
|
|
(apply #'path! (cons ($home) components))) |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
#+BEGIN_SRC elisp |
|
|
|
(defun advice! (fn components) |
|
|
|
(apply #'f-join components)) |
|
|
|
#+END_SRC |
|
|
|
** Magic Vars |
|
|
|
#+BEGIN_SRC elisp |
|
|
|
(defun $file () buffer-file-name) |
|
|
|
(defun $ext () (f-ext ($file))) |
|
|
|
(defun $ext (&optional dot) (f-ext ($file) dot)) |
|
|
|
(defun $cwd (&optional dir) |
|
|
|
(if dir |
|
|
|
dir |
|
|
|
(f-dirname ($file)))) |
|
|
|
(defun $home () |
|
|
|
(expand-file-name "~/")) |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
* Appearance |
|
|
@@ -1202,18 +1211,19 @@ Setup: run =M-x dap-go-setup= |
|
|
|
;; (setq projectile-project-search-path |
|
|
|
;; '("~/Code")) |
|
|
|
|
|
|
|
(defun my/projectile-project-ignored-p (root) |
|
|
|
(defun my/project-ignored-p (root) |
|
|
|
(or (doom-project-ignored-p root) |
|
|
|
(file-in-directory-p root "/opt/ts/fuse/artfs_mounts") |
|
|
|
(file-in-directory-p root "/home/tsdist/vats_deployments"))) |
|
|
|
(setq projectile-ignored-project-function #'my/projectile-project-ignored-p) |
|
|
|
(f-descendant-of-p root (home! ".rustup")) |
|
|
|
(f-descendant-of-p root "/opt/ts/fuse/artfs_mounts") |
|
|
|
(f-descendant-of-p root "/home/tsdist/vats_deployments"))) |
|
|
|
(setq projectile-ignored-project-function #'my/project-ignored-p) |
|
|
|
|
|
|
|
(defun my/projectile-switch-project () |
|
|
|
(interactive) |
|
|
|
;; Prune projects which no longer exist |
|
|
|
(when (boundp 'projectile-known-projects) |
|
|
|
(dolist (project projectile-known-projects) |
|
|
|
(unless (file-directory-p project) |
|
|
|
(unless (f-dir-p project) |
|
|
|
(projectile-remove-known-project project)))) |
|
|
|
(call-interactively #'counsel-projectile-switch-project)) |
|
|
|
#+END_SRC |
|
|
@@ -1227,15 +1237,22 @@ Setup: run =M-x dap-go-setup= |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
#+BEGIN_SRC elisp |
|
|
|
(defun my/lsp-find-root (lsp--find-root-interactively &rest args) |
|
|
|
(defun my/lsp-find-root (&rest args) |
|
|
|
(or |
|
|
|
(and (ts/repo/p) |
|
|
|
(pcase (f-ext ($file) t) |
|
|
|
(".rs" (my/rust/workspace-root)) |
|
|
|
(_ nil))) |
|
|
|
(apply lsp--find-root-interactively args))) |
|
|
|
(pcase ($ext t) |
|
|
|
(".rs" (my/rust/workspace-root)) |
|
|
|
(_ nil)))) |
|
|
|
|
|
|
|
(advice-add 'lsp--find-root-interactively :before-until #'my/lsp-find-root) |
|
|
|
|
|
|
|
(defun my/lsp-buffer-killed () |
|
|
|
(when lsp-mode |
|
|
|
(let ((root (lsp-find-session-folder (lsp-session) ($cwd)))) |
|
|
|
;; If we're in an ignored project, remove it from the LSP session |
|
|
|
(when (my/project-ignored-p root) |
|
|
|
(lsp-workspace-folders-remove root))))) |
|
|
|
|
|
|
|
(advice-add 'lsp--find-root-interactively :around #'my/lsp-find-root) |
|
|
|
(add-hook 'kill-buffer-hook #'my/lsp-buffer-killed) |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
** Counsel Search |
|
|
|