scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.06k stars 320 forks source link

Ammonite: Invalid $ivy Import Errors are a bit User Unfriendly #4647

Open LaurenceWarne opened 1 year ago

LaurenceWarne commented 1 year ago

Describe the bug

Very minor, but invalid ivy imports currently spit out the full import tree: invalid-ivy-import

Expected behavior

I think probably the import text itself would be more user friendly, e.g. Invalid $ivy import: '$ivy.an.invalid.ivyimport'. I had a quick look, and it looks like the error is forwarded from here (?): https://github.com/com-lihaoyi/Ammonite/blob/9be39debc367abad5f5541ef58f4b986b2a8d045/amm/runtime/src/main/scala/ammonite/runtime/ImportHook.scala#L171.

Operating system

Linux

Editor/Extension

Emacs (lsp-metals)

Version of Metals

v0.11.9

Scala Version: 3.2.0 and 2.13.9 Ammonite Version: 2.5.5

Extra context or search terms

No response

tgodzik commented 1 year ago

Thanks for reporting! Are you using Scala 3 Ammonite? I think that might be an issue we need to fix upstream in Ammonite.

Import tree doesn't seem to have any toString: https://github.com/com-lihaoyi/Ammonite/blob/9be39debc367abad5f5541ef58f4b986b2a8d045/amm/util/src/main/scala/ammonite/util/Model.scala#L256

LaurenceWarne commented 1 year ago

Thanks for reporting! Are you using Scala 3 Ammonite?

Just double checked, I can reproduce it with Scala 3 and 2.13.9 (with Ammonite 2.5.5 - I'll add these to the initial report :slightly_smiling_face: )

I think that might be an issue we need to fix upstream in Ammonite.

Yeah I think it looks that way.