| external help file | PowerShellEditorServices.Commands-help.xml |
|---|---|
| online version | https://github.com/PowerShell/PowerShellEditorServices/tree/main/module/docs/ConvertTo-ScriptExtent.md |
| schema | 2.0.0 |
Converts position and range objects from PowerShellEditorServices to ScriptExtent objects.
ConvertTo-ScriptExtent [-Extent <IScriptExtent>] [<CommonParameters>]ConvertTo-ScriptExtent [-StartLineNumber <Int32>] [-StartColumnNumber <Int32>] [-EndLineNumber <Int32>]
[-EndColumnNumber <Int32>] [-FilePath <String>] [<CommonParameters>]ConvertTo-ScriptExtent [-StartOffsetNumber <Int32>] [-EndOffsetNumber <Int32>] [-FilePath <String>]
[<CommonParameters>]ConvertTo-ScriptExtent [-FilePath <String>] [-StartBuffer <BufferPosition>] [-EndBuffer <BufferPosition>]
[<CommonParameters>]The ConvertTo-ScriptExtent function can be used to convert any object with position related properties to a ScriptExtent object. You can also specify the parameters directly to manually create ScriptExtent objects.
$psEditor.GetEditorContext().SelectedRange | ConvertTo-ScriptExtentReturns a ScriptExtent object of the currently selected range.
ConvertTo-ScriptExtent -StartOffset 10 -EndOffset 100Returns a ScriptExtent object from a start and end offset.
Specifies a ScriptExtent object to use as a base to create a new editor context aware ScriptExtent object.
Type: IScriptExtent
Parameter Sets: ByExtent
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseSpecifies the starting line number.
Type: Int32
Parameter Sets: ByPosition
Aliases: StartLine, Line
Required: False
Position: Named
Default value: 0
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the starting column number.
Type: Int32
Parameter Sets: ByPosition
Aliases: StartColumn, Column
Required: False
Position: Named
Default value: 0
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the ending line number.
Type: Int32
Parameter Sets: ByPosition
Aliases: EndLine
Required: False
Position: Named
Default value: 0
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the ending column number.
Type: Int32
Parameter Sets: ByPosition
Aliases: EndColumn
Required: False
Position: Named
Default value: 0
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the starting offset number.
Type: Int32
Parameter Sets: ByOffset
Aliases: StartOffset, Offset
Required: False
Position: Named
Default value: 0
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the ending offset number.
Type: Int32
Parameter Sets: ByOffset
Aliases: EndOffset
Required: False
Position: Named
Default value: 0
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the path of the source script file.
Type: String
Parameter Sets: ByPosition, ByOffset, ByBuffer
Aliases: File, FileName
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the starting buffer position.
Type: BufferPosition
Parameter Sets: ByBuffer
Aliases: Start
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the ending buffer position.
Type: BufferPosition
Parameter Sets: ByBuffer
Aliases: End
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseThis 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 any object with properties that have position related names. Below is a list of all the property names that can be bound as parameters through the pipeline.
StartLineNumber, StartLine, Line, EndLineNumber, EndLine, StartColumnNumber, StartColumn, Column, EndColumnNumber, EndColumn, StartOffsetNumber, StartOffset, Offset, EndOffsetNumber, EndOffset, StartBuffer, Start, EndBuffer, End
You can also pass IScriptExtent objects to be converted to context aware versions.
The converted ScriptExtent object will be returned to the pipeline.
ConvertFrom-ScriptExtent Test-ScriptExtent Set-ScriptExtent Join-ScriptExtent