-
Notifications
You must be signed in to change notification settings - Fork 200
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 go-langserver #74
Conversation
I'm getting these errors on save:
Seems like
Here's the return value of
|
I just pushed another commit, intended to address the issue above. |
@edkolev, although redesigning this problematic function isn't bad per se, you are breaking other use cases. I think, the correct fix is more like this diff --git a/eglot.el b/eglot.el
index 88c6b45..63fbce2 100644
--- a/eglot.el
+++ b/eglot.el
@@ -728,12 +728,12 @@ under cursor."
feats)
(cl-loop for caps = (eglot--capabilities (eglot--current-server-or-lose))
then (cadr probe)
- for feat in feats
+ for (feat . more) on feats
for probe = (plist-member caps feat)
if (not probe) do (cl-return nil)
if (eq (cadr probe) :json-false) do (cl-return nil)
- if (not (listp (cadr probe))) do (cl-return (cadr probe))
- finally (cl-return (or probe t)))))
+ if (not (listp (cadr probe))) do (cl-return (if more nil (cadr probe)))
+ finally (cl-return (or (cadr probe) t)))))
(defun eglot--range-region (range &optional markers)
"Return region (BEG . END) that represents LSP RANGE. Here is a unit test with some cases that the function must pass. Feel free to add more and discuss them here. If there are no objections I will push my version (and the unit test) sometime tomorrow. (ert-deftest eglot-capabilities ()
"Test `eglot--server-capable'"
(cl-letf (((symbol-function 'eglot--capabilities)
(lambda (_dummy)
;; test data lifted from Golangserver example at
;; https://github.com/joaotavora/eglot/pull/74
(list :textDocumentSync 2 :hoverProvider t
:completionProvider '(:triggerCharacters ["."])
:signatureHelpProvider '(:triggerCharacters ["(" ","])
:definitionProvider t :typeDefinitionProvider t
:referencesProvider t :documentSymbolProvider t
:workspaceSymbolProvider t :implementationProvider t
:documentFormattingProvider t :xworkspaceReferencesProvider t
:xdefinitionProvider t :xworkspaceSymbolByProperties t)))
((symbol-function 'eglot--current-server-or-lose)
(lambda () nil)))
(should (eql 2 (eglot--server-capable :textDocumentSync)))
(should (eglot--server-capable :completionProvider :triggerCharacters))
(should (equal '(:triggerCharacters ["."]) (eglot--server-capable :completionProvider)))
(should-not (eglot--server-capable :foobarbaz))
(should-not (eglot--server-capable :textDocumentSync :foobarbaz))))
|
* eglot-tests.el (eglot-capabilities): New test. * eglot.el (eglot--server-capable): Fix problems with queries for multiple capabilities.
Actually, I changed my mind. Better push it now and amend it if you have any objections. |
No objections, plus I don't see the error in the logs anymore. I removed the commit which changed the eglot--server-capable function. I'm getting however this lisp error with the go language server (I don't see it with the python lang server):
|
This is likely a bug introduced by a later commit. It shouldn't be very hard to fix... |
* eglot.el (eglot-eldoc-function): Check non-nil contents.
Actually, it wasn't, but I fixed it anyway. |
Pushed with a tweak to the commit message |
Great, thanks! I've signed FSF's copyright assignment BTW. |
Thanks. That's good to know.
…On Sun, Aug 19, 2018, 05:20 Evgeni Kolev ***@***.***> wrote:
Great, thanks!
I've signed FSF's copyright assignment BTW.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#74 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXnw5VevJBoiFzn8nkU16x5z7MUZCGaks5uSOd9gaJpZM4V-uDS>
.
|
Copyright-paperwork-exempt: yes * eglot.el (eglot--mode-line-format): Fix a typo.
…tiple features * eglot-tests.el (eglot-capabilities): New test. * eglot.el (eglot--server-capable): Fix problems with queries for multiple capabilities.
…er message * eglot.el (eglot-eldoc-function): Check non-nil contents.
…tiple features * eglot-tests.el (eglot-capabilities): New test. * eglot.el (eglot--server-capable): Fix problems with queries for multiple capabilities.
…er message * eglot.el (eglot-eldoc-function): Check non-nil contents.
* eglot-tests.el (eglot-capabilities): New test. * eglot.el (eglot--server-capable): Fix problems with queries for multiple capabilities. #74: joaotavora/eglot#74
* eglot.el (eglot-eldoc-function): Check non-nil contents. #74: joaotavora/eglot#74
Copyright-paperwork-exempt: yes * README.md (Installation and usage): Add go-langserver. * eglot.el (eglot-server-programs): Add go-langserver. (#74: joaotavora/eglot#74
Copyright-paperwork-exempt: yes * eglot.el (eglot--mode-line-format): Fix a typo. (#74: joaotavora/eglot#74
* eglot-tests.el (eglot-capabilities): New test. * eglot.el (eglot--server-capable): Fix problems with queries for multiple capabilities. GitHub-reference: per joaotavora/eglot#74
* eglot.el (eglot-eldoc-function): Check non-nil contents. GitHub-reference: per joaotavora/eglot#74
Copyright-paperwork-exempt: yes * README.md (Installation and usage): Add go-langserver. * eglot.el (eglot-server-programs): Add go-langserver. GitHub-reference: joaotavora/eglot#74
Copyright-paperwork-exempt: yes * eglot.el (eglot--mode-line-format): Fix a typo. GitHub-reference: joaotavora/eglot#74
This PR adds auto-detection for go-mode buffers utilizing https://github.com/sourcegraph/go-langserver.