Skip to content

Commit 0507174

Browse files
authored
Set tooltip only if it's different from the completion text (#26)
1 parent c025fba commit 0507174

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/CompletionPredictor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ private SuggestionPackage GetFromTabCompletion(PredictionContext context, Cancel
124124
{
125125
CompletionResult completion = result.CompletionMatches[i];
126126
ReadOnlySpan<char> text = completion.CompletionText.AsSpan();
127+
string? tooltip = completion.CompletionText == completion.ToolTip ? null : completion.ToolTip;
127128
string? suggestion = null;
128129

129130
switch (completion.ResultType)
@@ -146,7 +147,7 @@ private SuggestionPackage GetFromTabCompletion(PredictionContext context, Cancel
146147
if (!string.Equals(input, suggestion, StringComparison.OrdinalIgnoreCase))
147148
{
148149
list ??= new List<PredictiveSuggestion>(count);
149-
list.Add(new PredictiveSuggestion(suggestion, completion.ToolTip));
150+
list.Add(new PredictiveSuggestion(suggestion, tooltip));
150151
}
151152
}
152153

0 commit comments

Comments
 (0)