emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/eglot f6bb0a7 08/11: Attempt to handle RLS sophisticate


From: João Távora
Subject: [elpa] externals/eglot f6bb0a7 08/11: Attempt to handle RLS sophisticated globs for didChangeWWatchedFiles
Date: Sun, 10 Jun 2018 09:57:29 -0400 (EDT)

branch: externals/eglot
commit f6bb0a74e849fc75c546f663aeb9c0ca14f2ddec
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Attempt to handle RLS sophisticated globs for didChangeWWatchedFiles
    
    * eglot.el (eglot--wildcard-to-regexp): New helper.
    (eglot--register-workspace/didChangeWatchedFiles): Use it.
---
 eglot.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index 97db8fc..9dd98f0 100644
--- a/eglot.el
+++ b/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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]