예제 #1
0
        public async Task unimplemented_lsp_handlers_return_404(Language language, string markupCode)
        {
            // something that's a valid LSP method, just not for the given kernel
            var methodName = "textDocument/hover";

            MarkupTestFile.GetLineAndColumn(markupCode, out var code, out var line, out var character);
            var request = new HoverParams(
                TextDocument.FromDocumentContents(code),
                new Lsp.Position(line, character));
            var response = await GetServer(language).HttpClient.PostObjectAsJsonAsync($"/lsp/{methodName}", request);

            response.StatusCode.Should().Be(HttpStatusCode.NotFound);
            var content = await response.Content.ReadAsStringAsync();

            content.Should().StartWith($"method '{methodName}' not found on kernel '{language.LanguageName()}'");
        }
예제 #2
0
        public async Task lsp_textDocument_hover_returns_expected_result(Language language, string code, int line, int character, string expected)
        {
            using var _ = new AssertionScope();
            var request = new HoverParams(
                TextDocument.FromDocumentContents(code),
                new Lsp.Position(line, character));
            var response = await GetServer(language).HttpClient.PostObjectAsJsonAsync("/lsp/textDocument/hover", request);

            await response.ShouldSucceed();

            var responseJson = await response.Content.ReadAsStringAsync();

            var hoverResponse = LspDeserializeFromString <HoverResponse>(responseJson);

            hoverResponse.Contents.Kind.Should().Be(Lsp.MarkupKind.Markdown);
            hoverResponse.Contents.Value.Should().Be(expected);
        }