Commit Graph

76 Commits

Author SHA1 Message Date
Artak a9004e503e
Merge pull request #2061 from aspnet/artakm/RestrictChildrenComments
Ignoring HTML comments in tag helper's body. Updated the markup parser to be aware of HTML Comments.
2018-03-12 11:17:57 -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
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
Nate McMaster 4d737af167 Pin tool and package versions to make builds more repeatable
Part of aspnet/Universe#575
2017-11-01 18:12:08 -07:00
Ajay Bhargav Baaskaran f4e9ddad22 Link syntax tree Span nodes 2017-10-10 13:07:27 -07:00
N. Taylor Mullen 6c8286eed7 Split LanguageServices.Razor.
- Created a new `Microsoft.VisualStudio.Editor.Razor` assembly to contain Visual Studio platform agnostic info.
- Added a new `Microsoft.VisualStudio.Editor.Razor.Test.Common` project to be the centerfold for all VisualStudio agnostic test pieces.
- Added a `Microsoft.VisualStudio.Editor.Razor.Test` project and pulled in LanguageService test files into the the Editor.Razor.Test project to correspond to their movement in the src project.

#1690
2017-09-29 16:26:50 -07:00
Nate McMaster 471722eba1 Use PackageLineup to manage PackageReference versions
This uses a feature of KoreBuild which will select PackageReference
versions based on a lineup file. This helps unify versions between repos
and helps us ensure we are consistent across multiple components.
2017-08-25 15:44:05 -07:00
Ajay Bhargav Baaskaran fa6fde2b20 Moved TagHelper directive validation and parsing from TagHelperBinder to
CSharpCodeParser
2017-08-23 17:14:41 -07:00
Nate McMaster 0c3fff3137 Upgrade to xunit 2.3.0-beta4 (#1640)
Includes a few changes required by xunit.analyzers, such as removing unused theory parameters.
2017-08-23 12:56:31 -07:00
Nate McMaster 4cadee2762 Use Directory.Build.props/targets (#1641) 2017-08-23 12:24:57 -07:00
N. Taylor Mullen 2a69b50a64 Change Razor.Test.Common to not act like an executable.
- There's no need for this test library to have a conditional TFM because it's never run under the desktop TFM when crossplat.
2017-07-13 14:58:27 -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
N. Taylor Mullen dd10b0b086 Update test node writer to write malformed directives.
- Updated baselines.

#1456
2017-06-28 16:34:56 -07:00
Ryan Nowak e3b3e20738 Move some stuff to .Extensions
Moved design time directives and tag helper attribute preallocation to
.Extensions.

Just mechanical namespace changes here.
2017-06-21 20:26:31 -07:00
Ryan Nowak 7a234ca513 Rename UsingStatement>UsingDirective 2017-06-21 19:54:40 -07:00
Ryan Nowak a580c8fdf1 Get rid of AccessModifiers 2017-06-21 19:10:57 -07:00
Ryan Nowak a40ca857c5 Rename HtmlAttributeValueStyle>AttributeStructure 2017-06-21 18:56:37 -07:00
Ryan Nowak 21e26ad4aa Rename RazorIRNode
Get rid of references to 'IR'
2017-06-21 12:55:16 -07:00
Ryan Nowak 8649e1a4be Add Tag Helper descriptors to the Tag Helper node 2017-06-20 23:19:49 -07:00
Ryan Nowak 062d7561ae Make section an extension node 2017-06-20 19:20:46 -07:00
Ajay Bhargav Baaskaran 3892a6fede Removed ChecksumIRNode 2017-06-16 11:14:54 -07:00
N. Taylor Mullen e3287ae672 Add diagnostics to the IR.
- Added a `Diagnostics` and `HasDiagnostics` properties to `RazorIRNode`. The `HasDiagnostics` property was necessary in order to traverse nodes without forcibly instantiating their diagnostic lists.
- Added `GetAllDiagnostics` extension method for `RazorIRNode` to provide a way to retrieve all diagnostics that exist on and under a `RazorIRNode`.
- Updated `RazorIRNodeWriter` to display any diagnostics that exist on IR nodes.
- Internal `RazorIRNode`s do not have mutable `Diagnostics` because we don't currently add diagnostics to these elements.
- Added `DefaultIRLoweringPhaseTest` to validate that errors flow from syntax tree to IR document. Also added a missing test.
- Updated the `CSharpLoweringPhaseTest`s to properly validate that errors flow from IR document => csharp document. This resulted in movement of code to the ir lowering phase tests.

#1412
2017-06-13 10:28:41 -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
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