Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add InlayHint implementation to OmniSharp.LSP #2566

Merged
merged 9 commits into from
Sep 22, 2023
Prev Previous commit
Next Next commit
Return the trimmed InlayHint label.
  • Loading branch information
JoeRobich authored Sep 18, 2023
commit 152ab466ef16048302b0b9bc3d2345ecf3cc2fae
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static LSPInlayHint ToLSPInlayHint(OmniSharpInlayHint hint)
var trimmedLabel = trimmedStartLabel.TrimEnd();
return new LSPInlayHint()
{
Label = hint.Label,
Label = trimmedLabel,
Tooltip = hint.Tooltip,
Position = ToPosition(hint.Position),
TextEdits = new(ToTextEdits(hint.TextEdits)),
Expand Down
6 changes: 3 additions & 3 deletions tests/OmniSharp.Lsp.Tests/OmniSharpInlayHintHandlerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public async Task InlayHintsForVarTypes(string fileName)
var response = await GetInlayHints(fileName, code);
AssertEx.Equal(new[]
{
new InlayHint { Position = new Position { Line = 1, Character = 4 }, Label = "int", Tooltip = null, TextEdits = new[] { new TextEdit { Range = new Range() { Start = new Position() { Line = 1, Character = 0 }, End = new Position() { Line = 1, Character = 3 } }, NewText = "int" } }, PaddingLeft = false, PaddingRight = true },
new InlayHint { Position = new Position { Line = 1, Character = 4 }, Label = "int", Tooltip = null, TextEdits = new[] { new TextEdit { Range = new Range() { Start = new Position() { Line = 1, Character = 0 }, End = new Position() { Line = 1, Character = 3 } }, NewText = "int " } }, PaddingLeft = false, PaddingRight = true },
},
response,
ignoreDataComparer);
Expand Down Expand Up @@ -239,8 +239,8 @@ void M(int i) {}
var response = await GetInlayHints(fileName, code);
AssertEx.Equal(new[]
{
new InlayHint { Position = new Position { Line = 1, Character = 2 }, Label = "i:", Tooltip = null, TextEdits = new[] { new TextEdit { Range = new Range() { Start = new Position() { Line = 1, Character = 2 }, End = new Position() { Line = 1, Character = 2 } }, NewText = "i: " } }, PaddingLeft = false, PaddingRight = true }
},
new InlayHint { Position = new Position { Line = 1, Character = 2 }, Label = "i:", Tooltip = null, TextEdits = new[] { new TextEdit { Range = new Range() { Start = new Position() { Line = 1, Character = 2 }, End = new Position() { Line = 1, Character = 2 } }, NewText = "i: " } }, PaddingLeft = false, PaddingRight = true }
},
response,
ignoreDataComparer);
}
Expand Down