Commit 618883f
authored
Use the latest language version if we can't find a package. (#1573)
Use the latest language version if we can't find a package.
In the new tall-style behavior where we look for a surrounding package
config to infer the language version of each file, we have to decide
what to do when that look-up process fails (either because there is no
package config, or it's malformed).
Initially, I had it error out on that file. That's consistent with the
library API where the formatter *requires* a language version before it
will do anything.
But it's not consistent with the language spec and our other tools. For
them, if there is no valid surrounding package config, the file should
be treated as the latest language version.
This PR does that.
It also fixes the catastrophic UX that the current code has which is
that when a file can't have its language version inferred... it is
silently skipped without telling the user anything. Oops. Now it just
formats the file as expected.1 parent 9c17d3b commit 618883f
File tree
3 files changed
+47
-34
lines changed- lib/src
- testing
- test/cli
3 files changed
+47
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | 38 | | |
42 | 39 | | |
43 | | - | |
| 40 | + | |
| 41 | + | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
| |||
164 | 162 | | |
165 | 163 | | |
166 | 164 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | 165 | | |
174 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
175 | 171 | | |
176 | 172 | | |
177 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
41 | | - | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
163 | | - | |
| 165 | + | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
168 | | - | |
| 170 | + | |
169 | 171 | | |
170 | 172 | | |
171 | | - | |
172 | 173 | | |
173 | | - | |
174 | | - | |
| 174 | + | |
| 175 | + | |
175 | 176 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
| |||
235 | 239 | | |
236 | 240 | | |
237 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
238 | 257 | | |
239 | 258 | | |
0 commit comments