-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TS Server: Return description of why a given refactoring cannot be applied #35098
Comments
As we discussed offline, this seems likely to be of interest primarily when the user has explicitly requested a particular refactoring or family of refactoring (e.g. extraction). If that's the case, it might be preferable to treat the presence of a refactoring/family identifier as an indicator that errors are desirable. |
For experimental purposes, we might want to add such a flag to the protocol and let the editor decide which portion of the flood of information is exposed to the user. |
A few other points from our discussion last Thursday:
|
Here's the VS Code side of the proposal and some thoughts on how we would surface the error information to users: microsoft/vscode#85160 |
I cant select an if (typeof (ConnectTo.connections[partnerCode]) == 'undefined'||!((<mongoose.Connection>ConnectTo.connections[partnerCode]).readyState==1||(<mongoose.Connection>ConnectTo.connections[partnerCode]).readyState==2)) { |
Follow up on #34930
Search terms
Problem
In VS Code, I often try to extract something to a function only to discover that this is not possible for the my current selection. The current UX for this is poor, since we offer no explanation of why the selection is not extractable.
Proposal
To fix this, we would like to have TS Server return a human readable message about why a refactoring cannot be applied. Client could then surface this information to users
With this proposal, TS Server would no silently longer dropping invalid refactorings like it does today and instead always return them but with an additional error message attached..
Protocol proposal
I believe this simplest approach is to add a new
errorDescription
field onApplicableRefactorInfo
:Client would be expected to not to try to resolve invalid refactorings.
To implement this in a way that won't break existing clients, we also need a way for a client to express that they can handle these invalid refactorings:
If
returnInvalidRefactorings
is not set, the TS Server should preserve its existing behavior, i.e. drop invalid refactoringsThe text was updated successfully, but these errors were encountered: