Open webczat opened 4 years ago
Also pressing ctrl+shift+r to just show refactorings does not work, it always says they are none, only code actions (ctrl+.) show them.
Can you file a separate issue for this? Sad this doesn't work.
VS Code didn't (still doesn't?) support custom UI interactions in code actions so we had to pick some reasonable defaults
Some things I believe could be handled with smaller UI and done similar to this example https://github.com/Microsoft/vscode-extension-samples/tree/master/quickinput-sample
It wouldn't allow complex things like change signature, but would still get closer to working.
Based on uses of CodeActionWithOptions
in Roslyn, the below require UI. Checkmark means I think it could easily be implemented with VS Code current capabilities. Others likely need some sort of simplification or VS Code to allow complex UI to be shown
What is the problem with supporting more complex things? I never saw vscode extension displaying something similar to a modal dialog, only oneline inputs.
I'm not as familiar with the VS Code UI capabilities for extensions. I've seen quickinput as a sample, and a lot of extensions seem to follow that. I don't immediately see anything in the window API to show a complex modal.
Checkmark means I think it could easily be implemented with VS Code current capabilities.
At the moment the extension runs all the code actions on the server. So OmniSharp server computes the code actions, surfaces to the extension, then as user you select one, and then the command invoked in the extension is to run the code action server side again.
You could add UI interactions into some of the code actions you described above on a special case basis instead of invoking a generic "run code action" against the server but it will not be as straight forward as it seems. That is because the server would also have to be altered to not only expose a single "run code action by ID" endpoint as it does now, but to either have dedicated endpoints for each of the code actions you are adding UI too (which is probably not so great) or (a better approach) to have a general purpose generic dictionary/some other metadata on a generic request/a reusable approach that can be used to determine what is the user defined input when running a code action.
This is of course all doable, but so far it hasn't been too high on the priority list to be honest, because, as I mentioned, it sort of always seemed that the defaults were reasonable enough 😀
This is of course all doable, but so far it hasn't been too high on the priority list to be honest, because, as I mentioned, it sort of always seemed that the defaults were reasonable enough
I'm willing to sign up to help with this :)
Some of the top asks for refactorings from users in Roslyn fall under this list. I think if we get the server/client protocol worked out and enable what UI we can it's a good start.
to have a general purpose generic dictionary/some other metadata on a generic request/a reusable approach that can be used to determine what is the user defined input when running a code action
I agree, I think keeping a generic request is desirable
well, the thing is that there are refactorings having no defaults. some of us need them. :) things like move to namespace etc. I believe that the last option with generic run action with options would require also roslyn changes... from what I can tell
wondering how would you implement the ui vscode side? I believe you could open a special editor?
I think it would have to use the webview api https://code.visualstudio.com/api/extension-guides/webview
mmm... in some cases defaults are not enough. just got info that the "generate Equals and GetHashCode" method has ability to implement IEquatable
It seems to me that c# refactorings do/may have the UI, for example refactoring to generate GetHashCode and Equals should have UI to select fields to base these methods on.
However it seems running such refactorings from vscode doesn't show the ui. Also pressing ctrl+shift+r to just show refactorings does not work, it always says they are none, only code actions (ctrl+.) show them.