Commit Graph

37 Commits

Author SHA1 Message Date
Ajay Bhargav Baaskaran f8dc5c4702 Obsoleted IRazorEngineBuilder APIs 2018-04-13 12:35:53 -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 da255ff9db Make `TestProject.GetProjectDirectory` more thorough when finding project directory.
- Used our test path utilities to properly navigate to the project directory.
- Added some logic to make future debugging/test failures more diagnosable.

#2184
2018-03-26 12:36:46 -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
Artak b58986414e
Make Razor HTML Comments aware (#2178)
* Merging changes (from dev branch; doing manually to squash them really)of HTML Parser to be aware of HTML Comments so TagHelpers don't complain about comments as content.
2018-03-19 10:18:29 -07:00
Artak Mkrtchyan 6f515bb763
Fixed all the tests to reflect HtmlComment block type support 2018-03-08 13:37:03 -08:00
Artak Mkrtchyan e1fbea24f1
HtmlMarkupParser is now aware of HtmlComment blocks. Majority (if not all, will confirm soon) tests have been updated to account for HtmlComment blocks. 2018-03-08 13:37:03 -08:00
Artak Mkrtchyan ad8485addd
Added new BlockType - HtmlComment
Updated the HtmlMarkupParser to understand the HtmlCOmments, and treat those as blocks.
2018-03-08 13:37:03 -08:00
Nate McMaster 13824c418e Catch 15.7 up with dev
This change integrates most of the non-breaking work that we did in 2.1
including the updates to make Razor less coupled to MVC.
2018-02-19 10:46:16 -08:00
Ryan Nowak 56ead8118a Decouple Razor tools from MVC
Adds a loader (with shadow copying in server mode) based on the Roslyn
Analyzer loader design.

Adds some targets to the Razor SDK that we can use to compute the
configuration and extensions.

Passes all of the metadata through to the command line tools so they can
deal with extensions.
2018-02-15 13:31:31 -08:00
N. Taylor Mullen 133eff3119 Move to RazorProjectEngine.
- Instead of using Razor/Mvc TemplateEngine use `RazorProjectEngine`. This involved changing several locations (each of which used `RazorTemplateEngine` in an entirely different way) to use the RazorProjectEngine's two Process methods.
- Changed an unused public API `VisualStudioRazorParser.TemplateEngine` to `VisualStudioRazorParser.RazorProjectEngine`.
- Ported the remainder of `RazorEngineBuilder`'s extension methods over to `RazorProjectEngineBuilder`. These were used in tests and our `RazorGenerate` tool.
- Added a few test helper methods/classes to enable simple testing of the `RazorProjectEngine`.
- Resolved several test hacks that were working around little discrepancies each of the `RazorTemplateEngine` APIs.
- Changed the template engine factory service to be a project engine factory service.
2018-02-14 12:40:23 -08:00
N. Taylor Mullen 84bc74ea9f Move to RazorProjectFileSystem.
- Changed all existing APIs to utilize `RazorProjectFileSystem`. This was possible because `RazorProjectFileSystem` inherits from RazorProject.
- Renamed `FileSystemRazorProject` to `DefaultRazorProjectFileSystem`.
- Renamed FileSystemRazorProjectItem` to `DefaultRazorProjectItem`.
- Obsoleted `RazorProject.Create`

#1828
2018-02-09 11:49:31 -08:00
Pranav K 84beb5985f Add support for relative paths
* Move path munging in to Razor SDK
* Use AssignTargetPath to determine the target path for outputs and embedded resources

Fixes #1829
Fixes #1847
Fixes #1999
2018-02-05 14:19:52 -08:00
N. Taylor Mullen 771a7e35a4 Add MVC support for RazorProjectEngine.
- Make `RazorProjectEngine` call paths for all feature registrations.
- Add `DefaultMvcImportFeature` for latest and 1.X MVC.
- Ported `AddTargetExtension` and `AddDirective` to `RazorProjectEngineBuilderExtensions`.
- Added tests and a test file system project type.
- Moved obsolete `IRazorEngineBuilder` methods to the bottom of each file. Will actually obsolete the methods once `RazorProjectEngine` is working end-to-end.

#1828
2018-01-25 12:26:11 -08:00
Ryan Nowak 03dea86c4e Adding more tests and clarity around file paths
I noticed we were really undertesting all of the things that handle
paths and file names. I gave this some love and a little clean up where
we weren't doing the right thing in RazorSourceDocument.

Also changed the template engine tests to use the
FileSystemRazorProject. These tests are already using the files on disk
as inputs. I turned off checksums for these since they now have the full
file path, and that would not be portable.
2018-01-08 22:53:49 -08:00
Ryan Nowak 16324c3126 Add an Identifier by default
Using the MVC view engine convention for identifiers seems to make the
most sense, and we already use that convention for RazorProject so I
guess we're stuck with it.
2018-01-06 18:43:01 -08:00
Ryan Nowak d602f9d770 Add relative path to source document
Adding this via a properties object that encompasses all of the optional
properties. This way if we need to add more items that are optional we
can continue to do so without overload explosion.
2018-01-05 18:15:06 -08:00
Ryan Nowak 186e5733c0
Add metadata to Razor (#1894)
* Add metadata to Razor

This PR introduces standard metadata to Razor. This change begins to
formalize the contract between generated code produced by Razor and
runtimes that want to load and interact with this code.

This is a step on making MVC a 'plugin' to Razor rather than the only
possible implementation. Since we're doing MSBuild work - this is the
right time to designate the current interaction between Razor and MVC as
'legacy' and move forward.

Additionally, we need the source thumbprinting to make re-compilation of
Razor a thing.

-----

Also I noticed that our source document doesn't expose the hash
algorithm by name. We really should have this, so I added it and
hardened the code that deals with checksums in c# generation.
2018-01-02 13:30:50 -08:00
Ajay Bhargav Baaskaran 8fcb046345 Moved the test infrastructure to depend on RazorDiagnostic instead of RazorError 2017-12-15 17:22:00 -08:00
Ajay Bhargav Baaskaran 085838e83a Make ErrorSink and Tokenizer depend on RazorDiagnostic instead of RazorError 2017-12-14 18:32:58 -08:00
Pranav K 82247fbb09 Update samples and tests to target netcoreapp2.1 2017-11-14 09:45:28 -08:00
Ajay Bhargav Baaskaran f4e9ddad22 Link syntax tree Span nodes 2017-10-10 13:07:27 -07:00
Ajay Bhargav Baaskaran fa6fde2b20 Moved TagHelper directive validation and parsing from TagHelperBinder to
CSharpCodeParser
2017-08-23 17:14:41 -07:00
N. Taylor Mullen f8d43853f8 Re-introduce RazorEditorParser.
- Revived `RazorEditorParser`.
- Made `PartialParseResult` internal and renamed it to `PartialParseResultInternal`. This fell in line with other syntax tree types.
- Moved the `RazorEditorParser` implementation away from `TextChange` and `ITextBuffer`. Instead it now relies on `SourceChange` and the VS contract `ITextSnapshot`.
- Added `RazorEditorParserTest` to ensure the changes in implementation did not impact previous functionality.
- Removed some obvious tests that unnecessarily re-tested behavior that was already verified.
- Updated tests.
- Moved several Language.Test types to the common test project so they could be reused.

#1259
2017-07-12 17:01:16 -07:00
Ryan Nowak 9c0a8a5c96 Rename properties on taghelper nodes 2017-07-07 11:32:05 -07:00
Ajay Bhargav Baaskaran d6e892b30c Adjusted verbosity of some property names and made
TagHelperIntermediateNode.TagHelpers and IList
2017-07-06 18:05:36 -07:00
Ajay Bhargav Baaskaran 11c5293862 Unnest IntermediateToken.TokenKind 2017-07-06 11:15:36 -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 8a9bf9c71a Rewrite of code rendering context 2017-07-03 16:29:34 -07:00
N. Taylor Mullen 4654997201 Add AllowedChildTagDescriptor.
- Changed the `AllowedChildTags` collection on `TagHelperDescriptor` to have a custom object type to represent child tags.
- Created comparers and builders to work with the child tag descriptor.
- Removed the validation methods on `TagHelperDescriptorBuilder` since there's no longer any bits to validate (they're contained within the sub-properties).
- Unit tested the `DisplayName`.

#1493
2017-07-03 11:04:10 -07:00
Ryan Nowak 7aeb228063 Redesign tag helper codegen 2017-06-30 17:34:01 -07:00
N. Taylor Mullen 2a6f0e4dc9 Productionize the csharp rendering context APIs.
- Rename `CSharpRenderingContext` => `CodeRenderingContext`.
- Rename `CSharpCodeWriter` => `CodeWriter`
- Rename `BasicWriter` => `IntermediateNodeWriter`
- Rename `...BasicWriter` => `...NodeWriter`
- Made `CodeRenderingContext` a public abstract API. Left temporary TagHelper pieces in the class since these will be removed soon.
- Moved several `CodeRenderingContext` methods into extension methods. These make use of the Items collection.
- Moved the reporting of missing code target extensions into the `ExtensionIntermediateNode`. This is the integration point of `CodeTarget`s and `CodeRenderingContext`s; therefore, it made more sense existing there.
- Left SetRenderChildren/SetRenderNode as extension methods due to how they're wired up. Aka, to create a `CodeTarget` you need a `CodeRenderingContext`... To Create a `DocumentWriter` you need a `CodeTarget`... To set the render methods on the context you need a `DocumentWriter`.
- Updated tests to utilize the new code renering constructs.
- Moved code generation testability features from `CSharpLoweringPhase` to the `CodeRenderingContext.Items`.

#1043
2017-06-30 16:35:53 -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
Ajay Bhargav Baaskaran 7c7bb627b9 Moved typename and propertyname to extension methods 2017-06-29 16:47:53 -07:00