Is your feature request related to a problem? Please describe.
Metals currently supports debugging when metals are in charge of running jvm (tests and mains) which is awesome got tests or small application. In many cases one need to debug application that are started by other things (e.g. jvm for Metals server itself are started from within vs code) and fro such case jvm has agentlib: parameter (e.g. -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005) that allows to connect to from an outside application (or with listen mode jvm would try to connect to provided address on startup).
Intellij and other IDE supports this and for now whenever I need to use it I am forced to switch back to Intellij.
Describe the solution you'd like
This is well establish feature from technical point of view so I don't think there is much to describe.
I would love to see both modes (Attach and Listen) supported but having any of those will be a huge step forward.
In terms of configuration, user should be able to specify mode, port and where to get classpath from in some shape or form. I do not have any preferences there.
Describe alternatives you've considered
As mentioned this is well establish feature in other IDEs and I don't see (but I may be wrong) need to search for alternative.
Additional context
Configuration window from Intellij looks like this:

Search terms:
Remote, Debug, JDP, JDWP, Intellij
I totally agree with @romanowski .
I also would like to suggest another alternative: Debugger for java.
I even tried to use it on Metals, but the breakpoints weren't recognized.
It would be great that feature because I run my projects through sbt and to debug them I usually start sbt with -jvm-debug argument, i.e: sbt -jvm-debug 9999. Thus, I can attach remote debug on IntelliJ.
Good point. This would be a great feature. We basically use the remote debug with Intellij as well. So such feature would allow us to definitely switch to Metals.
I have started some work to support remote debugging on the Bloop side (https://github.com/scalacenter/bloop/pull/1378) and tested the solution with metals. I'll be happy to contribute the dependent work on metals and metals-vscode as well
Thanks @pvid ! I see that the PR in Bloop is almost ready, so I moved the feature to the main repo.
Most helpful comment
I totally agree with @romanowski .
I also would like to suggest another alternative: Debugger for java.
I even tried to use it on Metals, but the breakpoints weren't recognized.
It would be great that feature because I run my projects through sbt and to debug them I usually start sbt with
-jvm-debugargument, i.e:sbt -jvm-debug 9999. Thus, I can attach remote debug on IntelliJ.