Commit Graph

833 Commits

Author SHA1 Message Date
N. Taylor Mullen 7a2f89b5de Add assembly name filtering to GetTagHelpers calls.
- Updated the Razor extension to properly discover all assembly names available to a project and use those as a TagHelper filter.

#1022
2017-02-17 14:54:06 -08:00
Ryan Nowak 965ae5490f Introducing RazorIRToken
This IR node will be part of the new token model for IR. It will be used
by all nodes that contain user content. Going forward, tokens will be the
thing that contains text and produces line mappings.

This commit just introduces the class.
2017-02-17 11:22:53 -08:00
N. Taylor Mullen de6bfa480f Only show C# projects in Razor info window. 2017-02-17 11:18:28 -08:00
Ryan Nowak 290c11ef3a Set ToolsVersion=15.0 2017-02-17 11:13:07 -08:00
N. Taylor Mullen 8c17375be0 Surface TagHelper resolution errors.
- Decided to not expose the resolutions errors in the Razor extension. If we feel that it's good debug information we can add it later.
- Added a `TagHelperResolutionResult` type to Razor.Workspaces so it can be used in the language and remote service.

#1014
2017-02-17 10:51:44 -08:00
Ryan Nowak bbeb485405 Refactor ParserVisitor
We need the visitor to allow control over whether to recurse or not into
something. This change makes the old ParserVisitor class behave much more
like the newer IR Walkers.

We need this for the tokens refactor because IR lowering will not be just
a trivial visitor anymore in the future.
2017-02-16 15:36:01 -08:00
Pranav K 075771a12d Re-enable netcoreapp1.1 tests (part 2) 2017-02-16 15:29:31 -08:00
N. Taylor Mullen f3a0ee5bdb Add `RazorLanguageServiceException` to capture unexpected exceptions.
- Consumers will then be able to catch the `RazorLanguageServiceException`s directly and log them as needed.
2017-02-16 14:50:35 -08:00
Pranav K cfa4689d47 Re-enable netcoreapp1.1 tests
Fixes #1003
2017-02-16 14:09:12 -08:00
Pranav K f56d1b9441 Updating VS version 2017-02-16 14:09:12 -08:00
Nate McMaster 76b998a8dc
Skip .NET Framework-only tests on xplat 2017-02-16 11:16:52 -08:00
Ryan Nowak e35ee53ee5 DefaultRazorIRLoweringPhase is too agressive
This change fixes a bug where DefaultRazorIRLoweringPhase is too
aggressive in merging HTML spans. You can hit the bug by delimiting two
html spans with a metacode character like:

<foo>@{ <bar/> }</foo>

The lowering phase will combine these HTML nodes, which is invalid as they
don't have contiguous spans.

The change here is to merge spans only when they both have an invalid
location or are contiguous.
2017-02-16 10:53:09 -08:00
Ryan Nowak 7a1a6dd1d6 Part 2 of RuntimeTarget
Introducing ExtensionIRNode and an implementation of templates based on
the new feature set.

Now TemplateIRNode is-a ExtensionIRNode. It's implemented using just
extensibility and isn't part of the standard razor codegen. I'm adding it
to the RazorEngine so that it's still there by default.

I've also included a pattern for visitors to special case
ExtensionIRNode-derived classes that they know about. This requires a
little bit of boilerplate but makes it easy to traverse just the nodes you
care about while keeping the set of nodes open.

For now the general codegen feature still hasn't had a refactor, but this
opens things up for us to start finishing things like MVC's @inject
directive.
2017-02-15 18:08:19 -08:00
Ajay Bhargav Baaskaran 4b2245eeb9 [Fixes #924] Correct RightShiftAssign operator 2017-02-15 16:31:40 -08:00
Nate McMaster 4fd441ae35 Temporarily disable tests on .NET Core that rely on .NET Core 2.0 API 2017-02-15 10:04:59 -08:00
Nate McMaster 279855d947
Downgrade to stable packages 2017-02-14 16:15:35 -08:00
Ajay Bhargav Baaskaran 8ac5468714 Refactor IR phases
- Added DirectiveRemovalIRPass
 - Added IRazorDocumentClassifierPhase, IRazorDirectiveClassifierPhase and
   IRazorIROptimizationPhase
 - Added all the related passes and default implementations
 - Refactored DefaultDirectiveIRPass to do the right thing
 - Execute method in IR passes now return void
 - Added tests for the new phases
2017-02-14 14:51:36 -08:00
Pranav K 80172c641d Fix building the vsix inside VS 2017-02-14 12:55:43 -08:00
Doug Bunting 4861ef3391 Bump test projects up to .NET 4.5.2
- aspnet/Testing#248
- xUnit no longer supports .NET 4.5.1
- build tests for desktop .NET only on Windows
2017-02-14 08:48:29 -08:00
Ryan Nowak 0dbf62196c Introduces RuntimeTarget and abstraction for APIs
This is a new abstraction that represents the api surface available for
codegen to target. Every kind of document should have an associated
RuntimeTarget or just use the default.

To prevent breakage, our DocumentClassifierBase class will provide a
default API set to implementors (like MVC).

I haven't fundamentally changed how codegen is done yet, I've just hidden
it behind a new abstraction. The RuntimeTarget now is also responsible for
selecting between design time and runtime.

The bulk of the noise here is from splitting a lot of the codegen stuff
into its own files.
2017-02-13 15:34:51 -08:00
N. Taylor Mullen f861c23d1f Allow RazorSourceDocument to consume empty streams.
- Added tests to validate how encoding flows when used with empty streams in addition to their usability (not throwing).

#947
2017-02-13 12:11:38 -08:00
Ryan Nowak d72cd469bd Add CodeAnalysis.Razor to the vsix
Also adds some error handling so you can know if something went wrong.
2017-02-10 13:02:52 -08:00
Ryan Nowak 62420209a5 Fix a failing test 2017-02-09 16:19:34 -08:00
Ryan Nowak ea778b9b6d Implement a simple base for document classifiers
This should allow us to de-dupe a lot of code in MVC.
2017-02-09 15:22:33 -08:00
Nate McMaster eaadfb70eb Create NoVSIX solution configurations 2017-02-09 14:04:49 -08:00
Ajay Bhargav Baaskaran 260b869a07 Remove DirectiveIRNode from the IR document after the default directive classifier has run 2017-02-09 12:56:58 -08:00
Ajay Bhargav Baaskaran 02675da467 Handle single line directives properly 2017-02-08 13:41:27 -08:00
Pranav K d293547f24 Adding more tests 2017-02-08 11:17:43 -08:00
Pranav K 8b764c57e4 Parse string directive tokens correctly 2017-02-08 11:17:43 -08:00
Pranav K 2eba53de1b Add support for optional directives 2017-02-07 19:20:49 -08:00
N. Taylor Mullen 6d18c3e85a React to removal of DirectiveTokenDescriptor.Value. 2017-02-07 10:20:25 -08:00
Ajay Bhargav Baaskaran adf18d4810 Make LineMapping public 2017-02-03 15:50:34 -08:00
N. Taylor Mullen 3f5d1bb2d6 Remove literal directive tokens.
- Literal directive tokens acted as a way for a user to provide markup bits to be required when parsing a directive.
- Removed source implementations.
- Removed tests validating the feature.

#969
2017-02-03 12:02:16 -08:00
Pranav K a801a49377 Add an API to RazorProject to navigate hierarchical files
Fixes #962
2017-02-03 11:25:15 -08:00
Pranav K 8a4d8c0b59 Simplify packing 2017-02-02 12:57:18 -08:00
Pranav K 74beba7a63 Don't restore for vsix on xplat 2017-02-01 17:13:01 -08:00
N. Taylor Mullen c49d7b8c27 Add support for new style Roslyn dotless commits.
- Roslyn swapped the way they performed dotless commit insertions. They went from:
date => date. => DateTime.  to
date => date. => date => DateTime => DateTime.
The problem with the new approach is that date => DateTime would be rejected and therefore force the editor to reparse and reclassify any dots as HTML giving improper IntelliSense.
- Updated Razor implicit expression edit handling to allow identifier => identifier replacements as long as the identifiers didn't result in keyword or directives.
- Added tests to verify the scenarios impacted.
2017-02-01 15:43:08 -08:00
Ajay Bhargav Baaskaran 7af2f6ff36 [Fixes #961] Disable instrumentation for TagHelper attribute values 2017-02-01 15:26:13 -08:00
Ryan Nowak e549270b4a Add RazorDiagnostic type
This is a replacement for RazorError, is conceptually equivalent with
Diagnostic from Roslyn.

The next PR will start exposing this through our public API rather than
the legacy type.
2017-01-31 15:53:22 -08:00
Ajay Bhargav Baaskaran 406522d14b [Fixes #958] Added support for AddTagHelper, RemoveTagHelper and TagHelperPrefix directives 2017-01-30 15:40:05 -08:00
Ryan Nowak 93981ab13e Update codegen to be compatible with MVC 2017-01-27 16:47:33 -08:00
Ryan Nowak 25831260f7 Make CodeWrite public 2017-01-27 16:38:13 -08:00
Ryan Nowak 2b2cf6efec Correct an issue with codegen for taghelperprefix
The issue here is that when a taghelper prefix is in use it will be
including in the HTML output, when it should be chopped off.

See the diff in the codegen for examples.
2017-01-27 11:13:46 -08:00
Ryan Nowak d187edbd76 Use the TagHelperBinder to dedupe taghelpers
This change does deduplication of taghelpers during the binding/rewriting
phase. This is needed when a taghelper has multiple sets of html
attributes that are required (behaves like an OR). This is used lots in
MVC.

The old codebase used to do this in the codegen phase, but it seems
beneficial to do as early as possible.
2017-01-26 15:36:42 -08:00
Ajay Bhargav Baaskaran 98d5d1c70e Flow parser errors over to the CSharpDocument 2017-01-26 15:32:03 -08:00
Ryan Nowak 0bf9abbedf Hardcoding the right value for MVC 2017-01-26 13:39:55 -08:00
Ryan Nowak 6a95002f0e Fix lowering of taghelpers inside a section
The IR lowering phase was attaching the 'tag helper fields' node to the
builder instead of to the top-level node (document). This meant that
things wouldn't be where we expect when the first tag helper occurrence is
inside a directive block (section).

Found this porting MVC to use the new Razor codebase.
2017-01-26 13:06:06 -08:00
Ajay Bhargav Baaskaran 7725c20c47 Enabled Razor.Evolution tests on linux 2017-01-26 12:34:35 -08:00
Ryan Nowak 243446d225 Quick fix for MVC. Hardcoding fullname of HelperResult. 2017-01-26 10:37:52 -08:00
Ryan Nowak 9df4674ee5 Make property attributes public in IR 2017-01-26 09:13:04 -08:00