Commit Graph

36 Commits

Author SHA1 Message Date
Ajay Bhargav Baaskaran ae42d7599d Show error if page directive is not at the top of file 2018-04-04 17:27:10 -07:00
Ryan Nowak 989a6c699f Don't add the tag helper provider by default
Since the default tag helper provider is used by MVC then MVC should
include it. Now that Blazor is in the mix we shouldn't include it for
all configurations.
2018-03-08 15:41:34 -08:00
N. Taylor Mullen db805eb3e3 Fix ModelExpression's in section directive blocks.
- Changed `SectionDirectivePass` to move non-token body nodes from the original `DirectiveIntermediateNode` to the `SectionIntermediateNode`. By doing this there's no longer dual references of `SectionIntermediateNode` bodies.
- Added MVC tests for current and 1_X extensions.

#1614
2017-08-16 10:25:53 -07:00
Ajay Bhargav Baaskaran 4fcad1548e Added support for multitargeting
- Added 1_X src project for multitargeting

- Added 1_X test project for multitargeting

- Added 1_X test MvcShim for multitargeting

- Make section directive generate the correct code the appropriate version

- Added another sln
2017-08-04 15:39:18 -07:00
Ajay Bhargav Baaskaran ee64ee7e1a Removed warning in ViewImports integration test 2017-07-28 16:59:35 -07:00
N. Taylor Mullen afa61e7080 Rename LineMapping => SourceMapping.
- Also removed the == and `!=` operators for `SourceMapping`.

#1510
2017-07-06 10:34:19 -07:00
Ryan Nowak 112cbc0bb6 Check for warnrings in tests taht compile
This fixes and issue that snuck through and broke MVC as well as
preventing this from happening in the future.
2017-07-01 11:52:41 -07:00
Ryan Nowak 7aeb228063 Redesign tag helper codegen 2017-06-30 17:34:01 -07:00
Ajay Bhargav Baaskaran 9c031e6fb5 Moved all TagHelperDescriptor related builders to have getter setter
instead of methods

More polish to the tag helper descriptor builders.
- Expose underlying builders as getter only list
- Added AsDictionary() extension method to BoundAttributeDescriptorBuilder
- Expose diagnostics as RazorDiagnosticCollection
- Got rid of Require** prefix in TagMatchingRuleBuilder
- Workaround issue aspnet/Razor#1492 by copying the test descriptor
  extensions
2017-06-30 14:08:05 -07:00
Ryan Nowak 853b458893 This is a different take on Taylor's builders.
This makes it possible to use another 'kind' of tag helpers, which isn't
possible today.

This also further decouples the tag helper api surface from the default
implementation.

VCTH now have their own 'kind'.

Also improved generation of display names and error messages where it
was coupled to the type name.
2017-06-28 17:37:52 -07:00
Ryan Nowak 21e26ad4aa Rename RazorIRNode
Get rid of references to 'IR'
2017-06-21 12:55:16 -07:00
N. Taylor Mullen 132c8c7a7e Implement consistent error story for directives.
- Added error case that enforces whitespace in between directive tokens.
- Upon encountering invalid directive tokens/states we bail out of parsing and log an appropriate error.
- Raised directive parse errors to the IR layer. This is slightly hacky given the parsers limitations; we swap out the error sink temporarily to capture all directive parser errors and then shove the errors collected onto the directives chunk generator.
- Added a `MalformedDiretiveIRNode` and corresponding pass to represent directives that are in an invalid state. Chose to not take the path of using the default `DirectiveIRNode.Diagnostics` member to enable users who are extending directives to only ever have to work with "valid" directives. If they want to work with malformed directives they can search the IR document for their malformed counterpart and handle it separately.
- Updated existing test expectations
- Removed some existing tests that were no longer valid (we don't call into user code if a directive is malformed).

#1173
2017-06-19 21:14:06 -07:00
Ryan Nowak 6860806213 Make usage of FileName and FilePath consistent
FileName => "Foo.cshtml"
FilePath => "/Bar/Baz/Foo.cshtml"
2017-06-12 16:15:26 -07:00
Pranav K d5c1c63d19 Generate assembly attributes as part of code generation 2017-06-05 14:24:17 -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 cdddaefa81 Fixed a bug in VCTH pass and added an integration test 2017-05-25 15:44:24 -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 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
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
Ryan Nowak 2167e4151e Fix #1311 add a base class for features 2017-05-12 21:15:59 -07:00
N. Taylor Mullen 3830a1b7ac Rename the BoundAttributeDescriptor builder.
- ITagHelperBoundAttributeDescriptor => TagHelperBoundAttributeDescriptorBuilder

#1306
2017-05-12 17:39:45 -07:00
Ryan Nowak 86d045c667 Fix #1305 move instrumentation to MVC 2017-05-12 16:14:17 -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 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
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
Ryan Nowak 1fbdb30186 Normalize newlines in default imports
Needed for xplat
2017-04-11 08:19:56 -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