Skip to content
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

Is there any way to toggle debug painting? #112

Open
jkaye2012 opened this issue Aug 11, 2021 · 7 comments
Open

Is there any way to toggle debug painting? #112

jkaye2012 opened this issue Aug 11, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@jkaye2012
Copy link

Hi all,

Thanks for this amazing package. It's an unparalleled development experience, even by Emacs standards.

I was wondering if there is any way to toggle Flutter's debug painting either through lsp or dap?

Thanks!

@yyoncho
Copy link
Member

yyoncho commented Aug 11, 2021

screenshot will help.

@jkaye2012
Copy link
Author

Sorry, screenshot of what? Flutter supports toggling debug painting by pressing "p" in the terminal. I've looked through the docs, and so far as I can tell this is one of the only debugging capabilities that I can't find exposed through either lsp-dart or dap.

To clarify, this isn't something that I think is broken, I'm just wondering if it's supported at all (and if it's not currently, if this would be something worth adding).

@ericdallo
Copy link
Member

ericdallo commented Aug 11, 2021

@jkaye2012 I use hover (I suggest you take a look, it's awesome) to develop in flutter with lsp-dart, I usually don't use dap with flutter, but answering your question, it's really missing, although we can easily follow the hotReload/hotRestart feature which works and implement that support for the other missing features during dap: https://github.com/emacs-lsp/lsp-dart/blob/master/lsp-dart-dap.el#L340-L346

@ericdallo ericdallo added the enhancement New feature or request label Aug 11, 2021
@jkaye2012
Copy link
Author

The dap route is what I was thinking as well. Would be really cool!

@ericdallo
Copy link
Member

I'll try to take a look and maybe add the missing ones in the weeked

@clement-buchart
Copy link

clement-buchart commented Nov 24, 2021

If anyone is interested I implemented this for https://github.com/akinsho/flutter-tools.nvim which is the neovim cousin of this project

It involves listening to the dart.serviceExtensionAdded dap event and maintaining a local map of (serviceExtension -> isolateId), and when debugPaint is requested sending a dap request "callService" with a body like :

{
  "method": "ext.flutter.debugPaint",
  "params": {
    "enabled": true,
    "isolateId": "<isolateId for which a serviceExtensionAdded event with extensionRPC = ext.flutter.debugPaint was received >"
  }
}

It's a bug more involved than the simple hotReload / Restart because you have to target the flutter isolate, but it allows for a bunch of other sweet stuff, like override the platform, or slowing animations...
The full list of what the VSCode extension can do is here https://github.com/Dart-Code/Dart-Code/blob/677cf32830e0899a0e0371f47f75a668b97f6b9e/src/shared/enums.ts#L22-L36

Sorry I can't provide an implementation, I'm not very good at elisp

Lua implementation is here if needed : https://github.com/akinsho/flutter-tools.nvim/blob/8c88c4cd9ad3f5b72335451744f7c07d374e3fa6/lua/flutter-tools/runners/dap_runner.lua

@ericdallo
Copy link
Member

Thank you @clement-buchart that should certainly help with this on lsp-dart :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants