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

Exclusion expression not working with markup #215

Closed NoelAbrahams closed 4 years ago

NoelAbrahams commented 4 years ago

Version: 2020.6.11.0 Visual Studio Version: Community 16.6.3

We have the following exclusion expression:

`.*?`

But this is not working when there is markup (anything like this <>) in the text:

image

Works fine otherwise: image

EWSoftware commented 4 years ago

I assume this is within an XML comment. If so, XML comments are parsed based on the XML elements so in this case, it would break the text up into multiple ranges (one before the strong element, the content of the strong element, and the text following the closing element). The exclusion expressions are then applied to each range. Since no single range matches the overall expression, the text in each isn't excluded. If the text is in a standard comment or a string, it works as expected.

NoelAbrahams commented 4 years ago

@EWSoftware this is actually in a JSDoc comment - not an XML comment. Here's all of it

image

EWSoftware commented 4 years ago

/** .... */ is the XML multiline comment format. When the "apply to all C-style languages" option is on, all C# options are applied so if it looks like XML comments, it treats them as XML comments. You can add a solution or project configuration file and enable the "Ignore XML documentation comments" option in the C# category. That will prevent it treating them that way.

NoelAbrahams commented 4 years ago

Tried that, but that just stops spell checking in JSDoc comments altogether.

The problem is that this has been developed for C# and applying it to other languages creates problems. JSDoc needs special handling.

I'd also say that with the prevalence and growth of TypeScript, JSDoc will see growing adoption.

EWSoftware commented 4 years ago

I see what you mean. Can you send me an example project? If so, I'll see what I can do.

NoelAbrahams commented 4 years ago

Hi, @EWSoftware

I'm attaching a sample project, including the current spellchecker configuration that we use.

Program.zip

TypeScript does not have its own project template in Visual Studio so basically its a case of adding a TypeScript file to a C# or NodeJS project.

Let me know if you need anything else. Thanks