Commit Graph

22 Commits

Author SHA1 Message Date
Nate McMaster 5856517be7 Remove workaround from test csproj files 2017-05-15 12:52:58 -07:00
N. Taylor Mullen 3830a1b7ac Rename the BoundAttributeDescriptor builder.
- ITagHelperBoundAttributeDescriptor => TagHelperBoundAttributeDescriptorBuilder

#1306
2017-05-12 17:39:45 -07:00
Nate McMaster 682d630fa2 Upgrade test framework versions and fix issues with tests 2017-05-12 15:41:49 -07:00
Ryan Nowak 3969c23316 Adds a tracking system for Razor documents
This is a MEF service that can actively or passively track open ITextViews
and give us information about the Razor initialization state and eventing
when it changes.

The purpose of this is to act as a bridge between the VS mef world and the
roslyn world.

For now this doesn't do any passive tracking of Razor documents, it's only
on demand. That means it will only be initialized and used right now when
you are using the Razor developer tools. This is just to reduce our risk,
it's not ideal to ship code in VS that's doing something without anyone
looking at the result.
2017-05-11 08:24:37 -07:00
N. Taylor Mullen 51fb1b787a Add TagHelperFactsServiceTest to validate root with parent expecting descriptor.
#1253
2017-05-10 16:33:19 -07:00
N. Taylor Mullen 1795fc26c1 Add AttributeCompletion API.
- Added a `GetAttributeCompletions` API that's consistent with current Razor's editor expectations.
- Added unit tests to validate all code paths of the new `GetAttributeCompletions` method.

#1120
2017-05-05 11:57:31 -07:00
N. Taylor Mullen 1696e2aebf Upgrade Razor's Roslyn dependency to 2.0.0.
- Added C# 7 test to validate questionable features work end-to-end.
- Had to add several explicit package references to let our VS specific packages work as expected.

#1046
2017-04-21 11:40:21 -07:00
N. Taylor Mullen d273c6cd4c Ensure output hint descriptors don't schema check.
- Prior to this if you had a `TagHelper` whos output hint was not in the final form of the completions we'd fall through into a schema check which resulted in a completion being added when it shouldn't. Example: `TagHelper` for `my-tr` that has an output hint of `tr` would end up getting added to the completion list under `body` because `my-tr` was not in the schema and would then be treated like the `environment` `TagHelper` (a new element).
- Added a test to validate that `TagHelper`s with output hints are cross referenced vs. existing completions and do not fall through to a schema check.

#1225
2017-04-14 12:14:52 -07:00
N. Taylor Mullen cf44f103c1 Prefix TagHelpers with tag helper prefix in completion list.
- We don't want tooling applying tag helper prefix to what we deem `TagHelper`s. Ultimately we should consume all the necessary data and do that work.
- Added two tests to validate that we're applying tag helper prefix to `TagHelper` element completions for catch-all's and non-catch-alls.

#1224
2017-04-14 11:40:28 -07:00
N. Taylor Mullen 46a5ca972f Allow catch-all THDs to apply to all completions.
- Prior to this catch-alls were explicitly ignored not to populate the IntelliSense with an excess amount of `TagHelper`s. To maintain backwards compatible expectations this commit reverts that expectation.
- Scoped an existing test to only test its primary scenario.
- Added a new test to verify that catch-alls accurately apply to all completions (including dynamically added ones).

#1219
2017-04-13 23:35:59 -07:00
N. Taylor Mullen a1cfd22a32 Add element completion API for TagHelpers.
- Added a new `TagHelperCompletionService` which can be queried for information on what completion information should be provided.
- Added tests to validate the completion service's expectations.
- Fixed an issue where `TagHelper`s with output hints that did not exist in a passed in completion would never be highlighted as `TagHelper`'s; even when their primary targeting element was already in the element completion list.

#1181
2017-04-12 14:31:11 -07:00
N. Taylor Mullen 1b8a4e704c Rename ITagHelperDescriptorBuilder => TagHelperDescriptorBuilder.
#1210
2017-04-11 17:08:38 -07:00
N. Taylor Mullen 0618bae3bd Rename Microsoft.AspNetCore.Razor.Evolution => Microsoft.AspNetCore.Razor.Language.
- Also updated corresponding test project to go from Evolution => Language.
- Regenerated test files to reflect new file paths.

#1169
2017-04-10 10:20:04 -07:00
N. Taylor Mullen 96d97f65e9 Allow null parent tag when calling `GetTagHelpersGivenParent`.
- A `null` parent tag in all of our other API represents "any" parent tag, or in this case "root". Prior to this change we'd expect the caller to do their own verification of the parent and then assume all `TagHelperDescriptor`s are valid; this isn't sufficient because only our code base should have that knowledge.

#1188
2017-04-06 17:02:06 -07:00
N. Taylor Mullen af3cf497a6 Update TagHelperMatchingConventions to disallow opt-out prefix.
- Prior to this change the `TagHelper` parsing would strip the opt-out character (`!`) from tag names that got passed to the TagHelper matching services. At design time this proved to be a problem because they have their own understanding of the HTML document and only pass us full tag names (names that include `!`). This changes the matching conventions to immediately return false if a tag name is seen to contain the `TagHelper` opt-out.
- Added two `DefaultTagHelperFactService` tests to verify that tag names with opt-out prefixes are denied `TagHelperDescriptor`s.

#1186
2017-04-06 16:10:35 -07:00
N. Taylor Mullen 385531f11a Workaround issues preventing tests from running in Visual Studio.
#1139
2017-03-31 11:20:10 -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
Pranav K 2ea0659e60 Change compilation targets.
* Remove net451 as a compilation target
* Upgrade to netcoreapp2.0
2017-03-24 07:49:34 -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
Nate McMaster 43a41398ac Unify dependency versions to one file 2017-03-15 16:44:00 -07: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