Reporter |
|
---|---|
Created | Jun 16, 2010 11:36:51 AM |
Updated | Apr 7, 2018 11:08:42 AM |
Subsystem | Refactorings |
Assignee | Alisa Afonina (alisa.afonina) |
Priority | Major |
State | Open |
Type | Feature |
Fix version | Backlog |
Affected versions | 2018.1 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
[5.1.1708]
When extracting a local variable, and choosing the const option, RS does not name it according to const prefix.
(don't know if this should be treated as a bug or "feature request" but I filed it under bug)
Repro:
Naming convention for local constants: lowerCamelCase with prefix "c_"
Extract variable on _c_dummyConstValue; (2 occurrences) to const int. Suggested variable name is not using the constant prefix:
I suppose RS could be a little smarter here and check the const-prefix if I choose "const int" instead of int?
When extracting a local variable, and choosing the const option, RS does not name it according to const prefix.
(don't know if this should be treated as a bug or "feature request" but I filed it under bug)
Repro:
Naming convention for local constants: lowerCamelCase with prefix "c_"
public class Foo
{
//This is private field constant, i.e. lowerCamelCase with prefix "_c_"
private const int _c_dummyConstValue = 123;
public void Bar()
{
const int c_exampleVariable = 12; //Example of local constant naming
var dummy1 = _c_dummyConstValue;
var dummy2 = _c_dummyConstValue;
}
}
Extract variable on _c_dummyConstValue; (2 occurrences) to const int. Suggested variable name is not using the constant prefix:
const int dummyConstValue = _c_dummyConstValue;and RS immediately warns about incorrect naming (missing c_ prefix).
var dummy1 = dummyConstValue;
var dummy2 = dummyConstValue;
I suppose RS could be a little smarter here and check the const-prefix if I choose "const int" instead of int?