Conversation
`.cs` and `.csx` files were parsed with the C grammar, which does not know C#'s verbatim, raw or interpolated strings. A comment after `@"C:\temp\"` was swallowed by the string, and a `//` inside a `"""` raw string literal was linted as a comment. Add a C# extractor on the grammar go-tree-sitter already vendors, and map `.cs`, `.csx` and the csharp and c# notebook kernels to it. `// ReSharper disable|restore` and `// NOSONAR` are treated as directives. Signed-off-by: Eljees <57435526+Eljees@users.noreply.github.com> Assisted-by: Claude Code
|
Before this is reviewed, please read the AI-Assisted Contributions section of the contributing guide and make sure this change meets it: you can explain every line, the description is your own and brief, it fixes a bug you hit or a feature agreed in an issue, it does not touch undocumented options, and any substantial tool use is noted. |
|
This adds support for parsing C# comments with the C# grammar instead of falling back to a generic/unsupported path, so vale actually checks prose inside C# comments the way it already does for other C-family languages. I can walk through every line of the diff. I used an LLM as a coding assistant while writing the patch -- I direct the change, review and test all of it myself, and use tools like this in my regular AppSec work. The change doesn't touch any undocumented options. |
.csand.csxfiles are parsed with the C grammar, which doesn't know C#'s verbatim, raw or interpolated strings. On the new fixture,v3lints a//inside a"""raw string (10:16) and misses the comment after@"C:\temp\"(15:37).This adds a C# extractor on the
csharpgrammar go-tree-sitter already vendors, following the Kotlin one (#1183), and maps.cs,.csxand the csharp/c# notebook kernels to it. Tests:testdata/comments/{in,out}/12.csand an e2ecsharpcase.Assisted-by: Claude Code