Trevoke / alchemist.el

Elixir Tooling Integration Into Emacs
http://www.alchemist-elixir.org
5 stars 2 forks source link

BUG - wront-type-argument sequencep 62 #13

Closed victorolinasc closed 5 years ago

victorolinasc commented 6 years ago

Describe the bug

When navigating through source code sometimes an error occur saying: wrong-type-argument sequencep 62 on lsp--render-on-hover-content. This freezes emacs for a little while (but it recovers after some seconds).

I think this started after some lsp-mode/lsp-ui updates... not sure and not sure how to try a downgrade =/

If this is an lsp-mode error (most likely lsp-ui) then I'll open an issue there. But to me, this seems like a alchemist.el specific issue.

I've enabled debug errors (M-x toggle-debug-on-errors) and this is the stack trace:

Debugger entered--Lisp error: (wrong-type-argument sequencep 62)
  mapconcat(identity (62) "\n")
  lsp--render-on-hover-content("> Jason\n\nA blazing fast JSON parser and generator in pure Elixir.\n" #s(lsp--client :language-id #f(compiled-function (_) #<bytecode 0x1928629>) :send-sync nil :send-async nil :type nil :new-connection #f(compiled-function (filter sentinel) #<bytecode 0x19299c9>) :stderr "*lsp-elixir-mode stderr*" :get-root (closure (t) nil (alchemist-project-root-or-default-dir)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1994601> :request-handlers #<hash-table equal 0/65 0x1ea8485> :response-handlers #<hash-table eql 31/65 0x1ea84a5> :string-renderers nil :last-id 1125 :enable-function lsp-elixir-mode-enable :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x1ea84c5> :action-handlers #<hash-table equal 0/65 0x18a54d1> :default-renderer nil) nil)
  #f(compiled-function (hover) #<bytecode 0x1c683e5>)(#<hash-table equal 2/65 0x20db0e1>)
  lsp--parser-on-message(#s(lsp--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "" :queued-notifications nil :queued-requests nil :workspace #s(lsp--workspace :parser #1 :file-versions #<hash-table equal 9/65 0x18a551d> :server-capabilities #<hash-table equal 11/65 0x145c095> :registered-server-capabilities nil :root "<</some/path/to/my/project>>" :client #s(lsp--client :language-id #f(compiled-function (_) #<bytecode 0x1928629>) :send-sync nil :send-async nil :type nil :new-connection #f(compiled-function (filter sentinel) #<bytecode 0x19299c9>) :stderr "*lsp-elixir-mode stderr*" :get-root (closure (t) nil (alchemist-project-root-or-default-dir)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1994601> :request-handlers #<hash-table equal 0/65 0x1ea8485> :response-handlers #<hash-table eql 31/65 0x1ea84a5> :string-renderers nil :last-id 1125 :enable-function lsp-elixir-mode-enable :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x1ea84c5> :action-handlers #<hash-table equal 0/65 0x18a54d1> :default-renderer nil) :change-timer-disabled nil :proc #<process lsp-elixir-mode> :cmd-proc #<process lsp-elixir-mode> :buffers (#<buffer conn.ex> <<LIST OF BUFFERS OPENED>>) :highlight-overlays #<hash-table eq 0/65 0x12e71e1> :extra-client-capabilities ((company-lsp . company-lsp--client-capabilities)) :status nil :metadata #<hash-table equal 0/65 0x12e7309> :watches #<hash-table equal 0/65 0x12e7329>)) "{\"id\":1125,\"jsonrpc\":\"2.0\",\"result\":{\"contents\":\"> Jason\\n\\nA blazing fast JSON parser and generator in pure Elixir.\\n\",\"range\":{\"end\":{\"character\":29,\"line\":22},\"start\":{\"character\":24,\"line\":22}}}}\n\n")
  #f(compiled-function (proc output) #<bytecode 0x1929849>)(#<process lsp-elixir-mode> "Content-Length: 203\015\n\015\n{\"id\":1125,\"jsonrpc\":\"2.0\",\"result\":{\"contents\":\"> Jason\\n\\nA blazing fast JSON parser and generator in pure Elixir.\\n\",\"range\":{\"end\":{\"character\":29,\"line\":22},\"start\":{\"character\":24,\"line\":22}}}}\015\n\015\n")

To Reproduce

It is hard to say what is triggering this behaviour but here is my setup anyway:

(use-package alchemist
  :after (elixir-mode)
  :load-path "../.alchemist" ; Must first clone https://github.com/Trevoke/alchemist.el ont ~/.alchemist
  :config
  (require 'alchemist-elixir-ls)
  (require 'alchemist-goto)
  (require 'alchemist)
  :init
  ; I have some custom functions to search for elixir/erlang source on the current version set by asdf
  (setq alchemist-goto-erlang-source-dir
        (expand-file-name "otp_src" (grab-asdf-plugin-version-path "erlang"))
        alchemist-goto-elixir-source-dir (grab-asdf-plugin-version-path "elixir")))

(use-package elixir-mode
  :load-path "~/dev/projects/emacs-elixir"
  :init
  (add-hook 'elixir-mode-hook
          (lambda () (add-hook 'before-save-hook 'elixir-format 'local)))
  (add-hook 'elixir-format-hook
            (lambda ()
              (if (projectile-project-p)
                  (setq elixir-format-arguments
                        (list "--dot-formatter"
                              (concat (locate-dominating-file buffer-file-name ".formatter.exs") ".formatter.exs")))
                (setq elixir-format-arguments nil))
              )))

(use-package company-quickhelp
  :after (company)
  :ensure t
  :init
  (setq company-quickhelp-delay 1)
  :config
  (company-quickhelp-mode))

(use-package lsp-mode
  :init (setq lsp-inhibit-message t
              lsp-eldoc-render-all nil)
  :ensure t)

(use-package lsp-ui
  :ensure t
  :after (lsp-mode)
  :init
  (setq lsp-ui-doc-enable nil))

(use-package company-lsp
  :ensure t
  :after (company)
  :config
  (add-hook 'java-mode-hook (lambda () (push 'company-lsp company-backends)))
  (setq company-lsp-enable-snippet t
        company-lsp-cache-candidates t)
  (push 'company-lsp company-backends))

Expected behavior

I'd expect for emacs not to freeze

Setup

victorolinasc commented 5 years ago

It turned out I was compiling elixir-ls with OTP21 which it does not support yet. When falling back to OTP 20 it does work ok.

Trevoke commented 5 years ago

An, good call.

Definitely worth adding OTP21 then :)

On Sat, Oct 6, 2018, 09:40 Victor Oliveira Nascimento < notifications@github.com> wrote:

Closed #13 https://github.com/Trevoke/alchemist.el/issues/13.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Trevoke/alchemist.el/issues/13#event-1888576711, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEJSQs9DgKv_j4xwe12G5yC2pix7cRbks5uiLLWgaJpZM4WpQbU .

--

Phoned this one in.