From: João Távora Date: Sat, 9 Jun 2018 20:09:03 +0000 (+0100) Subject: Attempt to handle rls sophisticated globs for didchangewwatchedfiles X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~509 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=af32ce29ef3f9f5d93ad4ce57b9cf1a59435455e;p=emacs.git Attempt to handle rls sophisticated globs for didchangewwatchedfiles * eglot.el (eglot--wildcard-to-regexp): New helper. (eglot--register-workspace/didChangeWatchedFiles): Use it. --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 97db8fc3f7c..9dd98f0b9bb 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1610,6 +1610,18 @@ If SKIP-SIGNATURE, don't try to send textDocument/signatureHelp." ;;; 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