Commit Graph

126 Commits

Author SHA1 Message Date
Ryan Nowak 503ba669d0 Get rid of Parent from IR node 2017-06-08 19:22:14 -07:00
Ryan Nowak e05c697c58 Fix #1356 verify diagnostics in integration tests 2017-06-08 17:03:43 -07:00
Nate McMaster 4d18334573 Target .NET Standard 2.0 2017-06-08 16:37:27 -07:00
Ajay Bhargav Baaskaran a6d2c04195 [Fixes #1379] Rename CSharpStatement to CSharpCode 2017-06-07 15:20:47 -07:00
Ajay Bhargav Baaskaran 74fef5f722 Moved VCTH types to Razor.Extensions 2017-06-06 15:49:35 -07:00
Pranav K d5c1c63d19 Generate assembly attributes as part of code generation 2017-06-05 14:24:17 -07:00
Mike Harder 48285f63c6 Revert "Update Roslyn Version to support C# 7.1"
This reverts commit 8f299c5b11.
2017-06-05 10:39:20 -07:00
Ryan Nowak 8f299c5b11 Update Roslyn Version to support C# 7.1 2017-06-03 17:27:40 -07:00
N. Taylor Mullen 4fde9ca07d Merge branch 'rel/15.3' into rel/2.0.0-preview2
# Conflicts:
#	src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpAutoCompleteTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpDirectivesTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpSectionTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpSpecialBlockTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlToCodeSwitchTest.cs
2017-06-01 15:32:47 -07:00
N. Taylor Mullen 1f32a8322e Make invalid namespace tokens support IntelliSense.
- Added a `DirectiveTokenEditHandler` to enable IntelliSense for invalid namespace tokens.
- Added tests to verify new `DirectiveTokenEditHandler`.
- Updated test expectations for `DirectiveTokenEditHandler`.

#1393
2017-06-01 12:04:20 -07:00
N. Taylor Mullen 2e8c154fcb Make namespace tokens tolerant to EOF and invalid states.
- Updated our `QualifiedIdentifier` to properly parse invalid namespaces. This is more consistent with how the rest of the system works; we consume tokens until we determine if we're in an invalid or valid state. If invalid, we log an error and put back all invalid tokens for the parser to treat as non-directive tokens.
- Added unit tests to validate our extensible directive system can handle malformed namespace tokens at EOF and inline.
- Added a code gen test for Razor.Extensions to prove we've fixed the underlying issue for our `@namespace` directive that crashed VS.

#1393
2017-06-01 12:04:20 -07:00
Ajay Bhargav Baaskaran 2f03a39e41 Refactored attribute values IR 2017-05-26 12:34:34 -07:00
Ajay Bhargav Baaskaran cdddaefa81 Fixed a bug in VCTH pass and added an integration test 2017-05-25 15:44:24 -07:00
Ajay Bhargav Baaskaran 1efcdafa45 Removed ExecuteTagHelpersIRNode 2017-05-22 11:03:34 -07:00
N. Taylor Mullen ebe8ab4612 Rename TagHelperBoundAttributeDescriptorBuilder => BoundAttributeDescriptorBuilder.
#1369
2017-05-19 12:44:07 -07:00
Ryan Nowak 315221c758 Re-enable some skipped tests
The underlying bug in this area has been fixed.
2017-05-19 10:18:17 -07:00
Ryan Nowak 2a88d6efcf Fix aspnet/Mvc#6296 sanitize class and namespace
The new @namespace directive isn't sanitizing class and namespace names
when generating them. This means that a file-system-legal character like
'-' will show up in a class name, and that's not good.

Note that the old code paths (document classifiers) already had tests for
this and did it properly. It was only missing from @namespace.
2017-05-19 08:54:24 -07:00
Ryan Nowak 94aaa3db9e Configure xunit for better display 2017-05-17 20:31:37 -07:00
Ryan Nowak 811ea019a5 Fixes #1245 - Make TemplateCodeExtension public
This removes the hardcoding of an MVC type from Razor.
2017-05-17 20:25:06 -07:00
N. Taylor Mullen 657c2a8da3 Merge branch 'rel/15.3' into dev
# Conflicts:
#	test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/IntegrationTests/CodeGenerationIntegrationTest.cs
2017-05-17 11:24:32 -07:00
Ajay Bhargav Baaskaran 7bd13061b5 Set the chunk generator of non-string tag helper attributes to ExpressionChunkGenerator 2017-05-17 11:17:01 -07:00
N. Taylor Mullen b8ea008151 Make extensible directive type token rendering allow value types.
- Instead of rendering a null assigning statement for a type token we now render a `default(TTypeToken)`. With this approach type tokens can be value types without creating a design time error.
- Re-generated baseline files to reflect new directive token code generation.

#1176
2017-05-17 10:31:16 -07:00
N. Taylor Mullen 19f895b9ad Validate line mappings for integration tests in Razor.Extensions.
- Split line mapping validation into its own method.
- Prior to this we were calling the wrong method in our design time code generation integration tests within the Razor.Extensions test project.
- Re-generated line mapping baselines to conform with the cshtml files for Razor.extensions code generation integration tests.

#1351
2017-05-17 10:20:36 -07:00
Ryan Brandenburg b96a486650 Compile CodeGeneration tests 2017-05-16 16:26:47 -07:00
Ryan Nowak ad294fb4ba Add a new THProvider api
This change adds an API for Tag Helper discovery.

I also got rid of the 'design time' flag for the provider as an
experimental change. We need to think through the consequences of this
before committing to it. Right now I've left those tests failing until we
can make a decision.

This change decouples VCTH discovery a bit more, but we're still not ready
to move that into a the MVC extensions assembly. For that we need the
ability to discover the MVC extensibility.
2017-05-16 14:59:37 -07:00
Nate McMaster 5856517be7 Remove workaround from test csproj files 2017-05-15 12:52:58 -07:00
Ryan Nowak 2167e4151e Fix #1311 add a base class for features 2017-05-12 21:15:59 -07:00
Ryan Nowak fd3a34b000 Remove RazorIRBuilder.Document 2017-05-12 18:12:30 -07:00
Ryan Nowak 2ec2b98f83 Fix #1312 - make ExecuteCore protected 2017-05-12 17:54:09 -07:00
N. Taylor Mullen 3830a1b7ac Rename the BoundAttributeDescriptor builder.
- ITagHelperBoundAttributeDescriptor => TagHelperBoundAttributeDescriptorBuilder

#1306
2017-05-12 17:39:45 -07:00
Ryan Nowak a8dd0355d0 Remove default usings
This change removes the default usings for 'System' and
'System.Threading.Tasks' and adds them to the MVC template engine.

This is preparation for removing this feature from the razor options, I
wanted to get all of the intentional diff out of the way.
2017-05-12 17:08:58 -07:00
Ryan Nowak 86d045c667 Fix #1305 move instrumentation to MVC 2017-05-12 16:14:17 -07:00
Nate McMaster 682d630fa2 Upgrade test framework versions and fix issues with tests 2017-05-12 15:41:49 -07:00
Ryan Nowak b17e506ce8 Some API cleanup around directivest 2017-05-12 13:27:28 -07:00
Ryan Nowak d3e37f20ce Add some new IR nodes
This adds the basics of a few new node types. I'll do a follow up to start
using these so we can eliminate some misuse of the statement node.
2017-05-11 14:52:31 -07:00
Ryan Nowak 2afe2e1627 Rename RazorMethodDeclaration -> MethodDeclaration 2017-05-11 10:22:45 -07:00
N. Taylor Mullen 0e509b4bbb Add incomplete directive integration tests.
- These tests validate that our extensible directives do not have code that explodes when an incomplete directive is encountered. This is typically the case when a user is in the midst of typing a directive at design time.
- Added an extensions test and a language test.

#1271
2017-05-01 14:32:17 -07:00
Ryan Brandenburg 8af9f656dd Add CodeGen tests for @inherits 2017-05-01 10:42:00 -07:00
N. Taylor Mullen f0d0c3d0b8 Merge branch 'preview-1/stabilization' into dev
# Conflicts:
#	build/dependencies.props
2017-04-28 17:20:20 -07:00
N. Taylor Mullen 86beea4269 Fix @namespace directive to handle incomplete directives.
- This involved not using the `First()` method when reading the directives tokens.
- Added two tests to validate an empty directive token and a missed directive token for the `@namespace` directive.

#1268
2017-04-28 17:14:34 -07:00
N. Taylor Mullen 344862fbc3 Change string token parsing to not flow errored tokens.
- Found that our extensible directive string parsing system wasn't consistent with the rest of the extensible directive tokens. Basically, if there were malformed string tokens we'd consume them and pass them along to extensible directive passes. This was a big no-no because it means extensible directive passes weren't able to rely on tokens being passed to them being well-formed.
- Fixed up existing extensible directive tests that relied on output of string tokens.

#1247
2017-04-26 16:38:58 -07:00
Ajay Bhargav Baaskaran 4e2cd0c2d6 Finish writer implementation of the remaining IR nodes and added tests
- SetTagHelperPropertyIRNode
- ChecksumIRNode
- UsingStatementIRNode
- Preallocated attributes target extension
- HtmlAttributeIRNode and friends
- Design time directive helper target extension
- Removed renderers and rendering conventions
- Regenerated IR baselines
Issue - #846 and #1051
2017-04-21 11:46:34 -07:00
N. Taylor Mullen c25aadf599 Enable page directive to handle malformed text.
- Made a targeted fix to PageDirective that stops it from crashing Visual Studio when its malformed.
- Added unit test to validate PageDirective didn't throw when attempting to determine if something was a page.
- Added an integration test to validate malformed page tags can make their way through the entire Razor pipeline and don't destroy the rest of the content.

#1247
2017-04-20 14:05:54 -07:00
Andrew Stanton-Nurse e856224682 react to removal of PlatformAbstractions (#1243) 2017-04-20 09:30:59 -07:00
N. Taylor Mullen 6f7cb763a2 Update TModel code generation.
- Prior to this TModel would be set to a potentially non-fully qualified name. This would cause errors in default MVC templates.
- Regenerated test files to reflect new TModel.
- Updated unit test to reflect new behavior.

#1222
2017-04-14 12:32:20 -07:00
Ryan Nowak c0e3519bc3 Set an order on @inject to run behind @namespace
The problem is that @inject uses the type name, and @namespace can change
it. Setting an explicit order makes sure that these things happen in a
sensible sequence.
2017-04-13 13:59:47 -07:00
N. Taylor Mullen 1b8a4e704c Rename ITagHelperDescriptorBuilder => TagHelperDescriptorBuilder.
#1210
2017-04-11 17:08:38 -07:00
Ryan Nowak e5cac9fb7f Implement @namespace
This change adds support for @namespace, and introduces a set of
changes that are needed to support @namespace in the parser.

@namespace and @class have always been treated as reserved words by Razor,
with the intent that someday they would be allowed as directives.

This changes makes that possible.

You will still get an error about @namespace being a reserved word if you
don't have the directive.
2017-04-11 12:46:02 -07:00
Ryan Nowak 64e5aaf478 Remove some dead code 2017-04-11 10:24:34 -07:00
Pranav K e2267f54a6 Add support for naming a page (#1204) 2017-04-11 10:10:45 -07:00
Ryan Nowak 1fbdb30186 Normalize newlines in default imports
Needed for xplat
2017-04-11 08:19:56 -07:00
Ryan Nowak 35bbede0ac Remove unused files 2017-04-10 19:47:41 -07:00
Ryan Nowak 303636db13 Updates to generated .cs files
A separate commit so that it's reviewable. Only things derived from the
file path have changed.
2017-04-10 19:43:03 -07:00
Ryan Nowak 207f40f92d Move test infrastructure
This moves the test infrastructure to a common project and udpates the MVC
tests to use the good integration testing features.
2017-04-10 19:42:56 -07:00
Ajay Bhargav Baaskaran 0f7b0f5d8c [Fixes #1196] Remove Content property from HtmlContentIRNode 2017-04-10 12:54:11 -07:00
N. Taylor Mullen 0618bae3bd Rename Microsoft.AspNetCore.Razor.Evolution => Microsoft.AspNetCore.Razor.Language.
- Also updated corresponding test project to go from Evolution => Language.
- Regenerated test files to reflect new file paths.

#1169
2017-04-10 10:20:04 -07:00
Ryan Nowak 0cb7ae7fbf Add support for namespace tokens in extensible directives
This change adds support for accepting a namespace name in extensible
directives. This will be needed for the @namespace directive.

Implemented new parsing and codegen for namespaces using nameof().

Also fixed any issue where we were not global::-qualifying object where it
was used in the design time code for tokens.
2017-04-05 15:37:50 -07:00
N. Taylor Mullen dda9cf3259 Do not generate C# line pragmas without a file path.
- Prior to this change default imports would get line pragmas generated for them because thye'd have a source location but no file path (they were a dynamic document).
- Re-generated C# files to reflect new line pragma changes.

#1110
2017-04-04 15:32:25 -07:00
N. Taylor Mullen 68554f8106 Updated the ir lowering phase to lazily add namespaces.
- The lazy addition of namespaces gives the main document lowering phase an opportunity to add source location information which we then add after the main lowering.
- Re-generated csharp to capture addition of using statements that were previously overridden by defaults/imports.

#1174
2017-04-04 12:09:34 -07:00
Ryan Brandenburg a22bfa5265 Fix build break 2017-04-04 11:30:05 -07:00
Ryan Brandenburg 9e12230eef Add RazorPage test without model 2017-04-04 10:54:20 -07:00
Ryan Nowak 3ec4e244db Cleanup around ViewImports
Added a default for the imports filename.

Deleted unused test files
2017-04-03 20:23:02 -07:00
Ajay Bhargav Baaskaran 4dbf6f23c3 Moved TagHelperIRNode, InitializeTagHelperStructureIRNode from renderer to writer 2017-04-03 19:57:51 -07:00
N. Taylor Mullen cb5c483a1d Add line mappings for using directives.
- We were generating line pragmas for using directives but not line mappings. This resulted in 0 IntelliSense when written within the Razor editor.
- Regenerated test files to reflect new line mappings.

#1162
2017-04-03 15:18:49 -07:00
Ajay Bhargav Baaskaran a74cda4402 Setting TokenKind for RazorIRToken 2017-03-31 14:52:10 -07:00
Ajay Bhargav Baaskaran bc347d736f [Fixes #964] Removed Content property from CSharpStatementIRNode 2017-03-31 10:52:53 -07:00
N. Taylor Mullen fdea42624d Fix UrlResolutionTagHelper tag helper inclusion.
- Also fixed test name to assert all defaultly included TagHelpers instead of just the UrlResolutionTagHelper
2017-03-29 16:30:28 -07:00
Ryan Brandenburg 60a87829f8 Fix type name 2017-03-29 16:19:12 -07:00
Ajay Bhargav Baaskaran c1500da2a8 Don't render directive token from imports in design time 2017-03-29 15:08:11 -07:00
Jass Bagga 582ffe2e10 Add HeadTagHelper and BodyTagHelper
Addresses aspnet/Mvc#5728
2017-03-29 12:23:55 -07:00
Ajay Bhargav Baaskaran 0b5113c76e Suppress compilation errors for TModel in imports 2017-03-29 11:42:13 -07:00
Ryan Nowak 737a9a58ad Fix breaks in Razor Tests
I removed a reference from a src project which exposed this issue. We
shouldn't be using these types in new Razor.
2017-03-27 14:32:30 -07:00
Ryan Nowak 1683018d71 Add a static 'register' method to MVC's extensions
This will be called by the IDE, and by MVC to register all of the
functionality in Microsoft.AspNet.Mvc.Razor.Extensions.
2017-03-24 15:56:32 -07:00
Ryan Brandenburg b4640f8bb8 Use AspNetCore.Mvc.RazorPages 2017-03-24 13:08:07 -07:00
Pranav K 2ea0659e60 Change compilation targets.
* Remove net451 as a compilation target
* Upgrade to netcoreapp2.0
2017-03-24 07:49:34 -07:00
Ryan Brandenburg 72febdac64 Move Razor.Host to Razor 2017-03-22 16:10:44 -07:00