emacs-diffs
[Top][All Lists]
Advanced

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

master fad48a20e66 1/2: Handle directory values of scopeUri in workspace


From: João Távora
Subject: master fad48a20e66 1/2: Handle directory values of scopeUri in workspace/configuration
Date: Thu, 31 Aug 2023 19:57:49 -0400 (EDT)

branch: master
commit fad48a20e665e6b5b51c417e9c04946517a2aa2f
Author: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Handle directory values of scopeUri in  workspace/configuration
    
    Even though scopeUri is specified to be of documentUri type, some
    servers (notably pyright) insist on passing the pathname of a
    directory there.  In pyright's case this is frequently useless, as the
    directory is the project directory.  Nevertheless we can be lenient to
    those servers by detecting whether the value is a directory and doing
    the right thing.
    
    Note that we do not (yet) support per-file configuration storage.
    
    * lisp/progmodes/eglot.el (eglot--workspace-configuration-plist):
    Rework.
    
    Co-authored-by: João Távora <joaotavora@gmail.com>
    GitHub-reference: https://github.com/joaotavora/eglot/pull/1281
---
 lisp/progmodes/eglot.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 65daa0941d5..6f08f26857b 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2608,8 +2608,10 @@ local value of the `eglot-workspace-configuration' 
variable, else
 use the root of SERVER's `eglot--project'."
   (let ((val (with-temp-buffer
                (setq default-directory
-                     (if path
-                         (file-name-directory path)
+                     ;; See github#1281
+                     (if path (if (file-directory-p path)
+                                  (file-name-as-directory path)
+                                (file-name-directory path))
                        (project-root (eglot--project server))))
                ;; Set the major mode to be the first of the managed
                ;; modes.  This is the one the user started eglot in.



reply via email to

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