-
Notifications
You must be signed in to change notification settings - Fork 44
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
How to start a debugging session via API ? #139
Comments
This package is not designed to be used externally like LSP there is no API for other packages to consume right now. All of the adapters live here https://github.com/daveleroy/sublime_debugger/tree/master/modules/adapters The This is the flow I think you should start with https://scalameta.org/metals/docs/editors/vscode/#via-a-launchjson-configuration
For 1. You can probably check that https://github.com/scalameta/metals-sublime is installed or something. For 2. You probably need to ask the metals LSP to start the debug adapter because I guess it is part of the LSP client and it gives you a host/port which you would return with After that is working code lenses probably just give a configuration to run so something like the following command could be added
That command would work just like if the user has that configuration in their .sublime-project |
The debugger now supports starting via a configuration with both window.run_command('debugger', {
'action': 'open_and_start'/'start',
'configuration': {
...
}
})``` |
@daveleroy thanks for the update, I am giving this issue another try and so far I managed to:
cc @prassee |
https://github.com/scalameta/metals-vscode#via-a-launchjson-configuration that is the standard way to setup debugging through a configuration and I would start by trying to get this setup and working first and then adding support for the code lens stuff. Yes you need an They seem to just pass in a dummy configuration for vscode for code lenses here https://github.com/scalameta/metals-vscode/blob/821c44598870d9f6cabc7f28b788401eb7e3e0a7/src/debugger/scalaDebugger.ts#L136 I believe the the code lens is the configuration just missing a I believe you probably want something like the following on the Debugger side class Scala(dap.AdapterConfiguration):
type = 'scala'
docs = 'https://github.com/scalameta/metals-vscode#readme'
installer = util.GitInstaller(
type='scala',
repo='scalameta/metals-vscode'
)
async def start(self, log, configuration):
# Make sure LSP and LSP-metals are installed
util.require_package('LSP-metals')
util.require_package('LSP')
response = await util.lsp.request('metals', 'workspace/executeCommand', {
'command': 'debug-adapter-start',
'arguments': configuration,
})
uri: str = response['uri']
name: str = response['name']
address, port = uri.split('tcp://')[1].split(':')
configuration.name = name
return dap.SocketTransport(log, address, int(port)) |
I am trying to integrate in https://github.com/scalameta/metals-sublime with this package.
It is a helper package for Metals and already takes care of the installation. The debug workflow get started via code lenses, so as far as I understand there isn't a need to implement the adapter class.
I already have a host, port and the other debug parameters but I couldn't find a way to pass this info to the debugger and start it.
Can you point me to which API command with its argument I should use ?
The text was updated successfully, but these errors were encountered: