From af32ce29ef3f9f5d93ad4ce57b9cf1a59435455e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sat, 9 Jun 2018 21:09:03 +0100 Subject: [PATCH] Attempt to handle rls sophisticated globs for didchangewwatchedfiles * eglot.el (eglot--wildcard-to-regexp): New helper. (eglot--register-workspace/didChangeWatchedFiles): Use it. --- lisp/progmodes/eglot.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 -- 2.39.2