Commit 19342b1
authored
Stop allowing FileKind to be set on a RazorCodeDocument independently from the RazorParserOptions (#11612)
There are two extension methods targeting `RazorCodeDocument` that allow
consumers to set or get the file kind for the document. However, this
can result in inconsistencies because that file kind value (stored in
`RazorCodeDocument.Items`) is independent from
`RazorCodeDocument.ParserOptions.FileKind`. This PR removes both methods
in favor `RazorParserOptions.FileKind`.
Summary of changes:
- Remove the `GetFileKind()` and `SetFileKind(...)` extension methods
and expose a convenience `RazorCodeDocument.FileKind` property that
delegates to `ParserOptions.FileKind`.
- Add `RazorParserOptions.Create(...)` and
`RazorCodeGenerationOptions.Create(...)` convenience factory methods.
- Remove `LanguageVersion` and `FileKind` from
`RazorCodeGenerationOptions` to avoid the possibility of a
`RazorCodeDocument` containing parser options and code generation
options that disagree about these values.
- Update tests (mostly in tooling) to stop calling `SetFileKind(...)`
and pass the value as part of `RazorCodeDocument` creation.
> [!NOTE]
> `GetFileKind()` and `SetFileKind(...)` are public extension methods
but are not used by the RazorSdk, so they should be safe to remove.File tree
32 files changed
+208
-154
lines changed- src
- Compiler
- Microsoft.AspNetCore.Razor.Language/test
- Microsoft.CodeAnalysis.Razor.Compiler/src/Language
- Components
- Extensions
- Razor
- src
- Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange
- Microsoft.CodeAnalysis.Razor.Workspaces/CodeActions/Razor
- test
- Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions
- CSharp
- Html
- Razor
- Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing
32 files changed
+208
-154
lines changedLines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
| 291 | + | |
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| |||
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
306 | 309 | | |
307 | 310 | | |
308 | | - | |
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
| |||
325 | 327 | | |
326 | 328 | | |
327 | 329 | | |
328 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
329 | 334 | | |
330 | 335 | | |
331 | | - | |
332 | 336 | | |
333 | 337 | | |
334 | 338 | | |
| |||
356 | 360 | | |
357 | 361 | | |
358 | 362 | | |
359 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
360 | 367 | | |
361 | 368 | | |
362 | | - | |
363 | 369 | | |
364 | 370 | | |
365 | 371 | | |
| |||
388 | 394 | | |
389 | 395 | | |
390 | 396 | | |
391 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
392 | 401 | | |
393 | | - | |
394 | 402 | | |
395 | 403 | | |
396 | 404 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
0 commit comments