@@ -14,6 +14,7 @@ namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility
1414{
1515 /// <summary>
1616 /// Provides utility methods for working with PowerShell commands.
17+ /// TODO: Handle the `fn ` prefix better.
1718 /// </summary>
1819 internal static class CommandHelpers
1920 {
@@ -114,6 +115,12 @@ public static async Task<CommandInfo> GetCommandInfoAsync(
114115 Validate . IsNotNull ( nameof ( commandName ) , commandName ) ;
115116 Validate . IsNotNull ( nameof ( executionService ) , executionService ) ;
116117
118+ // Remove the bucket identifier from symbol references.
119+ if ( commandName . StartsWith ( "fn " ) )
120+ {
121+ commandName = commandName . Substring ( 3 ) ;
122+ }
123+
117124 // If we have a CommandInfo cached, return that.
118125 if ( s_commandInfoCache . TryGetValue ( commandName , out CommandInfo cmdInfo ) )
119126 {
@@ -239,11 +246,11 @@ public static async Task<AliasMap> GetAliasesAsync(
239246 // TODO: When we move to netstandard2.1, we can use another overload which generates
240247 // static delegates and thus reduces allocations.
241248 s_cmdletToAliasCache . AddOrUpdate (
242- aliasInfo . Definition ,
243- ( _ ) => new List < string > { aliasInfo . Name } ,
244- ( _ , v ) => { v . Add ( aliasInfo . Name ) ; return v ; } ) ;
249+ "fn " + aliasInfo . Definition ,
250+ ( _ ) => new List < string > { "fn " + aliasInfo . Name } ,
251+ ( _ , v ) => { v . Add ( "fn " + aliasInfo . Name ) ; return v ; } ) ;
245252
246- s_aliasToCmdletCache . TryAdd ( aliasInfo . Name , aliasInfo . Definition ) ;
253+ s_aliasToCmdletCache . TryAdd ( "fn " + aliasInfo . Name , "fn " + aliasInfo . Definition ) ;
247254 }
248255
249256 return new AliasMap (
0 commit comments