Commit Graph

178 Commits

Author SHA1 Message Date
N. Taylor Mullen c0cb8f009c Update RazorProjectEngine to use RazorConfiguration.
- In this PR we do away with `CreateDesignTime` on the `RazorProjectEngine`. Instead we now have an overload that takes in a configuration and does the right thing.
- Updated `RazorProjectEngineBuilder` to have a configuration.
- Updated `RazorConfiguration` to only have a `Default`. Setting up a razor configuration for design time now requires calling code to construct the configuration manually.
2018-01-29 16:08:17 -08:00
N. Taylor Mullen 80f943caef Flow RazorLanguageVersion to RazorEngine.
- Restructured RazorLanguageVersion to be a sealed concrete type to enable things like `RazorLanguageVersion.Latest`; it also allows us to make broader changes in the future. Also, in the future if we want to add support for overriding operators to enable greater than comparisons we can as well.
- Removed version validity checks because we restrict who can construct a `RazorLanguageVersion` now. This way we don't have to check for valid versions all throughout our code.
- Added a simple `ProjectExtensibilityConfiguration` => `RazorLanguageVersion` method in the `DefaultProjectExtensibilityConfigurationFactory` to temporarily enable letting the system operate on the `RazorLanguageVersion`. Eventually that entire class will change.

#1961
2018-01-29 16:08:17 -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
N. Taylor Mullen aa3fb32220 Revert "Revert "Add contracts for RazorProjectEngine.""
This reverts commit f301d92332.
2018-01-24 11:20:18 -08:00
N. Taylor Mullen f301d92332 Revert "Add contracts for RazorProjectEngine."
This reverts commit 59f2cf8e66.
2018-01-23 11:42:38 -08:00
N. Taylor Mullen 59f2cf8e66 Add contracts for RazorProjectEngine.
- These contracts introduce a new `RazorProjectEngine` concept which allows for users to configure 1 entity that's responsible for the RazorEngine and project.
- The `RazorProjectEngineBuilder` has a collection of features that are dispersed on the created `RazorEngine` and the `RazorProjectEngine`.
- Included a complete implementation of `RazorProjectEngine` it introduces the extension points for the project engine. The primary one includes the `IRazorImportFeature`, the default behavior is to return 0 imports.
- Included a complete project engine builder implementation.

#1828
2018-01-22 17:05:43 -08:00
N. Taylor Mullen 968e033e4b Make Block and Span cache Length.
- Part of caching length required the `Span`'s `ReplaceWith` method to propagate its changes to its parent so that it can propogate the change to invalidate all parent length caches.
- Added Span and Block tests to validate the interaction of caching.

#1927
2018-01-16 21:14:46 -08:00
Pranav K ecb323b5dc Use FilePath if RelativePhysicalPath on RazorProjectItem is null 2018-01-12 15:19:01 -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 b7415502bf Add RelativePhysicalPath
The FilePath property on RPI isn't what we want for use in the compiler,
it's more of a view engine concept. Adding a property that does what we
want.
2018-01-08 19:37:54 -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
Pranav K 3ae601e4df
Prevent type name collisions when file hierarchy + namespace is identical (#1881)
* Prevent type name collisions when file hierarchy + namespace is identical
2018-01-02 09:41:10 -08:00
Ajay Bhargav Baaskaran 34fe4099c2 Removed LegacyRazorDiagnostic and RazorError 2017-12-27 11:43:19 -08:00
Ajay Bhargav Baaskaran 439c742dec Removed LegacyResources.resx 2017-12-22 15:59:35 -08:00
Ajay Bhargav Baaskaran 80af17fc4b Moved TagHelperParseTreeRewriter out of LegacyRazorDiagnostic 2017-12-22 12:33:28 -08:00
N. Taylor Mullen 63aceea121 Change TagHelperBlockRewriter's error usage to use RazorDiagnosticFactory.
- Changed `DefaultRazorDiagnostic` to expose a little more information for tests. This info is only available when casted to the `DefaultRazorDiagnostic` type and only available internally.
- Changed parameter order of a `DefaultTagHelperTargetExtension` diagnostic.
- Updated baselines of files in `Razor.Language.Test`.
- Added a new convenience constructor on `SourceSpan`. The ctor is equivalent to calling the class with a SourceLocation.

#1827
2017-12-22 09:38:31 -08:00
Ajay Bhargav Baaskaran d419566534 Revert "Revert "Include LineIndex and CharacterIndex when comparing SourceLocation""
This reverts commit bace4a3818.
2017-12-20 15:27:15 -08:00
Ajay Bhargav Baaskaran b3be0ebb91 Moved TokenizerBackerParser out of LegacyRazorDiagnostic 2017-12-20 11:21:05 -08:00
Ajay Bhargav Baaskaran 7d4fb5dcab Moved HtmlMarkupParser out of LegacyRazorDiagnostic 2017-12-19 18:07:23 -08:00
Ajay Bhargav Baaskaran bace4a3818 Revert "Include LineIndex and CharacterIndex when comparing SourceLocation"
This reverts commit 0e20ea5178.
2017-12-19 18:04:18 -08:00
Ajay Bhargav Baaskaran 0e20ea5178 Include LineIndex and CharacterIndex when comparing SourceLocation 2017-12-19 15:59:45 -08:00
Ajay Bhargav Baaskaran 808f539297 Moved CSharpCodeParser out of LegacyRazorDiagnostic 2017-12-19 15:59:37 -08:00
N. Taylor Mullen 926dae0d88 Move DefaultTagHelperTargetExtension errors to use RazorDiagnosticFactory.
- Added tests validating these errors because we didn't have any before.

#1827
2017-12-19 15:28:24 -08:00
Ajay Bhargav Baaskaran 18ce7f07ac Moved CSharpTokenizer errors out of legacy diagnostic 2017-12-18 11:51:08 -08:00
N. Taylor Mullen 463e11b739 Make SyntaxTree mutations not leak.
- Prior to this when the partial parser would successfully parse a change we'd mutate the returned syntax tree so any data inquired about the tree would then be wrong. We now isolate mutations to copied versions of the syntax tree.
- Added copy tests to ensure that we were appropriately copying all the various syntax node types.

#1793
2017-12-18 11:50:07 -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
Ajay Bhargav Baaskaran 6bbd063e26 Use DefaultRazorDiagnostic in DefaultDirectiveSyntaxTreePass 2017-12-14 16:35:13 -08:00
Pranav K 82247fbb09 Update samples and tests to target netcoreapp2.1 2017-11-14 09:45:28 -08:00
Ajay Bhargav Baaskaran 7002dbf20a Added Name and Documentation to DirectiveTokenDescriptor 2017-11-06 10:55:52 -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
Ajay Bhargav Baaskaran bd8e9ecc31 Added RazorParserFeatureFlags and added support for minimized bool tag
helper bound attributes
 - Fixes #1678, #431
2017-09-29 16:02:09 -07:00
Ajay Bhargav Baaskaran aa445ee9b4 Add error for using single quotes in add/remove taghelper directive 2017-09-07 11:29:33 -07:00
Ajay Bhargav Baaskaran 4b68a48f1d Fix: Broken intellisense for extensible directives 2017-08-29 14:47:52 -07:00
Ajay Bhargav Baaskaran b12683a35d Mark trailing whitespace after type name in directives as markup 2017-08-29 12:48:44 -07:00
Ajay Bhargav Baaskaran f3d121cacf Mark whitespace between tag helper directive and its value as Markup 2017-08-28 21:42:37 -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 6e42c8d0e4 Made section 1.X compatibility only apply at design time.
#1637
2017-08-22 20:47:01 -07:00
N. Taylor Mullen 5104e8c806 Make 2.0 codegen compatible with 1.0 projects until multi-targeting is complete.
#1637
2017-08-22 17:29:33 -07:00
Ajay Bhargav Baaskaran 45732a5dd3 Fix: Nested tag helpers do not work when tag helper prefix is set 2017-08-17 15:26:10 -07:00
Ajay Bhargav Baaskaran 8d2a9e5929 Support tuples for type directive tokens 2017-08-14 12:43:41 -07:00
Ajay Bhargav Baaskaran 364fc1a55d Allow nullable types with generic arguments in directives 2017-08-10 11:47:43 -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 31e9710186 Added unit test for DefaultTagHelperOptimizationPass 2017-07-31 17:12:20 -07:00