[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 9eb9353fdc: Add simple support for workspaceFolde
From: |
ELPA Syncer |
Subject: |
[elpa] externals/eglot 9eb9353fdc: Add simple support for workspaceFolders |
Date: |
Sun, 20 Mar 2022 12:57:31 -0400 (EDT) |
branch: externals/eglot
commit 9eb9353fdc15c91a66ef8f4e53e18b22aa0870cd
Author: Felicián Németh <felician.nemeth@gmail.com>
Commit: Felicián Németh <felician.nemeth@gmail.com>
Add simple support for workspaceFolders
Close #893.
Clients can support workspaceFolders since LSP 3.6. rootUri and
rootPath are deprecated. Dynamic changes in folders are not
supported, i.e., this patch does not implement
workspace/didChangeWorkspaceFolders.
* eglot.el (eglot-client-capabilities): Add capability
`workspaceFolders'.
(eglot-workspace-folders): New cl-defgeneric.
(eglot--connect): Add workspaceFolders to initializeParams.
(eglot-handle-request workspace/workspaceFolders): New cl-defmethod.
---
eglot.el | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/eglot.el b/eglot.el
index 3bd2d844c8..daf6c3e237 100644
--- a/eglot.el
+++ b/eglot.el
@@ -654,7 +654,8 @@ treated as in `eglot-dbind'."
`(:dynamicRegistration
,(if (eglot--trampish-p s) :json-false t))
:symbol `(:dynamicRegistration :json-false)
- :configuration t)
+ :configuration t
+ :workspaceFolders t)
:textDocument
(list
:synchronization (list
@@ -719,6 +720,15 @@ treated as in `eglot-dbind'."
#'car eglot--tag-faces)])))
:experimental eglot--{})))
+(cl-defgeneric eglot-workspace-folders (server)
+ "Return workspaceFolders for SERVER."
+ (let ((project (eglot--project server)))
+ (vconcat
+ (mapcar (lambda (dir)
+ (list :uri (eglot--path-to-uri dir)
+ :name (abbreviate-file-name dir)))
+ `(,(project-root project) ,@(project-external-roots project))))))
+
(defclass eglot-lsp-server (jsonrpc-process-connection)
((project-nickname
:documentation "Short nickname for the associated project."
@@ -1164,7 +1174,8 @@ This docstring appeases checkdoc, that's all."
:rootUri (eglot--path-to-uri default-directory)
:initializationOptions
(eglot-initialization-options
server)
- :capabilities (eglot-client-capabilities server))
+ :capabilities (eglot-client-capabilities server)
+ :workspaceFolders (eglot-workspace-folders server))
:success-fn
(eglot--lambda ((InitializeResult) capabilities
serverInfo)
(unless cancelled
@@ -1924,6 +1935,11 @@ THINGS are either registrations or unregisterations
(sic)."
"Handle server request workspace/applyEdit."
(eglot--apply-workspace-edit edit eglot-confirm-server-initiated-edits))
+(cl-defmethod eglot-handle-request
+ (server (_method (eql workspace/workspaceFolders)))
+ "Handle server request workspace/workspaceFolders."
+ (eglot-workspace-folders server))
+
(defun eglot--TextDocumentIdentifier ()
"Compute TextDocumentIdentifier object for current buffer."
`(:uri ,(eglot--path-to-uri (or buffer-file-name
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/eglot 9eb9353fdc: Add simple support for workspaceFolders,
ELPA Syncer <=