|
| 1 | +--- |
| 2 | +external help file: PowerShellEditorServices.Commands-help.xml |
| 3 | +online version: |
| 4 | +schema: 2.0.0 |
| 5 | +--- |
| 6 | + |
| 7 | +# ConvertFrom-ScriptExtent |
| 8 | + |
| 9 | +## SYNOPSIS |
| 10 | + |
| 11 | +Converts IScriptExtent objects to some common EditorServices types. |
| 12 | + |
| 13 | +## SYNTAX |
| 14 | + |
| 15 | +### BufferRange |
| 16 | + |
| 17 | +```powershell |
| 18 | +ConvertFrom-ScriptExtent -Extent <IScriptExtent[]> [-BufferRange] [<CommonParameters>] |
| 19 | +``` |
| 20 | + |
| 21 | +### BufferPosition |
| 22 | + |
| 23 | +```powershell |
| 24 | +ConvertFrom-ScriptExtent -Extent <IScriptExtent[]> [-BufferPosition] [-Start] [-End] [<CommonParameters>] |
| 25 | +``` |
| 26 | + |
| 27 | +## DESCRIPTION |
| 28 | + |
| 29 | +Translates IScriptExtent object properties into constructors for some common PowerShell EditorServices types. |
| 30 | + |
| 31 | +## EXAMPLES |
| 32 | + |
| 33 | +### -------------------------- EXAMPLE 1 -------------------------- |
| 34 | + |
| 35 | +```powershell |
| 36 | +$sb = { Get-ChildItem 'Documents' } |
| 37 | +$sb.Ast | Find-Ast { $_ -eq 'Documents' } | ConvertFrom-ScriptExtent -BufferRange |
| 38 | +``` |
| 39 | + |
| 40 | +Gets the buffer range of the string expression "Documents". |
| 41 | + |
| 42 | +## PARAMETERS |
| 43 | + |
| 44 | +### -Extent |
| 45 | + |
| 46 | +Specifies the extent to be converted. |
| 47 | + |
| 48 | +```yaml |
| 49 | +Type: IScriptExtent[] |
| 50 | +Parameter Sets: (All) |
| 51 | +Aliases: |
| 52 | + |
| 53 | +Required: True |
| 54 | +Position: Named |
| 55 | +Default value: None |
| 56 | +Accept pipeline input: True (ByPropertyName, ByValue) |
| 57 | +Accept wildcard characters: False |
| 58 | +``` |
| 59 | +
|
| 60 | +### -BufferRange |
| 61 | +
|
| 62 | +If specified will convert extents to BufferRange objects. |
| 63 | +
|
| 64 | +```yaml |
| 65 | +Type: SwitchParameter |
| 66 | +Parameter Sets: BufferRange |
| 67 | +Aliases: |
| 68 | + |
| 69 | +Required: False |
| 70 | +Position: Named |
| 71 | +Default value: False |
| 72 | +Accept pipeline input: False |
| 73 | +Accept wildcard characters: False |
| 74 | +``` |
| 75 | +
|
| 76 | +### -BufferPosition |
| 77 | +
|
| 78 | +If specified will convert extents to BufferPosition objects. |
| 79 | +
|
| 80 | +```yaml |
| 81 | +Type: SwitchParameter |
| 82 | +Parameter Sets: BufferPosition |
| 83 | +Aliases: |
| 84 | + |
| 85 | +Required: False |
| 86 | +Position: Named |
| 87 | +Default value: False |
| 88 | +Accept pipeline input: False |
| 89 | +Accept wildcard characters: False |
| 90 | +``` |
| 91 | +
|
| 92 | +### -Start |
| 93 | +
|
| 94 | +Specifies to use the start of the extent when converting to types with no range. This is the default. |
| 95 | +
|
| 96 | +```yaml |
| 97 | +Type: SwitchParameter |
| 98 | +Parameter Sets: BufferPosition |
| 99 | +Aliases: |
| 100 | + |
| 101 | +Required: False |
| 102 | +Position: Named |
| 103 | +Default value: False |
| 104 | +Accept pipeline input: False |
| 105 | +Accept wildcard characters: False |
| 106 | +``` |
| 107 | +
|
| 108 | +### -End |
| 109 | +
|
| 110 | +Specifies to use the end of the extent when converting to types with no range. |
| 111 | +
|
| 112 | +```yaml |
| 113 | +Type: SwitchParameter |
| 114 | +Parameter Sets: BufferPosition |
| 115 | +Aliases: |
| 116 | + |
| 117 | +Required: False |
| 118 | +Position: Named |
| 119 | +Default value: False |
| 120 | +Accept pipeline input: False |
| 121 | +Accept wildcard characters: False |
| 122 | +``` |
| 123 | +
|
| 124 | +### CommonParameters |
| 125 | +
|
| 126 | +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). |
| 127 | +
|
| 128 | +## INPUTS |
| 129 | +
|
| 130 | +### System.Management.Automation.Language.IScriptExtent |
| 131 | +
|
| 132 | +You can pipe IScriptExtent objects to be converted. |
| 133 | +
|
| 134 | +## OUTPUTS |
| 135 | +
|
| 136 | +### Microsoft.PowerShell.EditorServices.BufferRange |
| 137 | +
|
| 138 | +### Microsoft.PowerShell.EditorServices.BufferPosition |
| 139 | +
|
| 140 | +This function will return an extent converted to one of the above types depending on switch |
| 141 | +choices. |
| 142 | +
|
| 143 | +## NOTES |
| 144 | +
|
| 145 | +## RELATED LINKS |
| 146 | +
|
0 commit comments