Commit Graph

111 Commits

Author SHA1 Message Date
Kirthi Krishnamraju a858373409 Merge branch 'release' into dev 2014-10-29 13:26:50 -07:00
Kirthi Krishnamraju 85d0ddc45a Added description in project.json for all projects 2014-10-29 11:38:09 -07:00
N. Taylor Mullen 7ab25918e0 Add tests to validate @removetaghelper functionality.
- Added utility methods to construct valid SyntaxTreeNodes that represent the @removetaghelper directive.
- Added parse level unit tests to validate the @removetaghelper generates an accurate SyntaxTreeNode.
- Added parse level unit tests to validate the @removetaghelper throws with bad formats.
- Added TagHelperRegistration unit tests to validate the AddOrRemoveTagHelperCodeGenerators are understood and affect the descriptors found.
- Added Designtime mapping tests to validate correct source mappings are made to ensure proper coloring and lack-of C# intellisense.
- Added end-to-end tests to validate @removetaghelper can essentially disable TagHelpers on a page.

#112
2014-10-29 11:31:00 -07:00
N. Taylor Mullen 30221f7ce0 Add @removetaghelper directive.
- Added parsing recognition of the @removetaghelper directive.
- Added TagHelperDescriptor handling: @removetaghelper will cause the system to ignore TagHelpers that are added via @addtaghelper.
- Added Chunk generation, this involved building a CodeGenerator (soon to be named ChunkGenerator) that pulled out the stringified @removetaghelper lookup text which it then uses to construct a RemoveTagHelperChunk.
- Modified CodeVisitors to now understand RemoveTagHelperChunk's.
- Added code generation, this involved creating a dummy string in order to give the @removetaghelper "..." coloring.

#112
2014-10-29 10:24:57 -07:00
N. Taylor Mullen 0dba621965 Make TagHelperOutput.Attributes case insensitive.
- Changed the Attributes dictionary to utilize a StringComparer.OrdinalIgnoreCase comparer.
- Changed TagHelperExecutionContext to ignore attribute casing.
- Updated the AllAttributes and HtmlAttributes dictionaries to ignore attribute casing.
- Added tests to validate their new behavior.

#186
2014-10-23 22:22:11 -07:00
Pranav K 21d64b4ae2 MQ: Cleanup to use var 2014-10-22 15:35:43 -07:00
Pranav K 473f642dde Modifying tests to run in both in aspnet50 and aspnetcore50
* Additionally trimming references from project.json
2014-10-19 21:18:43 -07:00
Pranav K 99fe8294e9 Modifications to support providing tag descriptors from derived hosts 2014-10-16 07:11:46 -07:00
N. Taylor Mullen f8020e8e85 Make @addtaghelper directive not be nested.
- Whenever we encounter an @addtaghelper directive we add it to the CodeTree at the top level (not nested in any chunk blocks).
- Added a test to validate that @addtaghelper inside of a ChunkBlock doesn't add to the ChunkBlock's children.

#195.
2014-10-15 12:10:27 -07:00
NTaylorMullen e5a21520e5 Add HtmlAttributeNameAttribute for TagHelpers.
- Added the ability to override the HTML attribute name for TagHelper properties.
- Tested functionality of overriding the attribute name target and inheriting the attribute name.

#121
2014-10-14 20:16:16 -07:00
Pranav K a2a05e7153 Modify CSharpCodeWriter to generate async lambdas for section
Fixes #85
2014-10-13 17:00:38 -07:00
NTaylorMullen 4f9a6fed93 Fix inherited TagHelper properties.
- Used to only look at declared properties on the tag helper type, now we get the runtime properties.
- Fixed Runtime test projec to work with new CLR changes (looks like it was missed).

#189
2014-10-13 15:33:38 -07:00
Yishai Galatzer 7364c6f6db Expose code builder on generator result, and some tidying up 2014-10-13 09:30:56 -07:00
Pranav K 2637894ab6 Reacting to CLR package versioning changes 2014-10-10 10:34:04 -07:00
N. Taylor Mullen ae4adf6af6 Fixed rebasing issues. 2014-10-09 13:48:23 -07:00
NTaylorMullen 74974d371c Add error mechanism for TagHelperParseTreeRewriter.
- Replaced customer facing Debug.Assert with a new error mechanism to surface errors to GenerateCode callers.
- The new mechanism is a general purpose way for ISyntaxTreeRewriters to add errors to the parsing phase.

#174
2014-10-09 12:58:14 -07:00
NTaylorMullen 72c449bf86 Add TagName attribute for tag helpers.
- Made it so the TagHelperDescriptorFactory could pull tag name targets from TagNameAttributes on types.
- Tested the behavior between TagNameAttribute and TagHelperDescriptorFactory (the only consumer of the attribute).
- Made sure to test duplicate and inherited class scenarios.

#120
2014-10-09 12:58:12 -07:00
N. Taylor Mullen ec638b147a Add ContentBehaviorAttribute for TagHelpers.
- Added detection of custom ContentBehaviors via the ContentBehaviorAttribute in the TagHelperDescriptorFactory.
- Updated some comments in the ContentBehavior enum.
- Add tests to validate custom content behavior resolution.

#122
2014-10-09 12:58:09 -07:00
NTaylorMullen 66aea52542 Add TagHelperScopeManager for runtime.
- Also added an interface ITagHelperScopeManager so we can activate the type via DI.

#155
2014-10-09 12:58:03 -07:00
NTaylorMullen 4378f9613e Add TagHelperRunner for TagHelper runtime.
- This involved adding the following core classes: TagHelper, TagHelperExecutionContext, TagHelperOutput, TagHelperContext.  All of which aid in running TagHelpers.

#154
2014-10-09 12:57:57 -07:00
NTaylorMullen dfe41eced8 Updated versions for runtime project. 2014-10-09 12:57:54 -07:00
NTaylorMullen f9c70a0644 Add TagHelperDescriptorResolver.
- This involved also adding a TagHelperTypeResolver and TagHelperDescriptorFactory.
- The TagHelperTypeResolver is responsible for determining the format of lookup text's used throughout the tag helper system.  By default it handles the following formats:
"assemblyName"
"specificType, assemblyName"
- It also restricts what types are considered TagHelpers.  In this implementation we only accept public, non-nested, non-abstract, non-generic TagHelpers.
- The TagHelperDescriptorFactory is responsible for converting a Type to a TagHelperDescriptor.
- Added tests to validate TagHelperDescriptorResolver, TagHelperTypeResolver and TagHelperDescriptorFactory.

#99
#158
2014-10-09 12:57:49 -07:00
N. Taylor Mullen b67b8dae3d Add @addtaghelper directive.
- Also added some infrastructure pieces for it such as the ITagHelperDescriptorResolver and the default implementation TagHelperDescriptorResolver which will be filled out in a later commit.
- Reworked some extensibility points to allow accessibility of the descriptor resolvers per offline discussions.

#111
2014-10-09 12:57:43 -07:00
NTaylorMullen 2b6b437952 Add extensibility point for TH attribute code gen.
- Enabled the CSharpCodeBuilder to create the CSharpCodeVisitor which exposes a CSharpTagHelperCodeRenderer which is indirectly used to render attribute values.
- Fixed up some existing classes that just new'd up the CSharpCodeVisitor class to instead take in the decorated version.

#119
2014-10-09 12:57:37 -07:00
N. Taylor Mullen 50fa3ee3e3 Create TagHelper specific C# code Generation.
- Added TagHelperChunk generation.
- Added CSharp visitors to understand TagHelperChunks and render corresponding C# code.
- Refactored some code in the CSharpCodeVisitor so it could be utilized in other classes.
- Added a CSharpFieldDeclarationVisitor to render declaration pieces for TagHelper's
- Added metadata to represent specific TagHelper code generation constructs.

#72
2014-10-09 12:57:31 -07:00
N. Taylor Mullen 0b5f0cd565 Rebased onto latest dev.
- Fixed tag helper parse tree visitor rebase error.
2014-10-09 12:50:56 -07:00
N. Taylor Mullen b1b1da0781 Add Microsoft.AspNet.Razor.Runtime src and test project.
#136
2014-10-09 12:50:52 -07:00
N. Taylor Mullen 950828cbab Refactored CodeGeneratorContext to CodeBuilderContext.
- Needed to separate the context's of "generation" and "building" to enable the communication of the TagHelperProvider.
2014-10-09 12:50:49 -07:00
N. Taylor Mullen 3cba84104d Add TagHelper parse tree visitor.
- The visitor looks for TagBlock's that match registered TagHelpers and rebuilds them into TagHelperBlock's.
- Added the code generator and corresponding chunk for a TagHelperBlock.
- Added syntax tree specific objects & helper methods to create accurate tag helper structures.

#71
2014-10-09 12:50:39 -07:00
Pranav K 83da8e257d Generate code for expressions in design time to enable intellisense
Fixes #80
2014-10-08 09:53:27 -07:00
David Fowler 9bb460d5ab Fixup references 2014-10-05 12:04:53 -07:00
David Fowler 01605cd695 Fixed project.json casing 2014-10-04 02:52:07 -07:00
Pranav K f913d8929f Updating CSharpCodeVisitor to generate implicit expressions on a single
line

Fixing 151
2014-10-01 17:20:00 -07:00
Pranav K e5f157565c Removing out var usage 2014-10-01 14:33:14 -07:00
Pranav K d58a6c8c1b Don't calculate checksum in design time mode 2014-09-29 15:33:33 -07:00
Pranav K 5369842384 Ensure pragma checksum is prepended to generated file
Fixes #160
2014-09-29 14:45:26 -07:00
Pranav K 11ee402eec Reviving support for instrumentation in CSharpCodeVisitor
Fixes #42
2014-09-22 17:59:29 -07:00
Ryan Nowak 131c973853 Fix for #90 - removing Enum.HasFlags
This is a perf improvement of about 500ms for our razor code generation
benchmark on my dev box. That's about .8% of the overall execution time of
this benchmark.

This change will remove a bunch of unnessary allocations from the
parsing/code-generation path, and should improve responsiveness.

For reference Enum.HasFlags performs boxing of the enum value, and then
does a type comparison to see if the types are the same. This is
significantly more costly than a normal bitwise and comparison, and it
results in allocations.
2014-09-22 12:45:52 -07:00
Ryan Nowak 2d9b3dd4fb Fix for #91 - Turn some commonly allocated types into structs
These types are allocated for every state transition in the parser (State)
or every character that's read (character reference) and are fairly
compact. Turning them into structs will remove a significant number of unnecessary
allocations in the parser.

For our razor code generation benchmark, making these changes yields about
500-750ms of speedup (out of 40000ms) or about 1%.
2014-09-22 11:28:54 -07:00
Pranav K a5668bdbab Make CompleteBlock accessible to derived parser 2014-09-17 12:46:00 -07:00
Pranav K 658eed4c0f Removing Activator.CreateInstance call from CodeTreeBuilder 2014-09-11 11:55:01 -07:00
N. Taylor Mullen 555615f60e Add TagHelper registration system.
- This registration system accepts tag descriptors that it then uses to feed requests for tag helpers.
- Added some infrastructure pieces that are used to build up valid tag helper descriptors.

#70
2014-09-08 17:14:22 -07:00
N. Taylor Mullen 82b45387a1 Fix nested tags in script tag.
#115
2014-09-08 17:08:36 -07:00
David Fowler 947ec326e0 Updated to use the new target framework in project.json 2014-08-28 23:43:51 -07:00
N. Taylor Mullen 6114d5d269 Modify parser to group html begin/end elements.
- Added a "Tag" block type.
- Wrapped all begin/end elements in a "Tag" Markup block.

#75
2014-08-26 14:53:09 -07:00
Ryan Nowak ff944e5948 Fix for Razor #84 - Optimize GetSourceLocation
GetSourceLocation is frequently called to determine the location mappings
between the original document and the generated code.

The old implementation did a number of ToString and replace operations to
simplify the math on tracking the position - which put it front and center
in our performance measurements - about 25% of all execution time in a
sampling profile of our perf test.

The new code tracks position as code is written, and avoids allocations.
After these changes GetSourceLocation doesn't show up in the profile.
2014-08-20 13:22:23 -07:00
Pranav K 896cce5b51 Reacting to System.IO package version change 2014-08-20 06:56:35 -07:00
Pranav K 1a8278b7c2 Reacting to System.IO.FileSystem package version change 2014-08-18 15:10:12 -07:00
David Fowler 430105e713 Removed source files from the project 2014-08-15 09:24:16 -07:00
Pranav K 8aef9ff651 Reacting to System.Collections version change 2014-07-14 15:20:49 -07:00