Commit Graph

571 Commits

Author SHA1 Message Date
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
Ryan Nowak 1262a6d4b2 Adding CodeGeneration benchmark 2017-04-10 14:25:43 -07:00
Ryan Nowak acf3e759d1 Add BenchmarkDotNet boilerplate 2017-04-10 14:25:43 -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
Ajay Bhargav Baaskaran fe60c2426c Moved HtmlContentIRNode from renderer to writer 2017-04-07 12:55:24 -07:00
N. Taylor Mullen 96d97f65e9 Allow null parent tag when calling `GetTagHelpersGivenParent`.
- A `null` parent tag in all of our other API represents "any" parent tag, or in this case "root". Prior to this change we'd expect the caller to do their own verification of the parent and then assume all `TagHelperDescriptor`s are valid; this isn't sufficient because only our code base should have that knowledge.

#1188
2017-04-06 17:02:06 -07:00
N. Taylor Mullen af3cf497a6 Update TagHelperMatchingConventions to disallow opt-out prefix.
- Prior to this change the `TagHelper` parsing would strip the opt-out character (`!`) from tag names that got passed to the TagHelper matching services. At design time this proved to be a problem because they have their own understanding of the HTML document and only pass us full tag names (names that include `!`). This changes the matching conventions to immediately return false if a tag name is seen to contain the `TagHelper` opt-out.
- Added two `DefaultTagHelperFactService` tests to verify that tag names with opt-out prefixes are denied `TagHelperDescriptor`s.

#1186
2017-04-06 16:10:35 -07:00
Ajay Bhargav Baaskaran 0228fd2770 Moved ExecuteTagHelpersIRNode from renderer to writer 2017-04-06 11:43:35 -07:00
Ryan Nowak 0481cc6569 Fix travis
We were missing the newline normalization from the test base class.
2017-04-06 11:26:52 -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
Ajay Bhargav Baaskaran 6fea6454f0 Moved CreateTagHelperIRNode from renderer to writer 2017-04-04 16:33:28 -07:00
Ajay Bhargav Baaskaran 1a05359d12 Reset writer scope for tag helpers inside template 2017-04-04 15:43:42 -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
Ajay Bhargav Baaskaran 7d8bd29724 Moved DeclareTagHelperFields from renderer to writer 2017-04-03 15:54:35 -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
N. Taylor Mullen 0e15ff3e95 Re-add marker IR tokens to represent CSharp in an expression.
- At design time we weren't generating line mappings when a user would type `@` or `@(`. This results in no C# IntelliSense being provided to the user because the editor hasn't mapped any of Razor to the C# buffer.
- Modified the `DefaultIRLoweringPhase` to allow for marker symbols, these symbols .
- Re-generated test files to account for 0 length line mappings on empty expression nodes.

#1155
2017-04-03 13:05:54 -07:00
N. Taylor Mullen d4e21ae706 Revert "Generate line mappings for empty expressions."
This reverts commit 4c0afbad86.
2017-04-03 13:05:54 -07:00
N. Taylor Mullen 4c0afbad86 Generate line mappings for empty expressions.
- At design time we weren't generating line mappings when a user would type `@` or `@(`. This results in no C# IntelliSense being provided to the user because the editor hasn't mapped any of Razor to the C# buffer.
- Updated the design time renderer and design time writer to account for empty expressions.
- Modified the `DefaultIRLoweringPhase` to set source locations on empty expression nodes.
- Re-generated test files to account for 0 length line mappings on empty expression nodes.

#1155
2017-04-02 22:25:12 -07:00
Ajay Bhargav Baaskaran 660db5b733 Merge branch 'ajbaaska/writer' into dev 2017-03-31 16:30:11 -07:00
Ajay Bhargav Baaskaran da1e4130d2 Moved from Renderer to Writer 2017-03-31 16:25:07 -07:00
Ajay Bhargav Baaskaran a74cda4402 Setting TokenKind for RazorIRToken 2017-03-31 14:52:10 -07:00
N. Taylor Mullen 385531f11a Workaround issues preventing tests from running in Visual Studio.
#1139
2017-03-31 11:20:10 -07:00
Ajay Bhargav Baaskaran bc347d736f [Fixes #964] Removed Content property from CSharpStatementIRNode 2017-03-31 10:52:53 -07:00
Pranav K 209729332c Add GetImportItems to RazorTemplateEngine
Fixes #1109
2017-03-31 07:48:34 -07:00
N. Taylor Mullen dd9eab551d Workaround tooling issue with runtime only TagHelpers.
- Prior to this if all instances of `TagHelper`s in an assembly had editor browsable never we'd log an error saying that no TagHelpers were found for that assembly. Until we can evaluate a better fix for this issue I've removed the logic that logs those errors and its corresponding tests/resources.

#1145
2017-03-29 16:56:05 -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
N. Taylor Mullen 22c7c90b5a Add `TagHelperFactsService`.
- Add API to enable the editor to query information on the state of `TagHelper`s within a Razor document.
- Refactored methods from `TagHelperDescriptorProvider` to be in a `TagHelperDescriptorConventions` class so the language service could use them.
- Added `DefaultTagHelperFactService` tests.

#1120
2017-03-29 15:36:32 -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
Ajay Bhargav Baaskaran ed8425800a Revert: Don't generate CSharpStatementIRNode for whitespace 2017-03-27 12:45:49 -07:00
Ajay Bhargav Baaskaran 5928d0d54b Don't generate CSharpStatementIRNode for null or whitespace 2017-03-24 17:54:09 -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 Nowak 565dd30957 Make the parser options configurable
The RazorParserOptions were only configurable via an internal interface
and an extension method on the builder. This isn't suitable for VS because
we need to be able to update the configuration while the editor is open,
without creating a new engine.
2017-03-24 15:21:26 -07:00
Ryan Brandenburg b4640f8bb8 Use AspNetCore.Mvc.RazorPages 2017-03-24 13:08:07 -07:00