-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
New Dart Analysis Protocol for IntelliJ's "Override Methods of a Superclass" action #35639
Comments
@jwren will work on this at some point this quarter if he has time. |
I think this features title should be broadened to not only address IntelliJ but also offers this functionality to VS code.
Which creates a class that implements the currently selected class and overwrites all available functions adding an not implemented exception in all of them. 2 Create Derived Class Which opens in dialogue to select which functions should be overridden in the derived class. |
I believe that we could support this via LSP as a code action. Note that if you define an empty class that overrides the class in question then there is a quick fix to add the required overrides. It doesn't add overrides for methods with a concrete implementation, but we also have code completion support to make that a little bit easier. (I'm not proposing that the feature you're suggesting is not interesting, just pointing out existing support in case it makes your life easier.)
I don't believe that LSP gives us the ability to open a dialog like the one described here, so I'm not sure how we'd implement this feature. |
@bwilkerson sure LSP can't open a dialog but I think the IDE plugins could if they get the information on the selected class and the potential overrides @DanTup does that make sense? |
@bwilkerson people who have used VS Studio with Resharper are missing such refatorings a lot :-) |
VS Code doesn't have any concept of dialogs (besides embedding something in a webview like DevTools is, but that wouldn't be a good experience as a way to make dialogs), although if the goal is just to let the user pick some items from a list, you can do a (single question) picklist with tickboxes: Using this would involve custom LSP messages and an implementation in the VS Code extension though, which is not an ideal solution. There's an open issue in LSP about having some way for refactors to collect user input here: microsoft/language-server-protocol#1164 I would recommend adding 👍 's to that, as a standard way to do this would be much better than a custom one. |
The new 2 calls to the DAS will provide the following:
A call to get all overridable methods given some file and offset. This will return with a tree structure to display something similar to Java:
The second call will send a query to return a set of SourceFileEdits back for the addition of some set of method/ operator/ getter/ settter declarations.
The text was updated successfully, but these errors were encountered: