Skip to content

Commit cd3bc53

Browse files
alexandairTylerLeonhardt
authored andcommitted
Simplify the parameter descriptions and fix typos (#843)
Simplify the parameter descriptions and fix typos.
1 parent 3697d36 commit cd3bc53

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

module/docs/Find-Ast.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ Find-Ast [-AtCursor] [<CommonParameters>]
2727

2828
## DESCRIPTION
2929

30-
The Find-Ast function can be used to easily find a specific AST within a script file. All ASTs following the inital starting ast will be searched, including those that are not part of the same tree.
30+
The Find-Ast function can be used to easily find a specific AST within a script file. All ASTs following the initial starting AST will be searched, including those that are not part of the same tree.
3131

3232
The behavior of the search (such as direction and criteria) can be changed with parameters.
3333

34-
Additionally, you can find the Ast closest to the cursor with the "AtCursor" switch parameter.
34+
Additionally, you can find the AST closest to the cursor with the "AtCursor" switch parameter.
3535

3636
## EXAMPLES
3737

@@ -41,23 +41,23 @@ Additionally, you can find the Ast closest to the cursor with the "AtCursor" swi
4141
Find-Ast
4242
```
4343

44-
Returns all asts in the currently open file in the editor.
44+
Returns all ASTs in the currently open file in the editor.
4545

4646
### -------------------------- EXAMPLE 2 --------------------------
4747

4848
```powershell
4949
Find-Ast -First -IncludeStartingAst
5050
```
5151

52-
Returns the top level ast in the currently open file in the editor.
52+
Returns the top level AST in the currently open file in the editor.
5353

5454
### -------------------------- EXAMPLE 3 --------------------------
5555

5656
```powershell
5757
Find-Ast { $PSItem -is [FunctionDefinitionAst] }
5858
```
5959

60-
Returns all function definition asts in the ast of file currently open in the editor.
60+
Returns all function definition ASTs in the AST of file currently open in the editor.
6161

6262
### -------------------------- EXAMPLE 4 --------------------------
6363

@@ -73,7 +73,7 @@ Returns all member expressions in the file currently open in the editor.
7373
Find-Ast { $_.InvocationOperator -eq 'Dot' } | Find-Ast -Family { $_.VariablePath }
7474
```
7575

76-
Returns all variable expressions used in a dot source expression.
76+
Returns all variable expressions used in a dot-source expression.
7777

7878
### -------------------------- EXAMPLE 6 --------------------------
7979

@@ -85,7 +85,7 @@ Find-Ast { 'PowerShellVersion' -eq $_ } |
8585

8686
This example sets the required PowerShell version in a module manifest to 4.0.
8787

88-
First it finds the AST of the PowerShellVersion manifest field, then finds the first AST directly after it and changes the text to '4.0'. This will not work as is if the field is commented.
88+
First it finds the AST of the PowerShellVersion manifest field, then finds the first AST directly after it and changes the text to '4.0'. This will not work if the field is commented.
8989

9090
### -------------------------- EXAMPLE 7 --------------------------
9191

@@ -95,7 +95,7 @@ Find-Ast { $_.ArgumentName -eq 'ParameterSetName' -and $_.Argument.Value -eq 'By
9595
ForEach-Object { $_.Name.VariablePath.UserPath }
9696
```
9797

98-
This example gets a list of all parameters that belong to the parameter set 'ByPosition'. First it uses the ArgumentName and Argument properties of NamedAttributeArgumentAst to find the ASTs of arguments to the Parameter attribute that declare the the parameter set 'ByPosition'. It then finds the closest parent ParameterAst and retrieves the name from it.
98+
This example gets a list of all parameters that belong to the 'ByPosition' parameter set. First it uses the ArgumentName and Argument properties of NamedAttributeArgumentAst to find the ASTs of arguments to the Parameter attribute that declare the 'ByPosition' parameter set. It then finds the closest parent ParameterAst and retrieves the name from it.
9999

100100
### -------------------------- EXAMPLE 8 --------------------------
101101

@@ -121,7 +121,7 @@ This example shows off ways you can combine the position functions together to g
121121

122122
### -FilterScript
123123

124-
Specifies a ScriptBlock that returns $true if an AST should be returned. Uses $PSItem and $_ like Where-Object. If not specified all ASTs will be returned.
124+
Specifies a script block that returns $true if an AST should be returned. Uses $PSItem and $_ like Where-Object. If not specified all ASTs will be returned.
125125

126126
```yaml
127127
Type: ScriptBlock
@@ -153,7 +153,7 @@ Accept wildcard characters: False
153153
154154
### -Before
155155
156-
If specified the direction of the search will be reversed.
156+
Specifies the direction of the search will be reversed.
157157
158158
```yaml
159159
Type: SwitchParameter
@@ -169,7 +169,7 @@ Accept wildcard characters: False
169169
170170
### -Family
171171
172-
If specified only children of the starting AST will be searched. If specified with the "Before" parameter then only ancestors will be searched.
172+
Searches only children of the starting AST. When used with the "Before" parameter then only ancestors will be searched.
173173
174174
```yaml
175175
Type: SwitchParameter
@@ -185,7 +185,7 @@ Accept wildcard characters: False
185185
186186
### -First
187187
188-
If specified will return only the first result. This will be the closest AST that matches.
188+
Returns only the first result. This will be the closest AST that matches.
189189
190190
```yaml
191191
Type: SwitchParameter
@@ -201,7 +201,7 @@ Accept wildcard characters: False
201201
202202
### -Last
203203
204-
If specified will return only the last result. This will be the furthest AST that matches.
204+
Returns only the last result. This will be the furthest AST that matches.
205205
206206
```yaml
207207
Type: SwitchParameter
@@ -217,7 +217,7 @@ Accept wildcard characters: False
217217
218218
### -Ancestor
219219
220-
If specified will only search ancestors of the starting AST. This is a convenience parameter that acts the same as the "Family" and "Before" parameters when used together.
220+
Searches only ancestors of the starting AST. This is a convenience parameter that acts the same as the "Family" and "Before" parameters when used together.
221221
222222
```yaml
223223
Type: SwitchParameter
@@ -233,7 +233,7 @@ Accept wildcard characters: False
233233
234234
### -IncludeStartingAst
235235
236-
If specified the starting AST will be included if matched.
236+
Specifies the starting AST will be included if matched.
237237
238238
```yaml
239239
Type: SwitchParameter
@@ -249,7 +249,7 @@ Accept wildcard characters: False
249249
250250
### -AtCursor
251251
252-
If specified, this function will return the smallest AST that the cursor is within.
252+
Returns the smallest AST that the cursor is within.
253253
254254
```yaml
255255
Type: SwitchParameter

0 commit comments

Comments
 (0)