]> git.eshelyaron.com Git - emacs.git/commitdiff
Attempt to handle rls sophisticated globs for didchangewwatchedfiles
authorJoão Távora <joaotavora@gmail.com>
Sat, 9 Jun 2018 20:09:03 +0000 (21:09 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sat, 9 Jun 2018 20:09:03 +0000 (21:09 +0100)
* eglot.el (eglot--wildcard-to-regexp): New helper.
(eglot--register-workspace/didChangeWatchedFiles): Use it.

lisp/progmodes/eglot.el

index 97db8fc3f7caa21e2d17023b0fd0eeedeb2d480f..9dd98f0b9bb1d0ef9442987313ad58cf020eee75 100644 (file)
@@ -1610,6 +1610,18 @@ If SKIP-SIGNATURE, don't try to send textDocument/signatureHelp."
 \f
 ;;; Dynamic registration
 ;;;
+(defun eglot--wildcard-to-regexp (wildcard)
+  "(Very lame attempt to) convert WILDCARD to a Elisp regexp."
+  (cl-loop
+   with substs = '(("{" . "\\\\(")
+                   ("}" . "\\\\)")
+                   ("," . "\\\\|"))
+   with string = (wildcard-to-regexp wildcard)
+   for (pattern . rep) in substs
+   for target = string then result
+   for result = (replace-regexp-in-string pattern rep target)
+   finally return result))
+
 (cl-defun eglot--register-workspace/didChangeWatchedFiles (server &key id watchers)
   "Handle dynamic registration of workspace/didChangeWatchedFiles"
   (eglot--unregister-workspace/didChangeWatchedFiles server :id id)
@@ -1623,7 +1635,7 @@ If SKIP-SIGNATURE, don't try to send textDocument/signatureHelp."
              ((and (memq action '(created changed deleted))
                    (cl-find file globs
                             :test (lambda (f glob)
-                                    (string-match (wildcard-to-regexp
+                                    (string-match (eglot--wildcard-to-regexp
                                                    (expand-file-name glob))
                                                   f))))
               (eglot--notify