My google-fu is failing me today.  Is there a concise way in Racket to 
request possible completions for some Racket code?  For example, in 
powershell I can ask System.Management.Automation.CommandCompletion for 
possible completions of the powershell code "ConvertTo-Json -"  like this:

$cmd = "ConvertTo-Json -"
$ret = 
[System.Management.Automation.CommandCompletion]::MapStringInputToParsedInput($cmd,
 
$cmd.Length)

$candidates = 
[System.Management.Automation.CommandCompletion]::CompleteInput(
    $ret.Item1,
    $ret.Item2,
    $ret.Item3,
    $null,
    [System.Management.Automation.PowerShell]::Create()
).CompletionMatches

$candidates | ForEach-Object {
    [pscustomobject]@{
        CompletionText = $_.CompletionText
        ResultType = $_.ResultType.ToString()
        ToolTip = $_.ToolTip
    }
}

Outputs (depending on system, powershell and .net version):
CompletionText       ResultType    ToolTip                             
--------------       ----------    -------                             
-InputObject         ParameterName [Object] InputObject                
-Depth               ParameterName [int] Depth                         
-Compress            ParameterName [switch] Compress                   
-Verbose             ParameterName [switch] Verbose                    
-Debug               ParameterName [switch] Debug                      
-ErrorAction         ParameterName [ActionPreference] ErrorAction      
-WarningAction       ParameterName [ActionPreference] WarningAction    
-InformationAction   ParameterName [ActionPreference] InformationAction
-ErrorVariable       ParameterName [string] ErrorVariable              
-WarningVariable     ParameterName [string] WarningVariable            
-InformationVariable ParameterName [string] InformationVariable        
-OutVariable         ParameterName [string] OutVariable                
-OutBuffer           ParameterName [int] OutBuffer                     
-PipelineVariable    ParameterName [string] PipelineVariable           

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to