codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.92k stars 364 forks source link

A conditional operator in a .cshtml file can confuse CodeMaid #406

Open jogietze opened 7 years ago

jogietze commented 7 years ago

Environment

Description

The conditional operator on this line confuses CodeMaid:

<td style="border-top: 1px solid #ddd;@(kpi.Availability < AvailabilityThreshold ? " background: #fdd; color: #a00;" : "")">@kpi.Availability.ToString("P4").Replace(" %", "%")</td>

Current behavior

It garbles the text in the editor.

Expected behavior

It shouldn't mess with this line at all.

codecadwallader commented 7 years ago

What formatting is CodeMaid applying? If you invoke Edit->Advanced->Format Document do you see the same behavior?

jogietze commented 7 years ago

The portion of the line between the "?" and the first occurrence of ":" gets deleted. The only resolution is to turn off CodeMaid.

Format Document doesn't cause the same problem.

codecadwallader commented 7 years ago

I have been unable to reproduce the issue. Can you provide a minimal solution that exhibits the issue?