-
Notifications
You must be signed in to change notification settings - Fork 842
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
An operation for refactorings #61
Comments
@mickaelistria no there isn't. We started a discussion about how a refactoring protocol could look like but we haven't found a good way to spec that yet since this is very dependent on the programming language you are using. |
Sorry didn't want to close the issue. |
Thanks for your answer. Can you please add some details about some corner-cases you've identified for whatever language or refactoring hat wouldn't fit the suggestion of a refactoring operation I made above? |
The problem we see so far are:
|
I was thinking about rendering parameter capturing with "edits" like the
Ok. If this is the only case, then we could have a flag and message in the refactoring response. Tools can decide whether to honor it and ask for confirmation before applying change.
IMO, the undo is something I'd expect to be provided by the tool. The protocol doesn't have an undo for rename AFAIK, so I don't see why other refactorings should be treated differently. |
With parameter capturing I was referring to capturing input parameter for the refactoring. For rename for example rename in comments and strings. How would the server be able to describe these input parameters. And they might be different from languages if for example the language wouldn't support comments. |
If for example we use a convention of TextEdits with `{{param}}`` value for example, then the parameters are passed by server to client and it's up to clients to deal with those parameters. |
To make it concrete, some of the refactorings for haskell require the following parameters to be specified by the user in the client and passed to the server as input to the refactoring
So, the renaming maps onto the spec, but for the others some need a But this mapping of required parameters and command to return to the server needs to be provided as a capability at server start up. |
@mickaelistria does the new executeCommand and applyEdit pair help you here? |
This seems to do most of the work properly, I just have a few questions (that may be worth answering in the spec): |
@mickaelistria good point. The current behavior on the VS Code client side is as follows:
So the bottom line is that the server content should be updated without that the server replays the edits. If the server directly manipulates the files on disk (which he is allowed to do for files which are not open) then the server is responsible to update its internal buffers as well. |
I have the impression that the command framework is a bit overkill for some refactoring or codelens. In most case I've seen, those codelens and commands actually give a |
What if the computation of the workspace edit is expensive and for example code actions return more than one possible action. The having this resolve step does make sense. However for a single thing it might be more convenient to include the workspace edit in the command. |
Any news on this? |
Is this still being looked at? |
Out of the rename operation, I couldn't find an operation for refactorings. I would expect something like
is there already an operation I missed, which is meant to support that?
The text was updated successfully, but these errors were encountered: