Skip to content

Property Editor supports refactors #8652

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

Open
elliette opened this issue Dec 20, 2024 · 2 comments
Open

Property Editor supports refactors #8652

elliette opened this issue Dec 20, 2024 · 2 comments
Labels
analysis-server-change-needed issues that require a corresponding change to the Analysis Server P2 important to work on, but not at the top of the work list. property editor

Comments

@elliette
Copy link
Member

The property editor should expose the supported refactors for the selected widget

@elliette elliette added P2 important to work on, but not at the top of the work list. property editor labels Dec 20, 2024
@elliette elliette added the analysis-server-change-needed issues that require a corresponding change to the Analysis Server label Jan 14, 2025
@DanTup
Copy link
Contributor

DanTup commented May 15, 2025

With https://dart-review.googlesource.com/c/sdk/+/428784, it's possible to call textDocument/codeActions over DTD and you will get back a list of Commands that can be invoked using workspace/executeCommand.

Here's an example script you can run in VS Code (make sure you update the DTD URI!) that connects to DTD and lets you execute these:

https://gist.github.com/DanTup/789206bd0e8f29986891ac27af65c760

It only requests actions of kind refactor.flutter.wrap so you'll only see the Wrap actions.

Recording.2025-05-15.180354.mp4

I did find one slight issue which is for CodeActions we usually support a non-standard snippet syntax for VS Code (we're still waiting for the standard LSP version to be released) but it doesn't work here, so using "Wrap with widget" will result in snippet markup appearing in the editor where we'd normally set the selection. I'll work on a fix for that (which unfortunately will mean not selecting the "widget" text as we would from a code action).

@elliette
Copy link
Member Author

Thank you! Looking forward to trying this out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analysis-server-change-needed issues that require a corresponding change to the Analysis Server P2 important to work on, but not at the top of the work list. property editor
Projects
None yet
Development

No branches or pull requests

2 participants