tree-sitter / tree-sitter-c-sharp

C# Grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support space before nullable directive

patrickt opened this issue · comments

This is really nitpicky, but was found in the Roslyn code:

# nullable enable

#nullable enable works fine.

This seems to apply to all pre-processor directives.

Will take a second stab at this - first one has been reverted as it caused some regressions around string literals containing #.

Yeah, those are tricky—I encountered an #error inside a multiline interpolated string, which I don’t think we handle correctly even before this patch. I think taking a run at #16 might be the best strategy here.

I can take on #16 if you want - the structured trivia isn't defined in the formal C# spec so it's really looking at Roslyn and seeing what it does. I normally do that using the Syntax Visualizer in VS with appropriate code fragments which is obviously only a useful strategy if you're on Windows.