Closed kennethnym closed 1 year ago
You should take a look at the existing adapters they are all implemented here https://github.com/daveleroy/sublime_debugger/tree/master/modules/adapters
Someone else was asking about dart/flutter awhile ago and I created this branch https://github.com/daveleroy/sublime_debugger/tree/dart which has the very basics working for dart.
Flutter support probably requires more configuration stuff you would have to see/ask what they are doing here https://github.com/Dart-Code/Dart-Code
Flutter also supports DAP apparently. I will take a look at existing adapters and see what I come up with.
Interesting I don't think any of this existed when I initially looked into it (maybe a year ago?). Dart now official supports it as well https://github.com/dart-lang/sdk/tree/main/pkg/dds/tool/dap
Both of these look much simpler and don't need a ton of additional configuration stuff
I don't think it's released though, because flutter debug-adapter
doesn't work properly.
I tried to run the Dart debugger in the example/dart
folder, but I got this error:
Unable to restart debugging. Please try ending the debug session and starting again.
When I view the console, this exception was logged:
<Future pending>
Traceback (most recent call last):
File "/home/kenneth/.config/sublime-text/Packages/Debugger/modules/core/sublime_event_loop.py", line 14, in __call__
self.callback(*self.args)
File "/home/kenneth/.config/sublime-text/Packages/Debugger/modules/core/core.py", line 58, in done
exception = task.exception()
asyncio.exceptions.CancelledError
Is it something to do with the event loop?
That exception is unrelated "Unable to restart debugging. Please try ending the debug session and starting again." is from the dart adapter so there is probably some issue with the configuration where it needs more stuff. It likely outputs that error message and then closes the connection.
What do you mean flutter debug-adapter
doesn't work properly?
That exception is unrelated "Unable to restart debugging. Please try ending the debug session and starting again." is from the dart adapter so there is probably some issue with the configuration where it needs more stuff. It likely outputs that error message and then closes the connection.
OK, I'll look into it.
What do you mean flutter debug-adapter doesn't work properly? When I try to run that command, I get the following error:
Could not find a command named "debug-adapter".
Run 'flutter -h' (or 'flutter
which is why I think it is not released yet.
You might just need to update flutter. Both dart debug-adapter
and flutter debug-adapter
seem to start the debug adapter process for me (I downloaded the latest flutter version last night).
Here is my output forflutter --version
Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 77d935af4d (3 days ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1
Actually it might not be the version the command should be flutter debug_adapter
not flutter debug-adapter
I updated the dart adapter to use dart debug_adapter
and it seems to be working for me https://github.com/daveleroy/sublime_debugger/commit/89c481fbde5780dffbe7249dab4f3384ecd57b71
It required a small change to the transport protocol https://github.com/daveleroy/sublime_debugger/commit/a3ee3e3de654883ecbc017a735905bc18e096823 described here https://microsoft.github.io/debug-adapter-protocol/overview so it can handle more than just the Content-Length
header since they seem to be sending some additional headers
I pulled in the latest commit, and now it will stuck at "Starting" and will not actually start the debug session.
Sorry I missed this.
If you right click on the debugger panel and select Show Protocol
you can see what parsed messages were passed back and forth between the debugger ui and the debug adapter. I suspect probably nothing is sent from the debug adapter because there is another issue with the transport protocol parsing maybe? That is done here https://github.com/daveleroy/sublime_debugger/blob/89c481fbde5780dffbe7249dab4f3384ecd57b71/modules/dap/transport.py#L56
You could put a print statement in there and see what is actually being send from the debug adapter.
Thanks, I'll try that when I'm free.
Hi @daveleroy, turns out my path to the main dart file is misconfigured. Everything seems to be working fine now after I fixed the path by adding ${workspacePath}
. The only issue I have now is #121.
@kennethnym assuming you are on Windows you can try increasing the hardcoded value here https://github.com/daveleroy/sublime_debugger/blob/8f8bbd3273a77ff8b3c4fb09526bac7ef29c0d80/modules/ui/layout_view.py#L153
If you have a value that works for you let me know what it is this is.
First of all great work on the plugin. I am trying to integrate Dart/Flutter with this plugin, and I noticed there aren't any documentation on writing/installing custom adapters. Is it possible to write a custom adapter? If so, how would I get around doing it? If it isn't possible, I am more than happy to make a PR to add Dart/Flutter support.