scalameta / metals-vscode

Visual Studio Code extension for Metals
https://marketplace.visualstudio.com/items?itemName=scalameta.metals#overview
Apache License 2.0
297 stars 74 forks source link

Bug 🐛🐛🐛🐛🐛 cannot debug simple scala program and its not compiled and not genrate .scala-build #1458

Closed ECEAthipanbose closed 4 months ago

ECEAthipanbose commented 5 months ago

To Reproduce:

Open VSCode. Open an empty folder (let's call it "A5"). Create a src folder inside the "A5" folder. Inside the src folder, create a main subfolder. Create a Sample.scala file inside the main subfolder. Paste some sample Scala code into Sample.scala. Observe that the .scala-build directory is not generated, and the Scala file is not compiled. Expected behavior:

The .scala-build directory should be generated automatically by the Metals extension. The Scala file (Sample.scala) should be compiled, allowing you to debug the sample code. and show the run|debug on main method

tgodzik commented 5 months ago

Thanks for reporting! When I follow you instructions everything works fine, do you get any errors in your logs?

ECEAthipanbose commented 5 months ago

2024.02.17 19:57:27 WARN no build tool detected in workspace 'path/to/A6'. The most common cause for this problem is that the editor was opened in the wrong working directory, for example if you use sbt then the workspace directory should contain build.sbt. 2024.02.17 19:57:27 WARN Build server is not auto-connectable. 2024.02.17 19:57:50 INFO no build target found for 'path/to/A6/Sample.scala'. Using presentation compiler with project's scala-library version: 3.3.1 2024.02.17 19:57:50 WARN Could not find semantic tokens for: 'path/to/A6/Sample.scala' 2024.02.17 19:57:50 INFO time: code lens generation in 2.27s 2024.02.17 19:59:59 WARN Could not find semantic tokens for: 'path/to/A6/Sample.scala' 2024.02.17 20:00:10 WARN Could not find semantic tokens for: 'path/to/A6/Sample.scala' 2024.02.17 20:00:29 WARN no build target for: 'path/to/A6/Sample.scala' 2024.02.17 20:01:04 WARN no build target for: 'path/to/A6/Sample.scala' Feb 17, 2024 8:02:03 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation WARNING: Unmatched cancel notification for request id 69 2024.02.17 20:02:04 WARN no build target for: 'path/to/A6/Sample.scala'

Screenshot from 2024-02-17 20-02-17 see the figure no run|debug on main method and its not get compiled and iam manually debug through launch.json its tell no build target found on my workspace

tgodzik commented 5 months ago

Could you show the full log? Also what is you Metals version?

ECEAthipanbose commented 5 months ago

metals version 1.2.0+12-644090c2-SNAPSHOT

tgodzik commented 5 months ago

Could you check out the latest version? That's 1.2.2+27-c7759e1e-SNAPSHOT or just latest stable 1.2.2

ECEAthipanbose commented 4 months ago

yeah work but rare time the same problem occur and tell no build target found in orkspace

there is any option to manually compile my whole workspace ?

tgodzik commented 4 months ago

You can always just use Scala CLI itself by running scala-cli setup-ide . in the workspace root