-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Allow users and/or packages to create custom versions of "Wrap with ..." actions #56265
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
Comments
It's not great, but I noticed that user-defined snippets in VS Code can use wrap_with_snippet.mp4(ofc, for something this simple you should just use |
I saw this comment here from the PR mentioned above. I was thinking if this ever becomes a thing, there could be a way for the user to set which assists they'd like to see. Like a list option in vs code configs or something where they tick whatever they want to show. WDYT? Not really sure how could we make that reflect the options on the analyzer, but maybe not to select what you want but possibly the other way around. Like what you'd like to hide kind of a thing. |
Do you mean allowing the user to also hide some of the existing values (like "Wrap with Padding"), or also hide other kinds of assists (like "Change to double quotes")? Assuming the former and that the goal is to reduce the number of entries, something that might not be obvious (and doesn't negate the desire for this, but might help in the meantime), is that you can type to jump around the code actions list. For example here, I hit |
I meant only hiding the "Wrap with ..." assists. Great help, will use your tip! However, your comment got me wondering if the user's created "Wrap with" could be added to non- |
I think that would be more difficult, because the current assists are specifically written for Widgets with |
How about Shopify's approach? As you see this article, Shopify add capability to extending language server's feature. So called ruby lsp addon https://railsatscale.com/2024-10-03-the-ruby-lsp-addon-system/ |
Thanks for the reference. Ruby's approach is very similar to what we refer to as analysis server plugins. (The analysis server is our LSP support.) The initial prototype of plugins for Dart has been around for several years, and we're in the process of updating and simplifying the whole system with a goal of releasing it more formally. Plugins are one way to provide some extensibility. They would support the "packages" portion of this request, but wouldn't support the "users" portion. For that I think we'd need a different solution. |
Okay. (If i guested corrrectly), Do you mean, Even though it's referencing package in local path, they would support package's customized behaviour? not in Project's configuration? Like custom lint ruies? |
There are two potential ways to provide this kind of capability. This first is to allow a package author to specify that some of the widgets in that package should have a "Wrap with" action created for them. Plugins would support this use case. The second is to allow an individual user to specify that they want a "Wrap with" action for a given widget even though the author of the widget didn't specify this. Plugins are too heavy weight, IMO, to be a good way to support this second use case. |
It doesn't seem like there's an issue specifically for this, but there has been some discussion across various other issues (and PRs like Dart-Code/Dart-Code#4232).
There is a desire to have more options in the "Wrap with..." actions list. Sometimes package-specific widgets, and sometimes widgets that users feel they use a lot. Including all of them in the default list could make it unwieldy (and doesn't handle packages). Perhaps analysis server plugins are the best way to handle this, but they might also be a bit complex for simple uses where a user just wants a simple extra wrap for a widget.
The text was updated successfully, but these errors were encountered: