I'm writing a test for my C# diagnostic analyzer with code fixes, which requires input code and expected fixed code. The most simple way to specify the codes is to write them as string literal. However, it bothers me because there is no syntax highlighting in the string literal.
So I thought it would be better to write the codes as separate files. At this time I'm considering the following syntax:
class C
{
void M()
{
var i = 0;
- {|#0:i = 1|};
+ var i1 = 1;
}
}
- and + represent the rows to be deleted and added by the code fix, respectively, and {|#n:...|} indicates the location of the diagnostic result.
However, writing in a separate file does not solve the syntax highlighting problem.
I'd like to indicate deletions and additions with colors (like red and green) and also apply C# syntax highlighting.
So my question is, is there a simple way to apply my own syntax highlighting to a specific extension (e.g. cst) in Visual Studio? If it is too difficult or too much work for the benefits, I'll give up.