lzybkr / TabExpansionPlusPlus

A V3 PowerShell module to improve tab expansion and Intellisense
BSD 2-Clause "Simplified" License
196 stars 33 forks source link

Using a function with Register-ArgumentCompleter throws #35

Closed powercode closed 9 years ago

powercode commented 9 years ago
function MyCompleter{
    New-CompletionResult -CompletionText First
    New-CompletionResult -CompletionText Second
}

Register-ArgumentCompleter -Native -CommandName echoargs.exe -ScriptBlock $function:MyCompleter

Error:

PSMessageDetails      : 
Exception             : System.Management.Automation.RuntimeException: Method invocation failed because
                         [System.Management.Automation.Language.FunctionDefinitionAst] does not contain
                         a method named 'GetScriptBlock'.
                           vid CallSite.Target(Closure , CallSite , Object )
                           vid Register-ArgumentCompleter(Closure , FunctionContext )
TargetObject          : 
CategoryInfo          : InvalidOperation: (:) [], RuntimeException
FullyQualifiedErrorId : MethodNotFound
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Register-ArgumentCompleter, C:\Users\Staffan\Documents\WindowsPowerShell\Mod
                        ules\TabExpansion++\TabExpansion++.psm1: line 393
                        at , : line 6
PipelineIterationInfo : {}