Skip to content

Commit 540c900

Browse files
committed
Change variable label handling
1 parent c3b3bce commit 540c900

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/PowerShellEditorServices/Services/TextDocument/Handlers/CompletionHandler.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ CompletionResultType.ProviderItem or CompletionResultType.ProviderContainer
334334
// deduce it is an operator.
335335
: item with { Kind = CompletionItemKind.Operator },
336336
CompletionResultType.ParameterValue => item with { Kind = CompletionItemKind.Value },
337-
CompletionResultType.Variable => TryExtractType(detail, item.Label, out string type, out string documentation)
337+
CompletionResultType.Variable => TryExtractType(detail, "$" + item.Label, out string type, out string documentation)
338338
? item with { Kind = CompletionItemKind.Variable, Detail = type, Documentation = documentation }
339339
: item with { Kind = CompletionItemKind.Variable },
340340
CompletionResultType.Namespace => item with { Kind = CompletionItemKind.Module },
@@ -482,11 +482,6 @@ internal static bool TryExtractType(string toolTipText, string label, out string
482482
{
483483
documentation = documentation.Substring((label + " - ").Length).Trim();
484484
}
485-
// If the documentation starts with the same name as the variable, truncate this as well.
486-
else if (documentation.StartsWith("$" + label, StringComparison.OrdinalIgnoreCase))
487-
{
488-
documentation = documentation.Substring(("$" + label).Length).Trim();
489-
}
490485
}
491486
if (string.IsNullOrWhiteSpace(documentation))
492487
{

0 commit comments

Comments
 (0)