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
When one selects a constant in code and then presses CTR+., Visual Studio offers to create a constant for selected code. This is current behavior:
I would be happy to be offered an option to create a variable as well. To phrase it differently, I miss the "Introduce Local" option.
Background and Motivation
So why one might want a variable instead of a constant? When I work on something, it happens that something that used to be a constant becomes a variable.
For example, one have an analyzer that checks lenghts of lines. One starts with a magic number 150 and it works pretty well for a long time but then one day another team wants to use that analyzer as well but they want 141 characters.
I'm aware that there is the "Introduce local constant for '1'" feature and it can certainly be used as a workaround but it requires more work for me "remove const keyword make the first letter of the variable to be in lowercase. So while doable, it's more manual work than to type "var" + copy value (i.e. 1 in this case).
Proposed Feature
Add "Introduce Local" option.
The text was updated successfully, but these errors were encountered:
Summary
When one selects a constant in code and then presses CTR+., Visual Studio offers to create a constant for selected code. This is current behavior:
I would be happy to be offered an option to create a variable as well. To phrase it differently, I miss the "Introduce Local" option.
Background and Motivation
So why one might want a variable instead of a constant? When I work on something, it happens that something that used to be a constant becomes a variable.
For example, one have an analyzer that checks lenghts of lines. One starts with a magic number 150 and it works pretty well for a long time but then one day another team wants to use that analyzer as well but they want 141 characters.
I'm aware that there is the "Introduce local constant for '1'" feature and it can certainly be used as a workaround but it requires more work for me "remove
const keyword
make the first letter of the variable to be in lowercase. So while doable, it's more manual work than to type "var" + copy value (i.e. 1 in this case).Proposed Feature
Add "Introduce Local" option.
The text was updated successfully, but these errors were encountered: