Reporter |
|
---|---|
Created | Sep 25, 2012 10:34:04 PM |
Updated | Apr 5, 2018 7:05:40 PM |
Subsystem | Code Style - Formatter |
Assignee | Dmitry Osinovsky (Dmitry.Osinovsky) |
Priority | Critical |
State | Submitted |
Type | Bug |
Fix version | Backlog |
Affected versions | 7.0.1 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
Repro steps:
a. Tools -> Options -> Text Editor -> All Languages -> Tabs -> push "Keep tabs" -> OK to save and close
b. Add a new Razor view
c. Modify the view to look something like this:
@{
ViewBag.Title = "ViewPage1";
}
<div>
@if(ViewBag.Title) {
<div>hi</div>
}
</div>
d. Go to after <div>hi</div> and hit return
e. Note that before the cursor are these characters: one tab, one space
Note that the characters should be: two tabs
f. Note the same scenario (improper space instead of tab) if you hit return after { or any other "in code mode" in the Razor file
g. Note that it doesn't happen if you hit return from a spot "in template mode" in the Razor file such as inside the div (after 'hi') or outside the } – these correctly prefix the cursor with all tabs.
h. From time to time (typically when typing } or pasting code in other parts of a view) the entire file will get reformatted, and the entire view will get reformatted this way – last tab before a } is replaced by a space. I've been trying to repro it unsuccessfully this morning, though I suspect that once it no longer defaults improperly during entry, it also won't format on end character incorrectly either.
a. Tools -> Options -> Text Editor -> All Languages -> Tabs -> push "Keep tabs" -> OK to save and close
b. Add a new Razor view
c. Modify the view to look something like this:
@{
ViewBag.Title = "ViewPage1";
}
<div>
@if(ViewBag.Title) {
<div>hi</div>
}
</div>
d. Go to after <div>hi</div> and hit return
e. Note that before the cursor are these characters: one tab, one space
Note that the characters should be: two tabs
f. Note the same scenario (improper space instead of tab) if you hit return after { or any other "in code mode" in the Razor file
g. Note that it doesn't happen if you hit return from a spot "in template mode" in the Razor file such as inside the div (after 'hi') or outside the } – these correctly prefix the cursor with all tabs.
h. From time to time (typically when typing } or pasting code in other parts of a view) the entire file will get reformatted, and the entire view will get reformatted this way – last tab before a } is replaced by a space. I've been trying to repro it unsuccessfully this morning, though I suspect that once it no longer defaults improperly during entry, it also won't format on end character incorrectly either.