Skip to content

[tsserver] GetSupportedCodeFixes should return description of CodeFix #12266

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

Closed
angelozerr opened this issue Nov 15, 2016 · 4 comments
Closed
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@angelozerr
Copy link

TypeScript Version: 2.1.1

Actual behavior:

Today when we wish to get the description of codefix to display it in an UI popup, we must consume **getCodeFixes" command which computes too the code edit although user have not executed the code fix. I think it's shame to compute the code edit although user don't execute the codefix. More I'm afraid if the compute of the codefix takes time, it will freeze the UI popup.

Expected behavior:

If tsserver GetSupportedCodeFixes command returns the errorCode/and description both, we could use the description to display in the UI popup and avoid computing the code edit.

@mhegazy
Copy link
Contributor

mhegazy commented Nov 15, 2016

That is the expected behavior. the issue is we do not know what code fixes are applicable. the work to check for applicability is almost the same as that to compute them.

@angelozerr
Copy link
Author

That is the expected behavior. the issue is we do not know what code fixes are applicable.

The editor consumes SemanticDiagnosticsSync and SyntacticDiagnosticsSync to validate the editor content and marks an error. When user hovers the marked error, I have the error code and I want to display UI popup with description of codefixe that we can apply without exectuting getCodeFixes. I could display in the UI popup only the error code, but I prefer displaying the description which is more user friendly. But in this case I must consumes getCodeFixes.

If GetSupportedCodeFixes could return errorCode/and description both (and not only array of string error code), it should be more performant to avoid computing of getCodedFixes just to get the description.

@basarat
Copy link
Contributor

basarat commented Jan 1, 2017

Not all error codes might be fixable always by a code fix that matches the error code e.g. absent identifier may or may not be importable. Also not all code fixes would come with error code e.g. recently requested #13082 🌹

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label May 24, 2017
@mhegazy mhegazy added Working as Intended The behavior described is the intended behavior; this is not a bug and removed Needs Investigation This issue needs a team member to investigate its status. labels Nov 23, 2017
@typescript-bot
Copy link
Collaborator

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

5 participants