EWSoftware / VSSpellChecker

A Visual Studio spell checker editor extension that checks the spelling of comments, strings, and plain text as you type. Supports configuration and various languages.
Other
377 stars 65 forks source link

Should ignore text in an cshtml attribute that is preceded by razor code #243

Closed carlin-q-scott closed 2 years ago

carlin-q-scott commented 2 years ago

The spell checker properly ignores HTML attribute text unless it contains razor template code, like in these examples:

<img src="@Model.BranchImage?fm=jpg&fl=progressive" />

fm, jpg and fl are flagged.

<div class="@(ViewBag?.CannotApply == true ? "collapse" : "") mt-2 mt-sm-0 p-md-0 text-center text-md-start mx-auto"></div>

sm, md and mx are flagged.

EWSoftware commented 2 years ago

Unless Visual Studio classifies it as code, all it knows is that it's a string. If you can use a regular expression to match it in some way, you can use an exclusion expression to ignore it.