com-lihaoyi / mill

Mill is a fast JVM build tool that supports Java and Scala. 2-4x faster than Gradle and 5-10x faster than Maven for common workflows, Mill aims to make your project’s build process performant, maintainable, and flexible
https://mill-build.org/
MIT License
2.17k stars 343 forks source link

Make Mill BSP server a `debugProvider`. #2225

Open ckipp01 opened 1 year ago

ckipp01 commented 1 year ago

This is a feature request related to using Mill as a BSP server. Currently Metals is a runProvider and testProvider, but not a debugProvider as you can see in the initialize response here:

[Trace - 11:12:05 am] Received response 'build/initialize - (1)' in 611ms
Result: {
  "displayName": "mill-bsp",
  "version": "0.10.10",
  "bspVersion": "2.0.0",
  "capabilities": {
    "compileProvider": {
      "languageIds": [
        "java",
        "scala"
      ]
    },
    "testProvider": {
      "languageIds": [
        "java",
        "scala"
      ]
    },
    "runProvider": {
      "languageIds": [
        "java",
        "scala"
      ]
    },
    "debugProvider": {
      "languageIds": []
    },
    "inverseSourcesProvider": true,
    "dependencySourcesProvider": true,
    "dependencyModulesProvider": true,
    "resourcesProvider": true,
    "outputPathsProvider": true,
    "buildTargetChangedProvider": false,
    "jvmRunEnvironmentProvider": true,
    "jvmTestEnvironmentProvider": true,
    "canReload": true
  }
}

This means that tools like Metals can't offer debugging in the editor for you Mill project.

Potential solutions

Probably an integration with https://github.com/scalacenter/scala-debug-adapter.

lefou commented 1 year ago

Using scala-debug-adapter is probably the way to go. But we need a Scala 2.13 version of it, which is currently not released.

lefou commented 1 year ago

Today, scala-debug-adapter_2.13-3.0.6 was release.

lefou commented 1 year ago
lefou commented 1 year ago

After some conversations on the Scala Tooling Summit, I learned that Metals plans to add support to start the Debug Adapter directly, as all information about the buildTarget is already present. Hence, we don't need to implement the debugProvider capability.

lefou commented 1 year ago

I haven't found any evidence, that Metals is indeed providing debug adapter support directly, so I think this issue might be still valid and any help would be appreciated.

lolgab commented 5 months ago

I assigned myself to this issue since I started working on it.

sideeffffect commented 5 months ago

For what it's worth, Mill doesn't seem to need to implement debugProvider, since this ticket at Metals has been moved to In Progress: