Commit Graph

170 Commits

Author SHA1 Message Date
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
Ryan Nowak 8bbfecb0da Merge branch 'rel/2.0.0' into dev 2017-07-17 13:17:03 -07:00
Ryan Nowak 59d3fb433b Fix #1555
Revert validation that file-scoped directives appear before HTML or
code.
2017-07-17 11:24:58 -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
Ajay Bhargav Baaskaran b70815e317 Made `RazorCodeGenerationOptionsBuilder.DesignTime` getter only
- Made RazorCodeGenerationOptions consistent with RazorParserOptions
2017-07-07 14:41:53 -07:00
Ryan Nowak 9c0a8a5c96 Rename properties on taghelper nodes 2017-07-07 11:32:05 -07:00
Ryan Nowak ff40124594 Convert most of CodeWriter into extensions
We don't really want to ship what we have as a contract. As an emergency
measure we are making it into internal extension methods so we can have
a do-over in 2.1.
2017-07-07 10:55:33 -07:00
Ajay Bhargav Baaskaran 267b3fab0a Made IntermediateNodeWalker.Ancestors indexable 2017-07-06 19:24:25 -07:00
Ajay Bhargav Baaskaran 49eab41726 Made CodeTargetBuilder an abstract class 2017-07-06 19:01:28 -07:00