Skip to content

Commit 7471401

Browse files
committed
Improve function's display strings
1 parent f1fc140 commit 7471401

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/PowerShellEditorServices/Services/Symbols/Visitors/SymbolVisitor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public SymbolVisitor(ScriptFile file, Func<SymbolReference, AstVisitAction> acti
2828
_action = action;
2929
}
3030

31+
// TODO: Make all the display strings better (and performant).
3132
public override AstVisitAction VisitCommand(CommandAst commandAst)
3233
{
3334
string? commandName = VisitorUtils.GetCommandName(commandAst);
@@ -221,7 +222,7 @@ public override AstVisitAction VisitConfigurationDefinition(ConfigurationDefinit
221222
return _action(new SymbolReference(
222223
SymbolType.Configuration,
223224
nameExtent.Text,
224-
"Configuration " + nameExtent.Text + " { }",
225+
"configuration " + nameExtent.Text + " { }",
225226
nameExtent,
226227
configurationDefinitionAst.Extent,
227228
_file,

src/PowerShellEditorServices/Utility/VisitorUtils.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,20 @@ internal static PSESSymbols.ScriptExtent GetNameExtent(ConfigurationDefinitionAs
249249
internal static string GetFunctionDisplayName(FunctionDefinitionAst functionDefinitionAst)
250250
{
251251
StringBuilder sb = new();
252-
sb.Append("function").Append(' ');
253-
sb.Append(functionDefinitionAst.Name);
252+
if (functionDefinitionAst.IsWorkflow)
253+
{
254+
sb.Append("workflow");
255+
}
256+
else if (functionDefinitionAst.IsFilter)
257+
{
258+
sb.Append("filter");
259+
}
260+
else
261+
{
262+
sb.Append("function");
263+
}
264+
sb.Append(' ').Append(functionDefinitionAst.Name).Append('(');
254265
// Add parameters
255-
sb.Append('(');
256266
// TODO: Fix the parameters, this doesn't work for those specified in the body.
257267
if (functionDefinitionAst.Parameters?.Count > 0)
258268
{

0 commit comments

Comments
 (0)