summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/prog-lsp.el39
1 files changed, 38 insertions, 1 deletions
diff --git a/modules/prog-lsp.el b/modules/prog-lsp.el
index c976a83e..a6037db8 100644
--- a/modules/prog-lsp.el
+++ b/modules/prog-lsp.el
@@ -8,6 +8,42 @@
;;; Code:
+;; Forward declarations for byte-compile and let-binding under lexical scope.
+;; Real definitions are lsp-mode's defcustoms.
+(defvar lsp-file-watch-ignored-directories)
+(defvar lsp-enable-remote)
+
+;;;;; --------------------- File-Watch Ignore Patterns ---------------------
+;; lsp-mode prompts when a workspace exceeds `lsp-file-watch-threshold' (1000)
+;; directories. Real source repos cross that line easily once node_modules,
+;; build outputs, and language caches are counted. These patterns extend the
+;; lsp-mode defaults (.git, .svn, .idea, ...) instead of replacing them, so the
+;; built-in VC/IDE excludes still apply. Buffer-local overrides via
+;; `.dir-locals.el' don't work — lsp-mode reads the global value at workspace
+;; init, not the buffer-local one. Hence: global defaults here.
+
+(defvar cj/lsp-file-watch-ignored-extras
+ '("[/\\\\]node_modules\\'"
+ "[/\\\\]\\.ruff_cache\\'"
+ "[/\\\\]dist\\'"
+ "[/\\\\]coverage\\'"
+ "[/\\\\]test-results\\'"
+ "[/\\\\]playwright-report\\'"
+ "[/\\\\]tf[/\\\\]\\.terraform\\'"
+ "[/\\\\]__pycache__\\'"
+ "[/\\\\]\\.venv\\'"
+ "[/\\\\]venv\\'"
+ "[/\\\\]\\.pytest_cache\\'"
+ "[/\\\\]\\.mypy_cache\\'"
+ "[/\\\\]target\\'")
+ "Build/cache directory patterns to add to `lsp-file-watch-ignored-directories'.
+Each entry is an Emacs regex matching a path ending in the named directory.")
+
+(defun cj/lsp--add-file-watch-ignored-extras ()
+ "Append `cj/lsp-file-watch-ignored-extras' to lsp-mode's ignore list.
+Idempotent — `add-to-list' skips patterns already present."
+ (dolist (pattern cj/lsp-file-watch-ignored-extras)
+ (add-to-list 'lsp-file-watch-ignored-directories pattern)))
;;;;; ---------------------------- LSP Mode ---------------------------
@@ -38,7 +74,8 @@
(setq lsp-enable-imenu nil)
(setq lsp-enable-snippet nil)
(setq read-process-output-max (* 1024 1024)) ;; 1MB
- (setq lsp-idle-delay 0.5))
+ (setq lsp-idle-delay 0.5)
+ (cj/lsp--add-file-watch-ignored-extras))
;;;;; ----------------------------- LSP UI ----------------------------