public async Task HighlightEntireFile() { var code = @" namespace N1 { class C1 { int n = true; } } "; var workspace = TestHelpers.CreateSimpleWorkspace(new Dictionary<string, string> { { "a.cs", code } }); var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions()); var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs" }); AssertSyntax(regions.Highlights, code, 0, Token("namespace", "keyword"), Token("N1", "identifier"), Token("{", "punctuation"), Token("class", "keyword"), Token("C1", "class name"), Token("{", "punctuation"), Token("int", "keyword"), Token("n", "identifier"), Token("=", "operator"), Token("true", "keyword"), Token(";", "punctuation"), Token("}", "punctuation"), Token("}", "punctuation")); }
public async Task HighlightStringInterpolation() { var code = @" class C1 { string s = $""{5}""; } "; var workspace = TestHelpers.CreateSimpleWorkspace(new Dictionary <string, string> { { "a.cs", code } }); var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions()); var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs" }); AssertSyntax(regions.Highlights, code, 0, Token("class", "keyword"), Token("C1", "class name"), Token("{", "punctuation"), Token("string", "keyword"), Token("s", "identifier"), Token("=", "operator"), Token("$\"", "string"), Token("{", "punctuation"), Token("5", "number"), Token("}", "punctuation"), Token("\"", "string"), Token(";", "punctuation"), Token("}", "punctuation")); }
public async Task HighlightEntireFile() { var code = @" namespace N1 { class C1 { int n = true; } } "; var workspace = TestHelpers.CreateSimpleWorkspace(new Dictionary <string, string> { { "a.cs", code } }); var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions()); var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs" }); AssertSyntax(regions.Highlights, code, 0, Token("namespace", "keyword"), Token("N1", "identifier"), Token("{", "punctuation"), Token("class", "keyword"), Token("C1", "class name"), Token("{", "punctuation"), Token("int", "keyword"), Token("n", "identifier"), Token("=", "operator"), Token("true", "keyword"), Token(";", "punctuation"), Token("}", "punctuation"), Token("}", "punctuation")); }
public async Task HighlightExcludesUnwantedNames() { var code = @" namespace N1 { class C1 { int n = true; } } "; var workspace = TestHelpers.CreateSimpleWorkspace(new Dictionary <string, string> { { "a.cs", code } }); var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions()); var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs", ExcludeClassifications = new [] { HighlightClassification.Name } }); Assert.DoesNotContain(regions.Highlights, x => x.Kind.EndsWith(" name")); }
public async Task HighlightStringInterpolation() { var code = @" class C1 { string s = $""{5}""; } "; var workspace = TestHelpers.CreateSimpleWorkspace(new Dictionary<string, string> { { "a.cs", code } }); var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions()); var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs" }); AssertSyntax(regions.Highlights, code, 0, Token("class", "keyword"), Token("C1", "class name"), Token("{", "punctuation"), Token("string", "keyword"), Token("s", "identifier"), Token("=", "operator"), Token("$\"", "string"), Token("{", "punctuation"), Token("5", "number"), Token("}", "punctuation"), Token("\"", "string"), Token(";", "punctuation"), Token("}", "punctuation")); }
public async Task HighlightExcludesUnwantedNames() { var code = @" namespace N1 { class C1 { int n = true; } } "; var workspace = TestHelpers.CreateSimpleWorkspace(new Dictionary<string, string> { { "a.cs", code } }); var controller = new OmnisharpController(workspace, new FakeOmniSharpOptions()); var regions = await controller.Highlight(new HighlightRequest() { FileName = "a.cs", ExcludeClassifications = new [] { HighlightClassification.Name } }); Assert.DoesNotContain(regions.Highlights, x => x.Kind.EndsWith(" name")); }