@@ -14,6 +14,7 @@ namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility
14
14
{
15
15
/// <summary>
16
16
/// Provides utility methods for working with PowerShell commands.
17
+ /// TODO: Handle the `fn ` prefix better.
17
18
/// </summary>
18
19
internal static class CommandHelpers
19
20
{
@@ -114,6 +115,12 @@ public static async Task<CommandInfo> GetCommandInfoAsync(
114
115
Validate . IsNotNull ( nameof ( commandName ) , commandName ) ;
115
116
Validate . IsNotNull ( nameof ( executionService ) , executionService ) ;
116
117
118
+ // Remove the bucket identifier from symbol references.
119
+ if ( commandName . StartsWith ( "fn " ) )
120
+ {
121
+ commandName = commandName . Substring ( 3 ) ;
122
+ }
123
+
117
124
// If we have a CommandInfo cached, return that.
118
125
if ( s_commandInfoCache . TryGetValue ( commandName , out CommandInfo cmdInfo ) )
119
126
{
@@ -239,11 +246,11 @@ public static async Task<AliasMap> GetAliasesAsync(
239
246
// TODO: When we move to netstandard2.1, we can use another overload which generates
240
247
// static delegates and thus reduces allocations.
241
248
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 ; } ) ;
245
252
246
- s_aliasToCmdletCache . TryAdd ( aliasInfo . Name , aliasInfo . Definition ) ;
253
+ s_aliasToCmdletCache . TryAdd ( "fn " + aliasInfo . Name , "fn " + aliasInfo . Definition ) ;
247
254
}
248
255
249
256
return new AliasMap (
0 commit comments