Skip to content
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

Future proofing eglot-connect-timeout for newest emacs #1342

Closed
BrunodaSilvaBelo opened this issue Dec 28, 2023 · 2 comments
Closed

Future proofing eglot-connect-timeout for newest emacs #1342

BrunodaSilvaBelo opened this issue Dec 28, 2023 · 2 comments

Comments

@BrunodaSilvaBelo
Copy link

BrunodaSilvaBelo commented Dec 28, 2023

Hi, I use emacs' git version and with eglot 1.16 in this build GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.39, cairo version 1.18.0) of 2023-12-27 had a breaking change. I always set eglot-connect-timeout to nil, but now i'm receiving this error:

Debugger entered--Lisp error: (wrong-type-argument timerp nil)
  cancel-timer(nil)
  jsonrpc--remove(#<eglot-lsp-server eglot-lsp-server-156e2b0b5864> 1)
  jsonrpc-connection-receive(#<eglot-lsp-server eglot-lsp-server-156e2b0b5864> (:jsonrpc "2.0" :id 1 :result (:capabilities (:completionProvider (:triggerCharacters ["2" ":" "#" "\\"]) :documentFormattingProvider t :textDocumentSync (:change 2 :openClose t :save (:includeText :json-false) :willSave t :willSaveWaitUntil t)) :serverInfo (:name "beancount-language-server" :version "1.3.1")) :jsonrpc-json "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"capabilities\":{\"completionProvider\":{\"triggerCharacters\":[\"2\",\":\",\"#\",\"\\\\\"]},\"documentFormattingProvider\":true,\"textDocumentSync\":{\"change\":2,\"openClose\":true,\"save\":{\"includeText\":false},\"willSave\":true,\"willSaveWaitUntil\":true}},\"serverInfo\":{\"name\":\"beancount-language-server\",\"version\":\"1.3.1\"}}}"))
  #f(compiled-function (m) #<bytecode -0xa23201442836311>)((:jsonrpc "2.0" :id 1 :result (:capabilities (:completionProvider (:triggerCharacters ["2" ":" "#" "\\"]) :documentFormattingProvider t :textDocumentSync (:change 2 :openClose t :save (:includeText :json-false) :willSave t :willSaveWaitUntil t)) :serverInfo (:name "beancount-language-server" :version "1.3.1")) :jsonrpc-json "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"capabilities\":{\"completionProvider\":{\"triggerCharacters\":[\"2\",\":\",\"#\",\"\\\\\"]},\"documentFormattingProvider\":true,\"textDocumentSync\":{\"change\":2,\"openClose\":true,\"save\":{\"includeText\":false},\"willSave\":true,\"willSaveWaitUntil\":true}},\"serverInfo\":{\"name\":\"beancount-language-server\",\"version\":\"1.3.1\"}}}"))
  apply(#f(compiled-function (m) #<bytecode -0xa23201442836311>) (:jsonrpc "2.0" :id 1 :result (:capabilities (:completionProvider (:triggerCharacters ["2" ":" "#" "\\"]) :documentFormattingProvider t :textDocumentSync (:change 2 :openClose t :save (:includeText :json-false) :willSave t :willSaveWaitUntil t)) :serverInfo (:name "beancount-language-server" :version "1.3.1")) :jsonrpc-json "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"capabilities\":{\"completionProvider\":{\"triggerCharacters\":[\"2\",\":\",\"#\",\"\\\\\"]},\"documentFormattingProvider\":true,\"textDocumentSync\":{\"change\":2,\"openClose\":true,\"save\":{\"includeText\":false},\"willSave\":true,\"willSaveWaitUntil\":true}},\"serverInfo\":{\"name\":\"beancount-language-server\",\"version\":\"1.3.1\"}}}"))
  timer-event-handler([t 25996 58782 45355 nil #f(compiled-function (m) #<bytecode -0xa23201442836311>) ((:jsonrpc "2.0" :id 1 :result (:capabilities (:completionProvider (:triggerCharacters ["2" ":" "#" "\\"]) :documentFormattingProvider t :textDocumentSync (:change 2 :openClose t :save (:includeText :json-false) :willSave t :willSaveWaitUntil t)) :serverInfo (:name "beancount-language-server" :version "1.3.1")) :jsonrpc-json "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"capabilities\":{\"completionProvider\":{\"triggerCharacters\":[\"2\",\":\",\"#\",\"\\\\\"]},\"documentFormattingProvider\":true,\"textDocumentSync\":{\"change\":2,\"openClose\":true,\"save\":{\"includeText\":false},\"willSave\":true,\"willSaveWaitUntil\":true}},\"serverInfo\":{\"name\":\"beancount-language-server\",\"version\":\"1.3.1\"}}}")) nil 361000 nil])
  accept-process-output(nil 3)
  eglot--connect((beancount-mode) (transient . "/home/edge/.emacs.d/beancount/") eglot-lsp-server ("beancount-language-server" "--stdio") ("beancount"))
  eglot((beancount-mode) (transient . "/home/edge/.emacs.d/beancount/") eglot-lsp-server ("beancount-language-server" "--stdio") ("beancount") t)
  funcall-interactively(eglot (beancount-mode) (transient . "/home/edge/.emacs.d/beancount/") eglot-lsp-server ("beancount-language-server" "--stdio") ("beancount") t)
  hydra--call-interactively-remap-maybe(eglot)
  (progn (setq this-command 'eglot) (hydra--call-interactively-remap-maybe #'eglot))
  eglot/eglot-and-exit()
  funcall-interactively(eglot/eglot-and-exit)
  command-execute(eglot/eglot-and-exit)

Setting eglot-connect-timeout to integer solves this problem, maybe in the future, a new way to make eglot never timeout is needed.

@BrunodaSilvaBelo BrunodaSilvaBelo changed the title Future proving eglot-connect-timeout for newest emacs Future proofing eglot-connect-timeout for newest emacs Dec 28, 2023
@hydrocat
Copy link

@BrunodaSilvaBelo How did you do that ?

Often times eglot bugs out and I keep getting this error message:

Process EGLOT (cloud-analytics/(python-mode python-ts-mode)) not running: killed

I suppose that your solution may work for me too.

@joaotavora
Copy link
Owner

@BrunodaSilvaBelo this was a bug in Jsonrpc, which I've just fixed, should appear in GNU ELPA soon.

@hydrocat this probably has nothing to do with that, but it's impossible to tell.

One of the reasons I missed this issue, is that it's not according to what an issue should be in the Eglot repo. Please make issues with full reproduction recipes. If you don't have time, just start a discussion instead.

dickmao pushed a commit to commercial-emacs/commercial-emacs that referenced this issue Jan 15, 2024
* lisp/jsonrpc.el (jsonrpc--remove): Check timer before cancelling it.
(Version): Bump to 1.2.24

See joaotavora/eglot#1342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants