Skip to content

Commit

Permalink
Fully (?) port hover handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutch committed May 29, 2024
1 parent 967c3f1 commit 3e7fee2
Show file tree
Hide file tree
Showing 10 changed files with 935 additions and 13 deletions.
15 changes: 13 additions & 2 deletions MSBuildLanguageServer.Tests/HoverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ public async Task TestGetHoverAsync()
{
(string documentText, int caretPos) = TextWithMarkers.ExtractSinglePosition (@"<Pro|ject></Project>", '|');

await using var testLspServer = await CreateTestLspServerAsync(documentText, false, CapabilitiesWithVSExtensions);
var capabilities = new LSP.ClientCapabilities {
TextDocument = new LSP.TextDocumentClientCapabilities {
Hover = new LSP.HoverSetting {
ContentFormat = [ LSP.MarkupKind.PlainText ]
}
}
};

await using var testLspServer = await CreateTestLspServerAsync(documentText, false, capabilities);

var documentId = new LSP.TextDocumentIdentifier { Uri = new Uri("file://foo.csproj") };

Expand Down Expand Up @@ -48,7 +56,10 @@ public async Task TestGetHoverAsync()
CancellationToken.None);

Assert.NotNull(result);

var markup = Assert.IsType<LSP.MarkupContent>(result.Contents?.Value);
Assert.Equal("Hello", markup.Value);
var markupValue = markup.Value.Replace("\r\n", "\n");

Assert.Equal("keyword Project\nAn MSBuild project.", markupValue);
}
}
Loading

0 comments on commit 3e7fee2

Please sign in to comment.