@@ -479,46 +479,72 @@ the server has requested that."
479
479
:package-version '(lsp-mode . "6.1"))
480
480
;;;###autoload(put 'lsp-enable-file-watchers 'safe-local-variable #'booleanp)
481
481
482
- (defcustom lsp-file-watch-ignored '(; SCM tools
483
- "[/\\\\]\\.git\\'"
484
- "[/\\\\]\\.hg\\'"
485
- "[/\\\\]\\.bzr\\'"
486
- "[/\\\\]_darcs\\'"
487
- "[/\\\\]\\.svn\\'"
488
- "[/\\\\]_FOSSIL_\\'"
489
- ;; IDE or build tools
490
- "[/\\\\]\\.idea\\'"
491
- "[/\\\\]\\.ensime_cache\\'"
492
- "[/\\\\]\\.eunit\\'"
493
- "[/\\\\]node_modules"
494
- "[/\\\\]\\.fslckout\\'"
495
- "[/\\\\]\\.tox\\'"
496
- "[/\\\\]dist\\'"
497
- "[/\\\\]dist-newstyle\\'"
498
- "[/\\\\]\\.stack-work\\'"
499
- "[/\\\\]\\.bloop\\'"
500
- "[/\\\\]\\.metals\\'"
501
- "[/\\\\]target\\'"
502
- "[/\\\\]\\.ccls-cache\\'"
503
- "[/\\\\]\\.vscode\\'"
504
- ;; Autotools output
505
- "[/\\\\]\\.deps\\'"
506
- "[/\\\\]build-aux\\'"
507
- "[/\\\\]autom4te.cache\\'"
508
- "[/\\\\]\\.reference\\'"
509
- ;; .Net Core build-output
510
- "[/\\\\]bin/Debug\\'"
511
- "[/\\\\]obj\\'")
482
+ (define-obsolete-variable-alias 'lsp-file-watch-ignored 'lsp-file-watch-ignored-directories "7.1.0")
483
+
484
+ (defcustom lsp-file-watch-ignored-directories
485
+ '(; SCM tools
486
+ "[/\\\\]\\.git\\'"
487
+ "[/\\\\]\\.hg\\'"
488
+ "[/\\\\]\\.bzr\\'"
489
+ "[/\\\\]_darcs\\'"
490
+ "[/\\\\]\\.svn\\'"
491
+ "[/\\\\]_FOSSIL_\\'"
492
+ ;; IDE or build tools
493
+ "[/\\\\]\\.idea\\'"
494
+ "[/\\\\]\\.ensime_cache\\'"
495
+ "[/\\\\]\\.eunit\\'"
496
+ "[/\\\\]node_modules"
497
+ "[/\\\\]\\.fslckout\\'"
498
+ "[/\\\\]\\.tox\\'"
499
+ "[/\\\\]dist\\'"
500
+ "[/\\\\]dist-newstyle\\'"
501
+ "[/\\\\]\\.stack-work\\'"
502
+ "[/\\\\]\\.bloop\\'"
503
+ "[/\\\\]\\.metals\\'"
504
+ "[/\\\\]target\\'"
505
+ "[/\\\\]\\.ccls-cache\\'"
506
+ "[/\\\\]\\.vscode\\'"
507
+ ;; Autotools output
508
+ "[/\\\\]\\.deps\\'"
509
+ "[/\\\\]build-aux\\'"
510
+ "[/\\\\]autom4te.cache\\'"
511
+ "[/\\\\]\\.reference\\'"
512
+ ;; .Net Core build-output
513
+ "[/\\\\]bin/Debug\\'"
514
+ "[/\\\\]obj\\'")
512
515
"List of regexps matching directory paths which won't be monitored when creating file watches."
513
516
:group 'lsp-mode
514
517
:type '(repeat string)
515
- :package-version '(lsp-mode . "6.1"))
516
-
517
- (defun lsp-file-watch-ignored ()
518
- lsp-file-watch-ignored)
518
+ :package-version '(lsp-mode . "7.1.0"))
519
+
520
+ (define-obsolete-function-alias 'lsp-file-watch-ignored 'lsp-file-watch-ignored-directories "7.0.1")
521
+
522
+ (defun lsp-file-watch-ignored-directories ()
523
+ lsp-file-watch-ignored-directories)
524
+
525
+ ;; Allow lsp-file-watch-ignored-directories as a file or directory-local variable
526
+ (put 'lsp-file-watch-ignored-directories 'safe-local-variable 'lsp--string-listp)
527
+
528
+ (defcustom lsp-file-watch-ignored-files
529
+ '(
530
+ ;; lockfiles
531
+ "[/\\\\]\\.#[^/\\\\]+\\'"
532
+ ;; backup files
533
+ "[/\\\\][^/\\\\]+~\\'" )
534
+ "List of regexps matching files for which change events will
535
+ not be sent to the server.
536
+
537
+ This setting has no impact on whether a file-watch is created for
538
+ a directory; it merely prevents notifications pertaining to
539
+ matched files from being sent to the server. To prevent a
540
+ file-watch from being created for a directory, customize
541
+ `lsp-file-watch-ignored-directories'"
542
+ :group 'lsp-mode
543
+ :type '(repeat string)
544
+ :package-version '(lsp-mode . "7.1.0"))
519
545
520
- ;; Allow lsp-file-watch-ignored as a file or directory-local variable
521
- (put 'lsp-file-watch-ignored 'safe-local-variable 'lsp--string-listp)
546
+ ;; Allow lsp-file-watch-ignored-files as a file or directory-local variable
547
+ (put 'lsp-file-watch-ignored-files 'safe-local-variable 'lsp--string-listp)
522
548
523
549
(defcustom lsp-after-uninitialized-functions nil
524
550
"List of functions to be called after a Language Server has been uninitialized."
@@ -1743,7 +1769,7 @@ This set of allowed chars is enough for hexifying local file paths.")
1743
1769
(cond
1744
1770
((and (file-directory-p file-name)
1745
1771
(equal 'created event-type)
1746
- (not (lsp--string-match-any (lsp-file-watch-ignored) file-name)))
1772
+ (not (lsp--string-match-any (lsp-file-watch-ignored-directories ) file-name)))
1747
1773
1748
1774
(lsp-watch-root-folder (file-truename file-name) callback watch)
1749
1775
@@ -1754,11 +1780,12 @@ This set of allowed chars is enough for hexifying local file paths.")
1754
1780
(unless (file-directory-p f)
1755
1781
(funcall callback (list nil 'created f)))))))
1756
1782
((and (not (file-directory-p file-name))
1783
+ (not (lsp--string-match-any lsp-file-watch-ignored-files file-name))
1757
1784
(memq event-type '(created deleted changed)))
1758
1785
(funcall callback event)))))
1759
1786
1760
1787
(defun lsp--directory-files-recursively (dir regexp &optional include-directories)
1761
- "Copy of `directory-files-recursively' but it skips `lsp-file-watch-ignored'."
1788
+ "Copy of `directory-files-recursively' but it skips `lsp-file-watch-ignored-directories '."
1762
1789
(let* ((result nil)
1763
1790
(files nil)
1764
1791
(dir (directory-file-name dir))
@@ -1769,7 +1796,7 @@ This set of allowed chars is enough for hexifying local file paths.")
1769
1796
'string<))
1770
1797
(unless (member file '("./" "../"))
1771
1798
(if (and (directory-name-p file)
1772
- (not (lsp--string-match-any (lsp-file-watch-ignored) (f-join dir (f-filename file)))))
1799
+ (not (lsp--string-match-any (lsp-file-watch-ignored-directories ) (f-join dir (f-filename file)))))
1773
1800
(let* ((leaf (substring file 0 (1- (length file))))
1774
1801
(full-file (f-join dir leaf)))
1775
1802
;; Don't follow symlinks to other directories.
@@ -1838,7 +1865,7 @@ already have been created."
1838
1865
(file-truename f)
1839
1866
f)
1840
1867
(lsp-watch-descriptors watch)))
1841
- (not (lsp--string-match-any (lsp-file-watch-ignored) f))
1868
+ (not (lsp--string-match-any (lsp-file-watch-ignored-directories ) f))
1842
1869
(not (-contains? '("." "..") (f-filename f)))))
1843
1870
(directory-files dir t))))
1844
1871
(error (lsp-log "Failed to create a watch for %s: message" (error-message-string err)))
0 commit comments