-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add simple support for workspaceFolders #893
Conversation
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.
Read it, looks rather perfect. :) Two questions
|
Also aren't there some server capability checks in order? |
Yes, garbage buffers are left behind. Should I make an attempt to clean them? Personally I think it's not a problem.
I think so. The client doesn't know whether the server supports workspace-folders before receiving the server-capabilities.
Can you elaborate? |
I don't think the normal user would like a surprising dired buffer to appear as a result of I think my simplistic suggestion where in some (presumably edge) cases we get duplicate names is much better. The server itself can always disambiguate them with the URI, right? Does the spec suggest otherwise?
No need. You just answered in the previous line :-) There are no server caps to check because we don't have the list yet. So that part is fine. |
I'm OK with file-name-base, but how about abbreviate-file-name instead? (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))))))
The specification mentions just this: "The name of the workspace folder. Used to refer to this workspace folder in the user interface." So I think the servers do not care; in some notifications they might refer to a workspace by its name, and the user should recognize the name. |
I don't know what |
Can you add this to the NEWS.md file too. I think it's reasonably relevant. Sorry I forgot to mention that :-) |
|
Close joaotavora/eglot#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.
Close joaotavora/eglot#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.
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. #893: joaotavora/eglot#893
Close joaotavora/eglot#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.
Close joaotavora/eglot#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.
Fixes #890.
I haven't tested the workspace/workspaceFolders request, because I don't know any servers that sends this. But this part of the PR is quite trivial.
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.
`workspaceFolders'.
(eglot-workspace-folders): New cl-defgeneric.
(eglot--connect): Add workspaceFolders to initializeParams.
(eglot-handle-request workspace/workspaceFolders): New cl-defmethod.