mill icon indicating copy to clipboard operation
mill copied to clipboard

Make Mill BSP server a `debugProvider`.

Open ckipp01 opened this issue 2 years ago • 7 comments

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.

ckipp01 avatar Jan 02 '23 10:01 ckipp01

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.

  • See https://github.com/scalacenter/scala-debug-adapter/pull/363

lefou avatar Jan 25 '23 10:01 lefou

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

lefou avatar Jan 26 '23 16:01 lefou

  • https://github.com/scalacenter/scala-debug-adapter/issues/375

lefou avatar Jan 27 '23 17:01 lefou

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 avatar Apr 27 '23 05:04 lefou

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.

lefou avatar Oct 24 '23 21:10 lefou

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

lolgab avatar Jun 02 '24 08:06 lolgab

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:

  • https://github.com/scalameta/metals/issues/5928

sideeffffect avatar Jun 02 '24 17:06 sideeffffect