metals icon indicating copy to clipboard operation
metals copied to clipboard

import stuck in a loop

Open NPCRUS opened this issue 9 months ago • 4 comments

Describe the bug

https://github.com/NPCRUS/reproductions/tree/bsp-import-loop

  1. open project in visual studio code
  2. switch to mill-bsp
  3. import project
  4. extends package with extra non existent trait Base - object package extends RootModule with Base
  5. import again

note: auto-import setting is switched off the mill.build is compiling with error, but metals(I guess) keep trying to import again and again

error from metals log: https://github.com/NPCRUS/reproductions/blob/bsp-import-loop/error

https://github.com/user-attachments/assets/601cde38-3406-41db-bad7-61d33a37d7fa

Expected behavior

  • some sort of notification of failed import
  • no looping
  • error diagnostics present I want to emphasize here that error is expected, what is not expected is looping and zero notifications

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

1.5.2+7-0651fd6b-SNAPSHOT

Extra context or search terms

No response

NPCRUS avatar Mar 29 '25 18:03 NPCRUS

Thanks for reporting! @kasiaMarek could it be connected to your recent changes?

tgodzik avatar Apr 01 '25 13:04 tgodzik

could it be connected to your recent changes?

Maybe, though I don't see right away how. I'd have to dig into this.

kasiaMarek avatar Apr 01 '25 13:04 kasiaMarek

On a tooling spree with @jkciesluk and @AlterEgo7 we have found following:

  1. as a part of import process metals send command to mill-bsp to compile mill.build file
  2. compilation fails and mill-bsp kills itself
  3. metals reconnect logic kicks in and restarts the mill-bsp, then to step 1

Expected result - either of two:

  1. metals should track the fact the the last command was to compile mill own file and in case of compilation error do not restart mill-bsp server, instead waits for the next change in mill file and only then resarts mill-bsp
  2. mill-bsp shouldn't kill itself on unsuccessful compilation and instead should keep connection alive. This I will stress out in a mill repo

Additionally we were able to make a test case that reproduce this issue in MillServerSuite, I'll make a draft PR for it asap

NPCRUS avatar Apr 04 '25 13:04 NPCRUS

looks like guys over at mill are planning to revamp bsp server, and it suppose to fix this issue as well. I'll monitor and close this issue when it's there

NPCRUS avatar Apr 24 '25 14:04 NPCRUS