Commit Graph

547 Commits

Author SHA1 Message Date
Ryan Nowak 3ec4e244db Cleanup around ViewImports
Added a default for the imports filename.

Deleted unused test files
2017-04-03 20:23:02 -07:00
Ajay Bhargav Baaskaran 4dbf6f23c3 Moved TagHelperIRNode, InitializeTagHelperStructureIRNode from renderer to writer 2017-04-03 19:57:51 -07:00
Ajay Bhargav Baaskaran 7d8bd29724 Moved DeclareTagHelperFields from renderer to writer 2017-04-03 15:54:35 -07:00
N. Taylor Mullen cb5c483a1d Add line mappings for using directives.
- We were generating line pragmas for using directives but not line mappings. This resulted in 0 IntelliSense when written within the Razor editor.
- Regenerated test files to reflect new line mappings.

#1162
2017-04-03 15:18:49 -07:00
N. Taylor Mullen 0e15ff3e95 Re-add marker IR tokens to represent CSharp in an expression.
- At design time we weren't generating line mappings when a user would type `@` or `@(`. This results in no C# IntelliSense being provided to the user because the editor hasn't mapped any of Razor to the C# buffer.
- Modified the `DefaultIRLoweringPhase` to allow for marker symbols, these symbols .
- Re-generated test files to account for 0 length line mappings on empty expression nodes.

#1155
2017-04-03 13:05:54 -07:00
N. Taylor Mullen d4e21ae706 Revert "Generate line mappings for empty expressions."
This reverts commit 4c0afbad86.
2017-04-03 13:05:54 -07:00
N. Taylor Mullen 4c0afbad86 Generate line mappings for empty expressions.
- At design time we weren't generating line mappings when a user would type `@` or `@(`. This results in no C# IntelliSense being provided to the user because the editor hasn't mapped any of Razor to the C# buffer.
- Updated the design time renderer and design time writer to account for empty expressions.
- Modified the `DefaultIRLoweringPhase` to set source locations on empty expression nodes.
- Re-generated test files to account for 0 length line mappings on empty expression nodes.

#1155
2017-04-02 22:25:12 -07:00
Ajay Bhargav Baaskaran 660db5b733 Merge branch 'ajbaaska/writer' into dev 2017-03-31 16:30:11 -07:00
Ajay Bhargav Baaskaran da1e4130d2 Moved from Renderer to Writer 2017-03-31 16:25:07 -07:00
Ajay Bhargav Baaskaran a74cda4402 Setting TokenKind for RazorIRToken 2017-03-31 14:52:10 -07:00
N. Taylor Mullen 385531f11a Workaround issues preventing tests from running in Visual Studio.
#1139
2017-03-31 11:20:10 -07:00
Ajay Bhargav Baaskaran bc347d736f [Fixes #964] Removed Content property from CSharpStatementIRNode 2017-03-31 10:52:53 -07:00
Pranav K 209729332c Add GetImportItems to RazorTemplateEngine
Fixes #1109
2017-03-31 07:48:34 -07:00
N. Taylor Mullen dd9eab551d Workaround tooling issue with runtime only TagHelpers.
- Prior to this if all instances of `TagHelper`s in an assembly had editor browsable never we'd log an error saying that no TagHelpers were found for that assembly. Until we can evaluate a better fix for this issue I've removed the logic that logs those errors and its corresponding tests/resources.

#1145
2017-03-29 16:56:05 -07:00
N. Taylor Mullen fdea42624d Fix UrlResolutionTagHelper tag helper inclusion.
- Also fixed test name to assert all defaultly included TagHelpers instead of just the UrlResolutionTagHelper
2017-03-29 16:30:28 -07:00
Ryan Brandenburg 60a87829f8 Fix type name 2017-03-29 16:19:12 -07:00
N. Taylor Mullen 22c7c90b5a Add `TagHelperFactsService`.
- Add API to enable the editor to query information on the state of `TagHelper`s within a Razor document.
- Refactored methods from `TagHelperDescriptorProvider` to be in a `TagHelperDescriptorConventions` class so the language service could use them.
- Added `DefaultTagHelperFactService` tests.

#1120
2017-03-29 15:36:32 -07:00
Ajay Bhargav Baaskaran c1500da2a8 Don't render directive token from imports in design time 2017-03-29 15:08:11 -07:00
Jass Bagga 582ffe2e10 Add HeadTagHelper and BodyTagHelper
Addresses aspnet/Mvc#5728
2017-03-29 12:23:55 -07:00
Ajay Bhargav Baaskaran 0b5113c76e Suppress compilation errors for TModel in imports 2017-03-29 11:42:13 -07:00
Ryan Nowak 737a9a58ad Fix breaks in Razor Tests
I removed a reference from a src project which exposed this issue. We
shouldn't be using these types in new Razor.
2017-03-27 14:32:30 -07:00
Ajay Bhargav Baaskaran ed8425800a Revert: Don't generate CSharpStatementIRNode for whitespace 2017-03-27 12:45:49 -07:00
Ajay Bhargav Baaskaran 5928d0d54b Don't generate CSharpStatementIRNode for null or whitespace 2017-03-24 17:54:09 -07:00
Ryan Nowak 1683018d71 Add a static 'register' method to MVC's extensions
This will be called by the IDE, and by MVC to register all of the
functionality in Microsoft.AspNet.Mvc.Razor.Extensions.
2017-03-24 15:56:32 -07:00
Ryan Nowak 565dd30957 Make the parser options configurable
The RazorParserOptions were only configurable via an internal interface
and an extension method on the builder. This isn't suitable for VS because
we need to be able to update the configuration while the editor is open,
without creating a new engine.
2017-03-24 15:21:26 -07:00
Ryan Brandenburg b4640f8bb8 Use AspNetCore.Mvc.RazorPages 2017-03-24 13:08:07 -07:00
N. Taylor Mullen 0fa79818e1 Add DisplayName to RequiredAttributeDescriptor.
- When `RequiredAttributeDescriptor`s are displayed in an editor their display name differs based on their name comparison mode. If their name comparison mode happens to be a prefix match then we need to append three dots to indicate that it's a required prefix for an attribute.
- Added a new descriptor builder test to validate `DisplayName` is created correctly.

#1119
2017-03-24 11:07:52 -07:00
Pranav K 2ea0659e60 Change compilation targets.
* Remove net451 as a compilation target
* Upgrade to netcoreapp2.0
2017-03-24 07:49:34 -07:00
Ajay Bhargav Baaskaran ae34e14358 Don't generate line mappings for imports 2017-03-23 10:39:07 -07:00
N. Taylor Mullen c07759996f Fix absolute path handling.
- Normalize paths to be absolute and to also use forward slashes.
- Updated our `EnsureValidPath` method to be `NormalizeAndEnsureValidPath`.
- Added tests to validate new `NormalizeAndEnsureValidPath`.
- Updated existing tests to react to `NormalizeAndEnsureValidPath` correctly.

#1106
2017-03-22 16:35:19 -07:00
Ryan Brandenburg 72febdac64 Move Razor.Host to Razor 2017-03-22 16:10:44 -07:00
Ajay Bhargav Baaskaran cab6eea663 Set file path from RazorSourceDocument in syntax tree 2017-03-22 15:13:38 -07:00
Ajay Bhargav Baaskaran c6a35e7b26 Added HasIndexer property to BoundAttributeDescriptor 2017-03-21 16:18:31 -07:00
Stefan Nikolei 319c535224 Remove RazorIrNodeVisitorOfT (#1089) 2017-03-20 14:51:51 -07:00
Ajay Bhargav Baaskaran 4a71b1d57d [Fixes #980] Generate parser error for unquoted string token directives 2017-03-20 11:58:55 -07:00
Ryan Nowak bbd08f0cc9 Add TagHelper directive and match info to CodeDocument 2017-03-19 12:33:09 -07:00
Ryan Nowak acbbdf0b2c Rename BlockType -> BlockKind
Also moved BlockKind and SpanKind out of .Legacy
2017-03-19 11:18:40 -07:00
Ryan Brandenburg a7eb30ddca Remove old razor 2017-03-17 14:58:13 -07:00
N. Taylor Mullen 8f9ff1abd9 Clean up TagHelperDescriptor APIs.
- Removed all design time descriptors and put their API surface into their corresponding descriptor. Part of removing the design time API surface was removing the tracking of `<Remarks>`, it wasn't used so there's on need to track it until we need it.
- Removed the Type requirement from `TagHelperDescriptor`. With this separation we'll be able to have abstract `TagHelper`s that aren't based on a class implementation.
- Removed Prefix from the `TagHelperDescriptor` API surface. It was a legacy requirement based on how the Razor parser was put together. We can work around this now.
- Stripped correlation information from the immediate `TagHelperDescriptor` API surface. Instead this information is now tracked in `TagMatchingRule`s. This change means that you will not have multiple `TagHelperDescriptor`s per `TagHelper`; instead it's all tracked in a single descriptor. A side effect of this change was the transformation of `IsIndexer` => 3 new properties.
- Renamed many descriptor types and property names.
- Added builder APIs to construct TagHelpers since they're inherently immutable in their API surface.
- Added `ITagHelperDescriptorBuilder` to represent `TagHelper`s that are built from an `ITagHelper` implementing class. It re-introduces the `TypeName` association of a `TagHelper`.
- Added `ITagHelperBoundAttributeDescriptorBuilder` to represent that an attribute was associated with a property.
- Added validation methods to the descriptor builders to enable consumers to validate the current state of the builder and add diagnostics as necessary.
- Moved descriptors away from RazorError.
- Updated the various comparers to understand the descriptors new API.
- Added a new `RazorDiagnosticFactory` abstraction to handle `RazorDiagnostic`s and their corresponding errors/ids etc. This new API should allow for easy addition of new `RazorDiagnostic` errors.
- Updated the `DefaultTagHelperDescriptorFactory` to construct `TagHelperDescriptor`s using the new builder APIs and in the new descriptor format (1 descriptor per type).
- Updated `ViewComponentTagHelperDescriptorFactory` to construct `TagHelperDescriptor`s with the builder API.
- With both factory implementations code was duplicated because the ViewComponent work will be moving outside of Razor once we have the proper hooks.
- Updated `TagHelper` binding bits to capture a binding result in order to query which rules appy to a given tag name.
Addressed feedback
- Update tests to react to new `TagHelperDescriptor` API.
- Remove case sensitive comparers and some cleanup
- Added TagHelperDescriptorJsonConverter, RazorDiagnosticJsonConverter and added serialization tests
2017-03-17 12:18:05 -07:00
Ryan Nowak 90b48347a5 Port the legacy RazorEditorParser 2017-03-16 12:47:29 -07:00
Nate McMaster 9b3e8d0cda React to aspnet/Testing#259 2017-03-16 09:31:55 -07:00
Nate McMaster 43a41398ac Unify dependency versions to one file 2017-03-15 16:44:00 -07:00
Ajay Bhargav Baaskaran 310ccc31d0 Include default imports when ImportsFileName is null 2017-03-14 19:33:18 -07:00
Pranav K 2fc88fe9c1 Add support for base path in FindHiearchicalItems
Required for https://github.com/aspnet/Mvc/issues/5915
2017-03-13 11:15:11 -07:00
Pranav K 7d43bfc709 Add RazorSourceDocument.Create(string template)
Add document and fix casing of RazorSourceDocument.FileName
Fixes #1063
2017-03-13 09:44:06 -07:00
Jass Bagga a418a175a9 Add TagName to TagHelperContext
Addresses #1065
2017-03-09 14:59:11 -08:00
Pranav K a034b2ed04 Collate diagnositcs from Imports 2017-03-08 18:29:17 -08:00
Ryan Nowak 871f9e43ca Update versions of VS and Roslyn 2.0.0 dependencies
VS has gone RTM so, updating to the RTM versions of those dependencies.

Roslyn does not publish our shim packages on NuGet.org, so updating those
to a non-ancient version for projects that use 2.0.0. The projects that
use 1.3.x are staying put for now.

The code change is dealing with something that was obsoleted.
2017-03-08 08:57:49 -08:00
Ryan Nowak 9a27405718 Add LanguageServices test project 2017-03-06 17:55:00 -08:00
Yves57 dee8d8694f Prevent LOH allocations when constructing large Razor Source Documents. (#1049)
* Prevent LOH allocations when constructing large Razor Source Documents.

* Feedback
2017-03-06 16:50:05 -08:00