Example #1
0
        public async Task TestGetDocumentHighlightAsync()
        {
            var markup =
                @"class B
{
}
class A
{
    B {|text:classB|};
    void M()
    {
        var someVar = {|read:classB|};
        {|caret:|}{|write:classB|} = new B();
    }
}";

            var(solution, locations) = CreateTestSolution(markup);
            var expected = new LSP.DocumentHighlight[]
            {
                CreateDocumentHighlight(LSP.DocumentHighlightKind.Text, locations["text"].Single()),
                CreateDocumentHighlight(LSP.DocumentHighlightKind.Read, locations["read"].Single()),
                CreateDocumentHighlight(LSP.DocumentHighlightKind.Write, locations["write"].Single())
            };

            var results = await RunGetDocumentHighlightAsync(solution, locations["caret"].Single());

            AssertJsonEquals(expected, results);
        }
        public async Task TestGetDocumentHighlightAsync()
        {
            var markup =
                @"class B
{
}
class A
{
    B {|text:classB|};
    void M()
    {
        var someVar = {|read:classB|};
        {|caret:|}{|write:classB|} = new B();
    }
}";

            using var testLspServer = await CreateTestLspServerAsync(markup);

            var expected = new LSP.DocumentHighlight[]
            {
                CreateDocumentHighlight(LSP.DocumentHighlightKind.Text, testLspServer.GetLocations("text").Single()),
                CreateDocumentHighlight(LSP.DocumentHighlightKind.Read, testLspServer.GetLocations("read").Single()),
                CreateDocumentHighlight(LSP.DocumentHighlightKind.Write, testLspServer.GetLocations("write").Single())
            };

            var results = await RunGetDocumentHighlightAsync(testLspServer, testLspServer.GetLocations("caret").Single());

            AssertJsonEquals(expected, results);
        }