You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, this causes us to show the same code action twice, once from the quickfix for the error and once from the refactoring.
I believe that this is a quickfix and should not be returned as a refactoring. We previously used to send compute quickFix requests to TS even if there were no errors in the currently selected code, but disabled this for performance reasons in TS 2.4. Should we look into enabling this again?
Yes that's what I'm trying to say. We currently don't even call getCodeFixes if there are no errors in the selected code:
publicasyncprovideCodeActions(document: TextDocument,range: Range,context: CodeActionContext,token: CancellationToken): Promise<Command[]>{constfile=this.client.normalizePath(document.uri);// This part was added when we picked up TS 2.4 constsupportedActions=awaitthis.getSupportedActionsForContext(context);if(!supportedActions.size){return[];}constargs: Proto.CodeFixRequestArgs={
...vsRangeToTsFileRange(file,range),errorCodes: Array.from(supportedActions)};constresponse=awaitthis.client.execute('getCodeFixes',args,token);return(response.body||[]).map(action=>this.getCommandForAction(action,file));}
We can remove the size check so that we still call getCodeFixes even if there are no error codes.
If we want to support the no implicit any case, I propose we change the getCodeFix to support empty error code requests. If that change would be too complex for 2.6, we can ship with the no implicit any case not being supported yet and look into handling it in a future release. However I feel that we need to remove this quick fix from the getApplicableRefactors response for 2.6
aah.. now i see. why do we have the quick fix associated with Diagnostics.Cannot_find_module_0.code ? it should only be associated with Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code.. or am i missing something?
The original issue here was not addressed and the difference in semantics between quick fixes and refactorings is causing problems on our side (see microsoft/vscode#37288)
I still would like install Types (@types) to be returned only as a quick fix. See my comment on the PR for more info: #19394 (comment)
Activity
mjbvz commentedon Oct 20, 2017
I've added a workaround for this on the VS Code side but believe this should be addressed for 2.6.1. Mohamed Hegazy (@mhegazy) and Andy (Andrewkraft) (@Andy-MS) Do you agree?
mjbvz commentedon Oct 20, 2017
Yes, this causes us to show the same code action twice, once from the quickfix for the error and once from the refactoring.
I believe that this is a quickfix and should not be returned as a refactoring. We previously used to send compute quickFix requests to TS even if there were no errors in the currently selected code, but disabled this for performance reasons in TS 2.4. Should we look into enabling this again?
mjbvz commentedon Oct 20, 2017
Yes that's what I'm trying to say. We currently don't even call
getCodeFixesif there are no errors in the selected code:We can remove the size check so that we still call
getCodeFixeseven if there are no error codes.mjbvz commentedon Oct 20, 2017
If we want to support the no implicit any case, I propose we change the getCodeFix to support empty error code requests. If that change would be too complex for 2.6, we can ship with the no implicit any case not being supported yet and look into handling it in a future release. However I feel that we need to remove this quick fix from the
getApplicableRefactorsresponse for 2.6mhegazy commentedon Oct 20, 2017
Matt Bierner (@mjbvz) do you happen to have
--strictin your project? or did you get this config file fromtsc --init(which adds--strict)?If so, i think i have a fix for this issue.
mjbvz commentedon Oct 20, 2017
No, my tsconfig was:
mhegazy commentedon Oct 20, 2017
I am unable to reproduce this locally with the setup mentioned above with 1.18-insiders and latest TS.
Andy (Andrewkraft) (@Andy-MS) , seems from your comments, you understand the issue here. can you elaborate on how i can reproduce this locally?
mhegazy commentedon Oct 21, 2017
aah.. now i see. why do we have the quick fix associated with
Diagnostics.Cannot_find_module_0.code? it should only be associated withDiagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code.. or am i missing something?mhegazy commentedon Oct 23, 2017
Sorry, was stuck trying to understand the issue and did not look at the change.
mhegazy commentedon Oct 24, 2017
Fixed by #19394.
mjbvz commentedon Dec 8, 2017
The original issue here was not addressed and the difference in semantics between quick fixes and refactorings is causing problems on our side (see microsoft/vscode#37288)
I still would like install Types (@types) to be returned only as a quick fix. See my comment on the PR for more info: #19394 (comment)
mhegazy commentedon Jan 11, 2018
We are working on adding a new non-error diagnostic category, and moving all these refactoring to quick fix only. this should address the problem.