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

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

[elpa] externals/eglot ef34797 14/54: Fix #340: Don't choke on workspace


From: João Távora
Subject: [elpa] externals/eglot ef34797 14/54: Fix #340: Don't choke on workspace/configuration with no scopeUri
Date: Thu, 16 Apr 2020 05:31:47 -0400 (EDT)

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

    Fix #340: Don't choke on workspace/configuration with no scopeUri
    
    * eglot.el (eglot-handle-request): Don't choke on nil scopeUri.
---
 eglot.el | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/eglot.el b/eglot.el
index a0f57f4..7133426 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1678,20 +1678,23 @@ When called interactively, use the currently active 
server"
   (apply #'vector
          (mapcar
           (eglot--lambda ((ConfigurationItem) scopeUri section)
-            (let* ((path (eglot--uri-to-path scopeUri)))
-              (when (file-directory-p path)
-                (with-temp-buffer
-                  (let ((default-directory path))
-                    (setq-local major-mode (eglot--major-mode server))
-                    (hack-dir-local-variables-non-file-buffer)
-                    (alist-get section eglot-workspace-configuration
-                               nil nil
-                               (lambda (wsection section)
-                                 (string=
-                                  (if (keywordp wsection)
-                                      (substring (symbol-name wsection) 1)
-                                    wsection)
-                                  section))))))))
+            (with-temp-buffer
+              (let* ((uri-path (eglot--uri-to-path scopeUri))
+                     (default-directory
+                       (if (and (not (string-empty-p uri-path))
+                                (file-directory-p uri-path))
+                           uri-path
+                           (car (project-roots (eglot--project server))))))
+                (setq-local major-mode (eglot--major-mode server))
+                (hack-dir-local-variables-non-file-buffer)
+                (alist-get section eglot-workspace-configuration
+                           nil nil
+                           (lambda (wsection section)
+                             (string=
+                              (if (keywordp wsection)
+                                  (substring (symbol-name wsection) 1)
+                                wsection)
+                              section))))))
           items)))
 
 (defun eglot--signal-textDocument/didChange ()



reply via email to

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