Commit Graph

222 Commits

Author SHA1 Message Date
Ajay Bhargav Baaskaran 8674dd9236 Removed duplocate Id for a RazorDiagnostic 2018-10-29 11:25:29 -07:00
Ryan Nowak f425134ffe Fix #2265 - Port Blazor testing improvements
The Blazor test infrastructure made a copy of the code in Razor and then
added some more features. This change backports the features needed for
the style of test we're using in Blazor.

I updated the MVC integration tests to use the new style, but I think
there's limited value in trying to rev all of the old tests.

One feature in particular that I removed from the old infrastructure was
the automatic inference of imports based on the file system. This
feature was wierd and doesn't parallel how these features work in
actuality. It's easy and more natural to test imports in new style
tests.
2018-10-01 13:00:44 -07:00
Ajay Bhargav Baaskaran eb6faf1754 Redo baselines 2018-07-19 15:29:30 -07:00
Ajay Bhargav Baaskaran 8e667ba730 Rename parser tests to have shorter names 2018-07-19 15:22:30 -07:00
Ajay Bhargav Baaskaran 7f6b05149d Generate deterministic unique ids for tag helpers 2018-07-17 14:01:42 -07:00
Ajay Bhargav Baaskaran 21f2edce16 Generate and verify baselines for ClassifiedSpans and TagHelperSpans
- Moved GetClassifiedSpans and GetTagHelperSpans logic to Razor.Language
2018-07-17 10:54:42 -07:00
N. Taylor Mullen cfd63e1e2e Change HTML splitting logic to not split on surrogate pairs.
- When a surrogate pair is about to be split down the middle we reduce the size of our split by 1 character. This way we split right before a surrogate pair. In the case of zero width joiners, if we split on a zero width joiner we still render valid bytes because the zero width joiner by itself can stand alone.
- Added tests for the various split cases.

#2470
2018-07-13 17:18:56 -07:00
Ajay Bhargav Baaskaran ce4780a830 Renamed symbol to token everywhere
- Updated Resources
- Updated test code
- Regenerated baselines
- Added exclusions for apicheck (See https://github.com/aspnet/BuildTools/issues/704)
2018-07-06 16:29:36 -07:00
Ajay Bhargav Baaskaran ed7c4e8f5c Parser tests clean up 2018-07-06 16:24:39 -07:00
Ajay Bhargav Baaskaran f9a09372b7 Converted TagHelperBlockRewriterTest 2018-06-29 15:33:21 -07:00
Ajay Bhargav Baaskaran 984e7826d6 Converted TagHelperParseTreeRewriterTest 2018-06-29 12:23:52 -07:00
Ajay Bhargav Baaskaran b232a1103a Prereq for converting tag helper tests 2018-06-29 12:15:13 -07:00
Ryan Nowak 942d4d194c Convert HtmlToCodeSwitchTest 2018-06-28 13:30:52 -07:00
N. Taylor Mullen 42e8f4abc8 Convert HtmlTagsTest to use baselines.
#2263
2018-06-28 10:49:15 -07:00
N. Taylor Mullen 8211dfff9c Convert HtmlErrorTest to use baselines.
#2263
2018-06-28 10:49:15 -07:00
Ryan Nowak ea96c50dce Convert WhitespaceRewriterTest 2018-06-27 17:02:03 -07:00
Ajay Bhargav Baaskaran 8eef4a4bb3 Convert HtmlDocumentTest 2018-06-27 15:47:57 -07:00
N. Taylor Mullen 67b5588185 Convert CSharpWhitespaceHandlingTest to use baselines.
#2263
2018-06-27 15:09:33 -07:00
Ajay Bhargav Baaskaran 048a6ec3ea Converted HtmlAttributeTest 2018-06-27 14:47:44 -07:00
N. Taylor Mullen 5950928baa Convert CSharpSpecialBlockTest to use baselines.
#2263
2018-06-27 14:35:22 -07:00
Ajay Bhargav Baaskaran a7fd53b3a3 Convert CSharpNestedStatementsTest 2018-06-27 13:43:51 -07:00
Ajay Bhargav Baaskaran df22392996 Convert CSharpImplicitExpressionTest 2018-06-27 13:43:51 -07:00
Ajay Bhargav Baaskaran d48946c2e0 Convert CSharpExplicitExpressionTest 2018-06-27 13:43:50 -07:00
Ryan Nowak 363be73a00 Convert more tests
CSharpRazorCommentsTest
CSharpReservedKeyWordsTest
CSharpToMarkupSwitchTest
2018-06-27 13:14:58 -07:00
Ryan Nowak 4fda468f06 Convert CSharpSectionTest 2018-06-27 13:14:58 -07:00
Ajay Bhargav Baaskaran c0929a9002 Convert CSharpErrorTest 2018-06-27 12:53:52 -07:00
N. Taylor Mullen 69cfb95b90 Convert CSharpStatementTest to use baselines.
#2263
2018-06-27 12:24:52 -07:00
N. Taylor Mullen 25547e80d1 Convert CSharpTemplateTest to use baselines.
#2263
2018-06-27 12:24:52 -07:00
Ajay Bhargav Baaskaran ab27e0bd52 Converted CSharpBlockTest to use baselines 2018-06-26 18:02:50 -07:00
Ajay Bhargav Baaskaran 1e58748f59 Converted HtmlBlockTest to use baselines 2018-06-26 16:09:05 -07:00
Ajay Bhargav Baaskaran a92089d2f9 Converted CSharpDirectivesTest to use baselines 2018-06-26 15:17:36 -07:00
Ajay Bhargav Baaskaran 999c24d78d Converted more parser tests to baselines
- Converted CSharpAutoCompleteTest
2018-06-25 11:43:17 -07:00
Ajay Bhargav Baaskaran b821ce8b8e First step in converting parser tests to use baselines
- Added the necessary infrastructure to serialize and verify the syntax
tree
- Updated ParserVisitor to be overrideable
- Made CSharpVerbatimBlockTest to use baselines
2018-06-19 15:57:05 -07:00
N. Taylor Mullen 41fad8a33a Don't smart indent code inside of Razor block constructs.
- Prior to this change we weren't strict enough with where our smart indenter ran. We made the assumption that every code block could be smart indented and then Roslyn would "do the right thing". However, in nested code block scenarios we found that Roslyn and us would both indent resulting in extra newlines. These changes make the criteria for applying smart indentation a little stricter.
- Updated directive code block parsing to add a C# marker symbol in cases of an empty code block directive.
- Added unit tests to verify new smart indenter behavior.
- Updated existing tests to expect new syntax tree marker symbol for empty directive bits.
- Regenerated baselines.

#2410
2018-06-18 20:38:01 -07:00
N. Taylor Mullen 1aa15374b5 Add partial parsing of `@functions` directive body.
- Added ability to understand valid inserts, deletes and replacements for the `@functions` directive (and any other directive that uses our extensible code block bits).
- Added unit tests.
- Updated existing tests.
- Found an issue when completing some C# items the auto-completions would impact the underlying snapshot after we'd captured the change. Fixed this by forcing a reparse when we detect that our understanding of the latest snapshot and the actual latest snapshot diverge.

#2408
2018-06-18 17:11:40 -07:00
N. Taylor Mullen d6f3a1bd22 Enable using directive IntelliSense auto-completion.
- Allow identical `@using` directives in the primary document. This means that if a user types `@using System` twice in the primary document (i.e. `Index.cshtml`) then we'll generate that using statement twice; this enables proper C# IntelliSense to light up on both using statements and allows auto-completion to work because there's no more magical distinction logic for Razor code that is in the current document.
- Prior to this change if you had two identical using statements in the same document one would be in no-mans land mapped to nothing (not C#, not HTML) and the other would be mapped to C#; the second a user differentiated the two statements (i.e. adding a `.`) we'd distinctify the using statements resulting in an invalid completion.
- This PR has an end-user impact where they will now receive the normal C# warning about having duplicate using. I treated this prior behavior more as a bug because we threw away the first using directive instance which impacted editing and in general was a silly thing to correct for the user.
- Added new integration test showing how using directives are not de-duplicated in the primary document.

#1255
2018-06-15 13:17:09 -07:00
Ryan Nowak af63afdae7 Add partial parsing for parenthesis
- This is part of a fix for #1255 - this change enables signature help in implicit expressions by improving the partial parsing. We're now smart enough about the contents of an implicit expression and attempt to balance parenthesis to determine if we should not full parse.

#1255
2018-06-15 11:22:03 -07:00
N. Taylor Mullen dc76027a7a Generate line pragmas even for whitespace.
- We need to pre-emptively generate line pragmas to handle C# scenarios which are session based. For instance, if a C# completion session starts at a location without a pragma they capture the origination point; at which point if a user keeps typing we generate a line pragma drastically changing where the copmletion started resulting in a broken C# completion experience.
- Updated test files to reflect new behavior.

#2299
2018-06-11 14:48:38 -07:00
Ajay Bhargav Baaskaran f9d4fba39d Added a taghelpers and imports overload to Process and ProcessDesignTime
We want to have a way to specify the taghelper descriptors and imports to use while
processing a specific document.
- Added an overload to Process and ProcessDesignTime to take in a list
TagHelperDescriptors and a list of imports
- Added the corresponding CreateCodeDocumentCore overload
- Added GetTagHelpers and SetTagHelpers extension methods for
CodeDocument
- Added the necessary plumbing to use the taghelpers from the
CodeDocument when available and fallback logic.
- Added DocumentImportsTracker and updated background code generation
logic to use the new overload
- Added/updated tests
2018-05-22 11:40:21 -07:00
Ryan Brandenburg efaaec6546 Upgrade to netcoreapp22 2018-05-08 15:22:54 -07:00
Ajay Bhargav Baaskaran f8dc5c4702 Obsoleted IRazorEngineBuilder APIs 2018-04-13 12:35:53 -07:00
Ajay Bhargav Baaskaran 5504374125 Preserve directive node diagnostics in document node 2018-04-10 10:24:21 -07:00
Ajay Bhargav Baaskaran 6270c1f47e Merge branch 'rel/vs15.7' into dev 2018-04-05 16:28:17 -07:00
Ryan Nowak 4cd24a2b08 Add experimental flag to un-special-case data-
This change allows blazor to opt into treating data- attributes the same
way as normal attributes in the parser.
2018-04-05 15:27:04 -07:00
Ryan Nowak d1c0ab587c Add support for type parameters to class nodes
This change will allow someone extending Razor to use generic type
parameters in generated classes.

There's no user-level extensibility provided here yet, as in there is no
language support for adding type parameters.
2018-04-05 15:26:42 -07:00
N. Taylor Mullen c874f84c3d Revert "Revert "Make Razor HTML Comments aware (#2178)""
This reverts commit 1f3f4b79da.
2018-03-20 15:23:53 -07:00
N. Taylor Mullen 1f3f4b79da Revert "Make Razor HTML Comments aware (#2178)"
This reverts commit b58986414e.
2018-03-20 11:54:09 -07:00
Pranav K 5f3908cb54 Stop expressly testing on netcoreapp2.0 2018-03-20 09:37:26 -07:00
Ajay Bhargav Baaskaran c934bd08ac Merge branch 'rel/vs15.7' into release/2.1 2018-03-19 19:14:51 -07:00
Ajay Bhargav Baaskaran 9dc7c65205 Fix: Missing Html intellisense after directives 2018-03-19 17:16:11 -07:00