-
Notifications
You must be signed in to change notification settings - Fork 201
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
[JAVA/Eclipse server] Warnings and errors #176
Comments
We've already had a discussion about this. Eglot is minimalist, which means it doesn't have many server-specific customizable variables, unless they're necessary. If you use this, you can disable questions from the java contact: (defconst my/eclipse-jdt-home "/tmp/jdt-language-server-latest.tar/plugins/org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar")
(defun my/eclipse-jdt-contact (interactive)
(let ((cp (getenv "CLASSPATH")))
(setenv "CLASSPATH" (concat cp ":" my/eclipse-jdt-home))
(unwind-protect
(eglot--eclipse-jdt-contact nil)
(setenv "CLASSPATH" cp))))
(setcdr (assq 'java-mode eglot-server-programs) #'my/eclipse-jdt-contact)
This is also server-specific behavior. (cl-defmethod eglot-handle-notification
((_server eglot-eclipse-jdt) (_method (eql language/status)) &key type message)
(eglot--message "%s" message))
|
Can you show the debugger backtrace? Use
Looks like the server doesn't want you to have those parens.
|
|
Thanks, that helped me narrow the problem down. (let ((object '(:jsonrpc "2.0" :id 2055
:method "completionItem/resolve"
:params (:label "SystemColor - java.awt" :bounds (232 . 238)))))
(let ((json-false :json-false) (json-null nil))
(json-encode object))) Basically, we're trying to encode a cons cell which is not a list (the diff --git a/eglot.el b/eglot.el
index 727b761..7695b83 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1746,7 +1746,7 @@ is not active."
(string-trim-left label))
(t
(or insertText (string-trim-left label))))))
- (setq all (append all `(:bounds ,bounds)))
+ (add-text-properties 0 1 `(:bounds ,bounds) completion)
(add-text-properties 0 1 all completion)
(put-text-property 0 1 'eglot--lsp-completion all completion) |
@mkcms, thanks, but no need. The problem is almost certainly gone after commit f63bedb, which is already in master. I just forgot to comment that I fixed it. here's the relevant diff. --- a/eglot.el
+++ b/eglot.el
@@ -1720,124 +1745,126 @@
(defun eglot-completion-at-point ()
"EGLOT's `completion-at-point' function."
(let ((bounds (bounds-of-thing-at-point 'symbol))
(server (eglot--current-server-or-lose))
(completion-capability (eglot--server-capable :completionProvider))
strings)
(when completion-capability
(list
(or (car bounds) (point))
(or (cdr bounds) (point))
(completion-table-dynamic
(lambda (_ignored)
(let* ((resp (jsonrpc-request server
:textDocument/completion
(eglot--CompletionParams)
:deferred :textDocument/completion
:cancel-on-input t))
(items (if (vectorp resp) resp (plist-get resp :items))))
(setq
strings
(mapcar
(jsonrpc-lambda (&rest all &key label insertText insertTextFormat
&allow-other-keys)
(let ((completion
(cond ((and (eql insertTextFormat 2)
(eglot--snippet-expansion-fn))
(string-trim-left label))
(t
(or insertText (string-trim-left label))))))
- (setq all (append all `(:bounds ,bounds)))
(add-text-properties 0 1 all completion)
+ (put-text-property 0 1 'eglot--completion-bounds bounds completion)
(put-text-property 0 1 'eglot--lsp-completion all completion)
completion))
items)))))
:annotation-function
(lambda (obj)
- (cl-destructuring-bind (&key detail kind insertTextFormat
- &allow-other-keys)
- (text-properties-at 0 obj)
+ (eglot--dbind ((CompletionItem) detail kind insertTextFormat)
+ (get-text-property 0 'eglot--lsp-completion obj)
(let* ((detail (and (stringp detail)
(not (string= detail ""))
detail))
(annotation
(or detail
(cdr (assoc kind eglot--kind-names)))))
(when annotation
(concat " "
(propertize annotation
'face 'font-lock-function-name-face)
(and (eql insertTextFormat 2)
(eglot--snippet-expansion-fn)
" (snippet)"))))))
:display-sort-function
(lambda (items)
(sort items (lambda (a b)
(string-lessp
(or (get-text-property 0 :sortText a) "")
(or (get-text-property 0 :sortText b) "")))))
:company-doc-buffer
(lambda (obj)
(let* ((documentation
(or (get-text-property 0 :documentation obj)
(and (eglot--server-capable :completionProvider
:resolveProvider)
(plist-get
(jsonrpc-request server :completionItem/resolve
(get-text-property
0 'eglot--lsp-completion obj)
:cancel-on-input t)
:documentation))))
(formatted (and documentation
(eglot--format-markup documentation))))
(when formatted
(with-current-buffer (get-buffer-create " *eglot doc*")
(erase-buffer)
(insert formatted)
(current-buffer)))))
:company-prefix-length
(cl-some #'looking-back
(mapcar #'regexp-quote
(plist-get completion-capability :triggerCharacters)))
:exit-function
(lambda (comp _status)
(let ((comp (if (get-text-property 0 'eglot--lsp-completion comp)
comp
;; When selecting from the *Completions*
;; buffer, `comp' won't have any properties. A
;; lookup should fix that (github#148)
(cl-find comp strings :test #'string=))))
- (cl-destructuring-bind (&key insertTextFormat
- insertText
- textEdit
- additionalTextEdits
- bounds
- &allow-other-keys)
- (text-properties-at 0 comp)
+ (eglot--dbind ((CompletionItem) insertTextFormat
+ insertText
+ textEdit
+ additionalTextEdits)
+ (get-text-property 0 'eglot--lsp-completion comp)
(let ((snippet-fn (and (eql insertTextFormat 2)
- (eglot--snippet-expansion-fn))))
+ (eglot--snippet-expansion-fn)))
+ ;; FIXME: it would have been much easier to fetch
+ ;; these from the lexical environment, but we can't
+ ;; in company because of
+ ;; https://github.com/company-mode/company-mode/pull/845
+ (bounds (get-text-property 0 'eglot--completion-bounds comp)))
(cond (textEdit
;; Undo the just the completed bit. If before
;; completion the buffer was "foo.b" and now is
;; "foo.bar", `comp' will be "bar". We want to
;; delete only "ar" (`comp' minus the symbol
;; whose bounds we've calculated before)
;; (github#160).
(delete-region (+ (- (point) (length comp))
(if bounds (- (cdr bounds) (car bounds)) 0))
(point))
- (cl-destructuring-bind (&key range newText) textEdit
+ (eglot--dbind ((TextEdit) range newText) textEdit
(pcase-let ((`(,beg . ,end) (eglot--range-region range)))
(delete-region beg end)
(goto-char beg)
(funcall (or snippet-fn #'insert) newText)))
(when (cl-plusp (length additionalTextEdits))
(eglot--apply-text-edits additionalTextEdits)))
(snippet-fn
;; A snippet should be inserted, but using plain
;; `insertText'. This requires us to delete the
;; whole completion, since `insertText' is the full
;; completion's text.
(delete-region (- (point) (length comp)) (point))
(funcall snippet-fn insertText))))
(eglot--signal-textDocument/didChange)
(eglot-eldoc-function)))))))) |
Oh right, I forgot to pull. That's even better. |
@mkcms What about those functions/class parens? Is there any fix in mind or that aint a priority... Anyway, thanks for the good work so far! Y'all rock! |
@joaotavora @mkcms Still, scrolling down company completion list and hitting c-g, Emacs crashes! |
Do you mean Emacs crashes? |
I also have this doubt. I have experienced hard-to-reproduce crashes once in a while with @eubarbosa Do you know anything about reproducing problems from a controlled environment? To trace this we would need you to start an Emacs with just:
Only these things should be in your Emacs, nothing more (means no Spacemacs/Doom fanciness if you are using that sort of thing). You can use
Then do whatever you normally do and find your java project file, |
@mkcms @joaotavora I could reproduce it twice, but at the third attempt Eglot did not crash Emacs: Unable to reproduce that crash I can only guess that company, quickhelp or even eclipse server might have upload a new version that fix that bug! As I said, company crashed in a eglot buffer but not in a emacs-lisp buffer! With that, closing this issue! Thanks! |
Hi,
Eglot is issuing some warnings and errors:
eclipse.jdt.ls
lsp-mode set its default folder as
~/emacs.d/eclipse.jdt.ls
.Should not EGLOT try that folder before questioning where the server is?
Once eclipse server folder is set, EGLOT loads and issues some warnings:
Warning (eglot): Server sent unknown notification method `language/status' Warning (eglot): Server sent unknown notification method `language/actionableNotification'
company-quickhelp/capf warnings:
Unable to acertain if company-quickhelp issue or eglot:
Error running timer `company-quickhelp--show': (error "Company: backend company-capf error \"Wrong type argument: listp, 4\" with args (doc-buffer class)")
Company
Typing a function/class, company/eglot won't input its parentheses altogether with the function/class name.
Server: jdt-language-server-0.30.0-201812072141.tar.gz
Eglot version: 1.2
Debian SID
T430
The text was updated successfully, but these errors were encountered: