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
{{ message }}
Repository navigation
Introduce Local should look for naming patterns in ForEachStatementSyntax.Expression #56
Highlight "GetNumbers()" in the foreach statement and use Ctrl+. to get the light bulb. Invoke "Introduce Local". Observe that the new local is named "enumerable".
Since we have code to detect known patterns like "GetBlah", it would be nice if we could notice that the Expression of the ForEachStatementSyntax was an InvocationExpression and try to recognize that pattern.
changed the title [-]Introduce Local should look for naming patterns in ForeachStatementSyntax.Enumerable[/-][+]Introduce Local should look for naming patterns in ForEachStatementSyntax.Expression[/+]on Jan 22, 2015
I would like to work on this issue, if possible. A few questions:
What code do you have to detect patterns like "GetBlah"? Where is it?
Is this for C# only?
Any pointer on where to start? I saw a lot of infrastructure on IntroduceVariable. Is that it?
These then call into the semantic facts services(C#, VB). Which in turn call GenerateNameForExpression(C#, VB). The best way to accomplish what you want is to modify the GenerateNameForExpression to have a lot more smarts.
The issue will likely repro for both C# and VB. the fix however, could be in a common file that could fix both languages.. It'll be useful to add unit tests for both languages (IntrdouceVariableTests.cs, IntrdouceVariableTests.vb) to make sure they're both addressed.. 😃
I managed to add this feature with the corresponding unit tests. Perhaps there are some tweaks needed for the naming in the codefix. Can I commit this to the master branch so that someone can review this? How does this work?
There, you can point at your own fork and branch and a PR will be created from that. Give the PR a good title, ensure that the code in it is what you want, and submit the PR. Then tag appropriate people (like @rchande and me) to look at it.
We'll go through some cycles of reviews+changes on your part. And when finally approved, it can be merged in by a team member.
Activity
[-]Introduce Local should look for naming patterns in ForeachStatementSyntax.Enumerable[/-][+]Introduce Local should look for naming patterns in ForEachStatementSyntax.Expression[/+]giggio commentedon Feb 1, 2015
I would like to work on this issue, if possible. A few questions:
What code do you have to detect patterns like "GetBlah"? Where is it?
Is this for C# only?
Any pointer on where to start? I saw a lot of infrastructure on IntroduceVariable. Is that it?
giggio commentedon Feb 1, 2015
Oh, and here as well: https://github.com/dotnet/roslyn/tree/master/src/Features/CSharp/IntroduceVariable
jmarolf commentedon Feb 1, 2015
CSharpIntroduceVariableService and VisualBasicIntroduceVariableService determine the name in IntroduceLocalAsync(C#, VB) and IntroduceFieldAsync(C#, VB), but these both use methods from AbstractIntroduceVariableService.
These then call into the semantic facts services(C#, VB). Which in turn call GenerateNameForExpression(C#, VB). The best way to accomplish what you want is to modify the GenerateNameForExpression to have a lot more smarts.
giggio commentedon Feb 1, 2015
Cool. Can I start working on it, then?
jmarolf commentedon Feb 1, 2015
feel free to start working on it.
rchande commentedon Feb 2, 2015
You're free to start working on it. Thanks!
balajikris commentedon Feb 3, 2015
The issue will likely repro for both C# and VB. the fix however, could be in a common file that could fix both languages.. It'll be useful to add unit tests for both languages (IntrdouceVariableTests.cs, IntrdouceVariableTests.vb) to make sure they're both addressed.. 😃
sievajetnamdar commentedon Jan 2, 2018
I managed to add this feature with the corresponding unit tests. Perhaps there are some tweaks needed for the naming in the codefix. Can I commit this to the master branch so that someone can review this? How does this work?
CyrusNajmabadi commentedon Jan 3, 2018
@sievajetnamdar You should open a PR using the "new pull request" button on https://github.com/dotnet/roslyn/pulls
There, you can point at your own fork and branch and a PR will be created from that. Give the PR a good title, ensure that the code in it is what you want, and submit the PR. Then tag appropriate people (like @rchande and me) to look at it.
We'll go through some cycles of reviews+changes on your part. And when finally approved, it can be merged in by a team member.
Issue dotnet#56 - Introduce Local should look for naming patterns in …
Merge pull request dotnet#56 from AArnott/updatePackageRefs
Merge pull request #56 from jmarolf/update-editorconfig