lsp-metals
lsp-metals copied to clipboard
Eager macro-expansion failure
When I open a Scala file and lsp-metals-treeview initialises I get an Emacs error:
"Eager macro-expansion failure: %S" (wrong-number-of-arguments (1 . 1) 0
I'm using Emacs 29. Backtrace:
Debugger entered--Lisp error: (error "Eager macro-expansion failure: (wrong-number-of-ar...")
error("Eager macro-expansion failure: %S" (wrong-number-of-arguments (1 . 1) 0))
internal-macroexpand-for-load((defalias 'lsp-metals-treeview--show-view #'(lambda (workspace view-id position) "Show or create the side window and treeview.\nThe w..." (let ((buffer-name (lsp-metals-treeview--buffer-name workspace ...))) (-if-let (buffer (get-buffer buffer-name)) (with-selected-window (display-buffer-in-side-window buffer position) (lsp-metals-treeview--log "Refreshing tree %s" view-id) (treemacs-update-node ... t) (set-window-dedicated-p ... t) (set-window-parameter ... ... t)) (let* (... ...) (with-lsp-workspace workspace ...)))))) t)
load-with-code-conversion("/Users/thoradam/.emacs.d/elpa/lsp-metals-20220715...." "/Users/thoradam/.emacs.d/elpa/lsp-metals-20220715...." nil t)
require(lsp-metals-treeview)
load-with-code-conversion("/Users/thoradam/.emacs.d/elpa/lsp-metals-20220715...." "/Users/thoradam/.emacs.d/elpa/lsp-metals-20220715...." t t)
#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_340>(lsp-metals)
mapc(#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_340> (ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-bash lsp-beancount lsp-clangd lsp-clojure lsp-cmake lsp-crystal lsp-csharp lsp-css lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm lsp-elixir lsp-emmet lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go lsp-gleam lsp-graphql lsp-hack lsp-grammarly lsp-groovy lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript lsp-json lsp-kotlin lsp-latex lsp-ltex lsp-lua lsp-markdown lsp-marksman lsp-mint lsp-nginx lsp-nim lsp-nix lsp-magik lsp-metals ...))
seq-do(#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_340> (ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-bash lsp-beancount lsp-clangd lsp-clojure lsp-cmake lsp-crystal lsp-csharp lsp-css lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm lsp-elixir lsp-emmet lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go lsp-gleam lsp-graphql lsp-hack lsp-grammarly lsp-groovy lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript lsp-json lsp-kotlin lsp-latex lsp-ltex lsp-lua lsp-markdown lsp-marksman lsp-mint lsp-nginx lsp-nim lsp-nix lsp-magik lsp-metals ...))
lsp--require-packages()
lsp()
run-hooks(change-major-mode-after-body-hook prog-mode-hook scala-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook scala-mode-hook))
run-mode-hooks(scala-mode-hook)
scala-mode()
set-auto-mode-0(scala-mode nil)
set-auto-mode--apply-alist((("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("\\.\\(scala\\|sbt\\|worksheet\\.sc\\)\\'" . scala-mode) ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . elisp-byte-code-mode) ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|jbuilder\\|rabl\\|ge..." . ruby-mode) ("\\.re?st\\'" . rst-mode) ("\\.py[iw]?\\'" . python-mode) ("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode) ("\\.scss\\'" . scss-mode) ("\\.awk\\'" . awk-mode) ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode) ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode) ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode) ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode) ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode) ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode) ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode) ("\\.\\(cc\\|hh\\)\\'" . c++-mode) ("\\.\\(bat\\|cmd\\)\\'" . bat-mode) ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . mhtml-mode) ("\\.svgz?\\'" . image-mode) ("\\.svgz?\\'" . xml-mode) ("\\.x[bp]m\\'" . image-mode) ("\\.x[bp]m\\'" . c-mode) ("\\.p[bpgn]m\\'" . image-mode) ("\\.tiff?\\'" . image-mode) ("\\.gif\\'" . image-mode) ("\\.png\\'" . image-mode) ("\\.jpe?g\\'" . image-mode) ("\\.webp\\'" . image-mode) ("\\.te?xt\\'" . text-mode) ("\\.[tT]e[xX]\\'" . tex-mode) ("\\.ins\\'" . tex-mode) ("\\.ltx\\'" . latex-mode) ("\\.dtx\\'" . doctex-mode) ...) nil nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer PubsubPublisher.scala> "~/Developer/indo/monorepodir/monorepo/src/main/sca..." nil nil "~/Developer/indo/monorepodir/monorepo/src/main/sca..." (341228 16777229))
find-file-noselect("~/Developer/indo/monorepodir/monorepo/src/main/sca..." nil nil t)
find-file("~/Developer/indo/monorepodir/monorepo/src/main/sca..." t)
funcall-interactively(find-file "~/Developer/indo/monorepodir/monorepo/src/main/sca..." t)
command-execute(find-file)
I met the same error and I'm also on Emacs 29. It seems some upstream changes broke some function in lsp-metals-treeview.el.
@thoradam Which commit of Emacs 29 are you using (and has this problem)? And which commit is good? I could do a git bisect to find which commit is responsible for this problem.
@VitalyAnkh I installed Emacs from the Homebrew emacs-plus formula:
"tap": "d12frosted/emacs-plus",
"tap_git_head": "4b34ed7402a4f3e1f212b2c6fa0851f4b59e247c",
Unfortunately this is my first time using Emacs with lsp-metals so I don't have a working commit for reference.
Treeview is broken after breaking the change in treemacs. It should be disabled until this is fixed.
what is the status of this? what is the recommended work around until fixed (one which lets you continue to use metals)?
This patch for the treemacs package works for me:
diff --git a/src/elisp/treemacs-treelib.el b/src/elisp/treemacs-treelib.el
index d30c8c6..9825fbf 100644
--- a/src/elisp/treemacs-treelib.el
+++ b/src/elisp/treemacs-treelib.el
@@ -1018,7 +1018,7 @@ ARG: Prefix Arg"
:post-close-action
(treemacs-on-collapse (treemacs-button-get btn :path))))
-(cl-defmacro treemacs-initialize
+(cl-defmacro treemacs-initialize-ext
(extension
&key
(with-expand-depth 0)
It seems that lsp-metals wants to call the other treemacs-initialize so renaming this one to something else fixes the issues at least for lsp-metals.
Does it stop work completely? For me lsp-metals works fine after this error happens.
It stopped working in the latest Emacs (snapshot) due to the commit https://github.com/emacs-mirror/emacs/commit/80cf13a3d27d8a967feafeec32fd130529635592
eager expansions is now error not warning.
Related issue: https://github.com/emacs-lsp/lsp-mode/issues/3738