Skip to content

Code fix prefix unused2 #16309

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

Merged
merged 9 commits into from
Jun 13, 2017
Merged

Code fix prefix unused2 #16309

merged 9 commits into from
Jun 13, 2017

Conversation

aozgaa
Copy link
Contributor

@aozgaa aozgaa commented Jun 6, 2017

Fixes #14420.

Note that we do not add underscores for parameter declarations or imports, as underscores do no work for suppressing unused errors for these constructs.

@@ -18,7 +18,9 @@ namespace ts.codefix {

switch (token.kind) {
case ts.SyntaxKind.Identifier:
return deleteIdentifier();
let actions = deleteIdentifier(<Identifier>token);
(actions || (actions = [])).push(prefixIdentifierWithUnderscore(<Identifier>token));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not do this all the time. only for parameters and for..of/for .. in variables

//// } |]

verify.rangeAfterCodeFix(`namespace greeter {
class _class1 { }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still an error.

Copy link
Contributor

@mhegazy mhegazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to condition the _ addition

@aozgaa
Copy link
Contributor Author

aozgaa commented Jun 9, 2017

@mhegazy can you take another look?

@aozgaa aozgaa merged commit 9cd04e0 into microsoft:master Jun 13, 2017
@aozgaa aozgaa deleted the codeFixPrefixUnused2 branch June 13, 2017 18:16
@mhegazy
Copy link
Contributor

mhegazy commented Jun 13, 2017

please port this to release-2.4

@aozgaa aozgaa restored the codeFixPrefixUnused2 branch June 13, 2017 18:18
aozgaa pushed a commit to aozgaa/TypeScript that referenced this pull request Jun 13, 2017
aozgaa added a commit that referenced this pull request Jun 14, 2017
port #16309 (prefix unused with _) to release-2.4
@aozgaa aozgaa deleted the codeFixPrefixUnused2 branch June 20, 2017 23:49
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants