-
Notifications
You must be signed in to change notification settings - Fork 230
Unify handling of the @ character in razor code blocks
#10232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ebee3cb
Unify GENERATE_BASELINE handling to a single location for all tests
333fred 242e871
Unify test diagnostic handling. We will now always verify the diagnos…
333fred 6a6cc1f
Add new tests and record initial baselines to show how changes will a…
333fred ab53753
Consistently handle `@` signs in csharp code blocks
333fred f66aceb
Add back misremoved whitespace.
333fred 946f600
PR Feedback.
333fred 55f7d82
Make GenerateBaselines public
333fred File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 14 additions & 13 deletions
27
...guage/legacyTest/TestFiles/ParserTests/CSharpBlockTest/LocalFunctionsWithRazor.cspans.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,14 @@ | ||
| Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [118] ) | ||
| Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [118] ) | ||
| MetaCode span at (1:0,1 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [118] ) | ||
| Code span at (2:0,2 [66] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [118] ) | ||
| Markup span at (68:4,8 [8] ) (Accepts:None) - Parent: Tag block at (68:4,8 [8] ) | ||
| Markup span at (76:4,16 [18] ) (Accepts:Any) - Parent: Markup block at (68:4,8 [42] ) | ||
| Transition span at (94:4,34 [1] ) (Accepts:None) - Parent: Expression block at (94:4,34 [5] ) | ||
| Code span at (95:4,35 [4] ) (Accepts:NonWhitespace) - Parent: Expression block at (94:4,34 [5] ) | ||
| Markup span at (99:4,39 [9] ) (Accepts:None) - Parent: Tag block at (99:4,39 [9] ) | ||
| Markup span at (108:4,48 [2] ) (Accepts:None) - Parent: Markup block at (68:4,8 [42] ) | ||
| Code span at (110:5,0 [7] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [118] ) | ||
| MetaCode span at (117:6,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [118] ) | ||
| Markup span at (118:6,1 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [118] ) | ||
| Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [119] ) | ||
| Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [119] ) | ||
| MetaCode span at (1:0,1 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [119] ) | ||
| Code span at (2:0,2 [59] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [119] ) | ||
| Markup span at (61:4,0 [8] ) (Accepts:Any) - Parent: Markup block at (61:4,0 [50] ) | ||
| Markup span at (69:4,8 [8] ) (Accepts:None) - Parent: Tag block at (69:4,8 [8] ) | ||
| Markup span at (77:4,16 [18] ) (Accepts:Any) - Parent: Markup block at (61:4,0 [50] ) | ||
| Transition span at (95:4,34 [1] ) (Accepts:None) - Parent: Expression block at (95:4,34 [5] ) | ||
| Code span at (96:4,35 [4] ) (Accepts:NonWhitespace) - Parent: Expression block at (95:4,34 [5] ) | ||
| Markup span at (100:4,39 [9] ) (Accepts:None) - Parent: Tag block at (100:4,39 [9] ) | ||
| Markup span at (109:4,48 [2] ) (Accepts:None) - Parent: Markup block at (61:4,0 [50] ) | ||
| Code span at (111:5,0 [7] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [119] ) | ||
| MetaCode span at (118:6,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [119] ) | ||
| Markup span at (119:6,1 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [119] ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...TestFiles/ParserTests/CSharpBlockTest/LocalFunctionsWithRazor_MissingSemicolon.cspans.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [118] ) | ||
| Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [118] ) | ||
| MetaCode span at (1:0,1 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [118] ) | ||
| Code span at (2:0,2 [115] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [118] ) | ||
| MetaCode span at (117:6,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [118] ) | ||
| Markup span at (118:6,1 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [118] ) |
61 changes: 61 additions & 0 deletions
61
.../TestFiles/ParserTests/CSharpBlockTest/LocalFunctionsWithRazor_MissingSemicolon.stree.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| RazorDocument - [0..118)::118 - [@{LF void Foo()LF {LF var time = DateTime.NowLF <strong>Hello the time is @time</strong>LF }LF}] | ||
| MarkupBlock - [0..118)::118 | ||
| MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup> - SpanEditHandler;Accepts:Any | ||
| Marker;[]; | ||
| CSharpCodeBlock - [0..118)::118 | ||
| CSharpStatement - [0..118)::118 | ||
| CSharpTransition - [0..1)::1 - Gen<None> - SpanEditHandler;Accepts:None | ||
| Transition;[@]; | ||
| CSharpStatementBody - [1..118)::117 | ||
| RazorMetaCode - [1..2)::1 - Gen<None> - SpanEditHandler;Accepts:None | ||
| LeftBrace;[{]; | ||
| CSharpCodeBlock - [2..117)::115 | ||
| CSharpStatementLiteral - [2..117)::115 - [LF void Foo()LF {LF var time = DateTime.NowLF <strong>Hello the time is @time</strong>LF }LF] - Gen<Stmt> - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[<null>];AtEOL | ||
| NewLine;[LF]; | ||
| Whitespace;[ ]; | ||
| Keyword;[void]; | ||
| Whitespace;[ ]; | ||
| Identifier;[Foo]; | ||
| LeftParenthesis;[(]; | ||
| RightParenthesis;[)]; | ||
| NewLine;[LF]; | ||
| Whitespace;[ ]; | ||
| LeftBrace;[{]; | ||
| NewLine;[LF]; | ||
| Whitespace;[ ]; | ||
| Identifier;[var]; | ||
| Whitespace;[ ]; | ||
| Identifier;[time]; | ||
| Whitespace;[ ]; | ||
| Assign;[=]; | ||
| Whitespace;[ ]; | ||
| Identifier;[DateTime]; | ||
| Dot;[.]; | ||
| Identifier;[Now]; | ||
| NewLine;[LF]; | ||
| Whitespace;[ ]; | ||
| LessThan;[<]; | ||
| Identifier;[strong]; | ||
| GreaterThan;[>]; | ||
| Identifier;[Hello]; | ||
| Whitespace;[ ]; | ||
| Identifier;[the]; | ||
| Whitespace;[ ]; | ||
| Identifier;[time]; | ||
| Whitespace;[ ]; | ||
| Keyword;[is]; | ||
| Whitespace;[ ]; | ||
| Identifier;[@time]; | ||
| LessThan;[<]; | ||
| Slash;[/]; | ||
| Identifier;[strong]; | ||
| GreaterThan;[>]; | ||
| NewLine;[LF]; | ||
| Whitespace;[ ]; | ||
| RightBrace;[}]; | ||
| NewLine;[LF]; | ||
| RazorMetaCode - [117..118)::1 - Gen<None> - SpanEditHandler;Accepts:None | ||
| RightBrace;[}]; | ||
| MarkupTextLiteral - [118..118)::0 - [] - Gen<Markup> - SpanEditHandler;Accepts:Any | ||
| Marker;[]; | ||
| EndOfFile;[]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...s/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.diag.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| (1,14): Error RZ1009: The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example: | ||
|
|
||
| @if(isLoggedIn) { | ||
| <p>Hello, @user!</p> | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
...sts/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.cspans.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,3 @@ | ||
| Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [65] ) | ||
| Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [65] ) | ||
| Code span at (1:0,1 [43] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [65] ) | ||
| Markup span at (44:2,4 [3] ) (Accepts:None) - Parent: Tag block at (44:2,4 [3] ) | ||
| Markup span at (47:2,7 [7] ) (Accepts:Any) - Parent: Markup block at (44:2,4 [20] ) | ||
| Transition span at (54:2,14 [1] ) (Accepts:None) - Parent: Expression block at (54:2,14 [4] ) | ||
| Code span at (55:2,15 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (54:2,14 [4] ) | ||
| Markup span at (58:2,18 [4] ) (Accepts:None) - Parent: Tag block at (58:2,18 [4] ) | ||
| Markup span at (62:2,22 [2] ) (Accepts:None) - Parent: Markup block at (44:2,4 [20] ) | ||
| Code span at (64:3,0 [1] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [65] ) | ||
| Code span at (1:0,1 [64] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [65] ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.