external help file | online version | schema |
---|---|---|
PowerShellEditorServices.Commands-help.xml |
2.0.0 |
Converts IScriptExtent objects to some common EditorServices types.
ConvertFrom-ScriptExtent -Extent <IScriptExtent[]> [-BufferRange] [<CommonParameters>]
ConvertFrom-ScriptExtent -Extent <IScriptExtent[]> [-BufferPosition] [-Start] [-End] [<CommonParameters>]
The ConvertFrom-ScriptExtent function converts ScriptExtent objects to types used in methods found in the $psEditor API.
$range = Find-Ast -First { [System.Management.Automation.Language.CommandAst] } |
ConvertFrom-ScriptExtent -BufferRange
$psEditor.GetEditorContext().SetSelection($range)
Convert the extent of the first CommandAst to a BufferRange and use that to select it with the $psEditor API.
Specifies the extent to be converted.
Type: IScriptExtent[]
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
If specified will convert extents to BufferRange objects.
Type: SwitchParameter
Parameter Sets: BufferRange
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
If specified will convert extents to BufferPosition objects.
Type: SwitchParameter
Parameter Sets: BufferPosition
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies to use the start of the extent when converting to types with no range. This is the default.
Type: SwitchParameter
Parameter Sets: BufferPosition
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies to use the end of the extent when converting to types with no range.
Type: SwitchParameter
Parameter Sets: BufferPosition
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
You can pass ScriptExtent objects to this function. You can also pass objects with a property named "Extent" such as ASTs from Find-Ast or tokens from Get-Token.
This function will return the converted object of one of the above types depending on parameter switch choices.
ConvertTo-ScriptExtent Test-ScriptExtent Set-ScriptExtent Join-ScriptExtent