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

buildTarget/changed notification not sent when Scala version changes #2638

Closed
tgodzik opened this issue Dec 18, 2023 · 4 comments
Closed

buildTarget/changed notification not sent when Scala version changes #2638

tgodzik opened this issue Dec 18, 2023 · 4 comments
Assignees
Labels
bsp Issues tied to the implementation of BSP (Build Server Protocol) bug Something isn't working IDE

Comments

@tgodzik
Copy link
Member

tgodzik commented Dec 18, 2023

Version(s)
1.1.0

Describe the bug
Metals depends on notifications from Scala CLI to know when it should request fresh information. When we save and compile file we do get the change notification if we changed for example compiler options but not when the Scala Version changed

To Reproduce

Open a project with:

//> using scala 3.3.1

Run metals doctor and see the correct version being used.

Now changed to:

//> using scala 3.3.0

run doctor again. You will see that the version is still 3.3.1

When checking BSP trace we see that no new notification is sent after the change to new Scala version.

Expected behaviour
Notification is sent to Metals and the version changes.

@tgodzik tgodzik added the bug Something isn't working label Dec 18, 2023
@Gedochao Gedochao added the IDE label Jan 23, 2024
@Gedochao Gedochao self-assigned this Jan 23, 2024
@Gedochao Gedochao added the bsp Issues tied to the implementation of BSP (Build Server Protocol) label Jan 23, 2024
@Gedochao
Copy link
Contributor

We seem to merely forward this from Bloop.

override def onBuildTargetDidChange(params: b.DidChangeBuildTarget): Unit =
forwardToOpt.foreach(_.onBuildTargetDidChange(params))

We likely should be sending it with our BspClient:

A good point to start looking where would be BspImpl

The BspClient is initialised in here:

actualLocalClient = new BspClient(
threads.buildThreads.bloop.jsonrpc, // meh
logger

@tgodzik
Copy link
Member Author

tgodzik commented Feb 28, 2024

Bloop is unable to see that the project changed because the hash changed, so we need to handle it in Scala CLI

@tgodzik
Copy link
Member Author

tgodzik commented Sep 4, 2024

Weirdly enough this started to work, only problem is in single file metals scalameta/metals#6755

I am not sure exactly why that is happening or why it fixed.

@Gedochao
Copy link
Contributor

Seems the problem has been fixed, closing this.

@Gedochao Gedochao closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bsp Issues tied to the implementation of BSP (Build Server Protocol) bug Something isn't working IDE
Projects
Status: Done
Development

No branches or pull requests

3 participants