Commit e3179e4
Fix folding with spanning regions (#805)
* Fix folding for regions with same end token
Previously the token matching was broken;
```
foreach ($1 in $2) { <----- STARTS MATCH HERE (1)
$x = @{ <----- STARTS MATCH HERE (2)
'abc' = 'def'
} <----- ENDS MATCH HERE (1) (2)
}
```
This was caused by two or more different token pairs sharing the same end token.
This commit modifies the token pair matching to take an array of Start Tokens
instead of a single. This has the added benefit of performance increase too.
This commit also adds tests for this scenario.
* Add support for braced variable names in folder
Previously the code folder was not aware of braced variable name
assignments. This commit adds detection and an appropriate test.
* Add negative folding test for splatting
This commit adds a splat command to the folding scenario to ensure that the
folder is not confused by the (at) character for splatting.1 parent 86b76fd commit e3179e4
File tree
2 files changed
+79
-27
lines changed- src/PowerShellEditorServices/Language
- test/PowerShellEditorServices.Test/Language
2 files changed
+79
-27
lines changedLines changed: 31 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
22 | 39 | | |
23 | 40 | | |
24 | 41 | | |
| |||
28 | 45 | | |
29 | 46 | | |
30 | 47 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 48 | + | |
| 49 | + | |
37 | 50 | | |
38 | | - | |
| 51 | + | |
39 | 52 | | |
40 | 53 | | |
41 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
42 | 57 | | |
43 | | - | |
| 58 | + | |
44 | 59 | | |
45 | 60 | | |
46 | | - | |
| 61 | + | |
47 | 62 | | |
48 | | - | |
| 63 | + | |
49 | 64 | | |
50 | 65 | | |
51 | | - | |
| 66 | + | |
52 | 67 | | |
53 | | - | |
| 68 | + | |
54 | 69 | | |
55 | 70 | | |
56 | 71 | | |
| |||
146 | 161 | | |
147 | 162 | | |
148 | 163 | | |
149 | | - | |
| 164 | + | |
150 | 165 | | |
151 | 166 | | |
152 | 167 | | |
153 | | - | |
| 168 | + | |
154 | 169 | | |
155 | 170 | | |
156 | 171 | | |
157 | 172 | | |
158 | 173 | | |
159 | 174 | | |
160 | 175 | | |
161 | | - | |
| 176 | + | |
162 | 177 | | |
163 | 178 | | |
164 | 179 | | |
| |||
Lines changed: 48 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
111 | 114 | | |
112 | 115 | | |
113 | 116 | | |
114 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
115 | 124 | | |
116 | 125 | | |
117 | 126 | | |
118 | 127 | | |
119 | | - | |
| 128 | + | |
120 | 129 | | |
121 | 130 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
131 | 141 | | |
132 | 142 | | |
133 | 143 | | |
| |||
217 | 227 | | |
218 | 228 | | |
219 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
220 | 257 | | |
221 | 258 | | |
0 commit comments