Skip to content

Commit

Permalink
Per #63: minimally support workspaceFolders
Browse files Browse the repository at this point in the history
* README.md (Supported Protocol features): Declare
workspaceFolders partially supported.

* eglot.el (eglot-client-capabilities): Declare workspaceFolders
supported.
(eglot--connect): Maybe send :workspaceFolders in :initialize
request.
  • Loading branch information
joaotavora committed Aug 7, 2018
1 parent 4c019bd commit aa7398f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ eglot-shutdown`.
- [x] client/unregisterCapability (ditto)

## Workspace
- [ ] workspace/workspaceFolders (3.6.0)
- [x] workspace/workspaceFolders (3.6.0, partial)
- [ ] workspace/didChangeWorkspaceFolders (3.6.0)
- [x] workspace/didChangeConfiguration
- [ ] workspace/configuration (3.6.0)
Expand Down
22 changes: 15 additions & 7 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ lasted more than that many seconds."
:executeCommand `(:dynamicRegistration :json-false)
:workspaceEdit `(:documentChanges :json-false)
:didChangeWatchedFiles `(:dynamicRegistration t)
:symbol `(:dynamicRegistration :json-false))
:symbol `(:dynamicRegistration :json-false)
:workspaceFolders t)
:textDocument
(list
:synchronization (list
Expand Down Expand Up @@ -512,12 +513,19 @@ This docstring appeases checkdoc, that's all."
(jsonrpc-request
server
:initialize
(list :processId (unless (eq (jsonrpc-process-type server) 'network)
(emacs-pid))
:rootPath (expand-file-name default-directory)
:rootUri (eglot--path-to-uri default-directory)
:initializationOptions (eglot-initialization-options server)
:capabilities (eglot-client-capabilities server)))
`(:processId
(unless (eq (jsonrpc-process-type server) 'network)
(emacs-pid))
:rootPath (expand-file-name default-directory)
:rootUri (eglot--path-to-uri default-directory)
:initializationOptions (eglot-initialization-options server)
:capabilities (eglot-client-capabilities server)
,@(when (cdr (project-roots project))
`(:workspaceFolders
[,@(mapcar (lambda (root)
(list :uri (eglot--path-to-uri root)
:name (file-name-base root)))
(project-roots (eglot--project server)))]))))
(setf (eglot--capabilities server) capabilities)
(dolist (buffer (buffer-list))
(with-current-buffer buffer
Expand Down

0 comments on commit aa7398f

Please sign in to comment.