Commit Graph

62 Commits

Author SHA1 Message Date
N. Taylor Mullen 6c8286eed7 Split LanguageServices.Razor.
- Created a new `Microsoft.VisualStudio.Editor.Razor` assembly to contain Visual Studio platform agnostic info.
- Added a new `Microsoft.VisualStudio.Editor.Razor.Test.Common` project to be the centerfold for all VisualStudio agnostic test pieces.
- Added a `Microsoft.VisualStudio.Editor.Razor.Test` project and pulled in LanguageService test files into the the Editor.Razor.Test project to correspond to their movement in the src project.

#1690
2017-09-29 16:26:50 -07:00
Ryan Nowak f23ff9452c [Design] Create Template engine from project snapshot 2017-09-19 12:54:55 -07:00
Ryan Nowak 6e6a24cbb4 Add a background listener for notifications
This change adds an actual background worker for listening to project
change notifications and starts sending updates when the project's razor
dependencies change.

I had to do a litle surgery to get things working. There were plenty of
small bug fixes.

Additionally I got rid of the WeakReferences for tracking listeners. I
was seeing TextBuffers hanging around in VS longer than I expected and
the WeakReferences weren't getting cleaned up. I think it's better that
we just track the lifetime.
2017-09-18 16:56:53 -07:00
Ryan Nowak 7a0abc3f67 Add test for #1684 2017-09-15 12:07:11 -07:00
Ryan Nowak 82866d9442 Refactor project snapshot manager
Splits the 'trigger' out from the change manager. The next change will
add more functionality to DPSMBase.
2017-09-08 08:11:58 -07:00
Ryan Nowak 5ee4c8ec4d Add [ForegroundTheory] 2017-09-07 13:06:55 -07:00
N. Taylor Mullen 67f255adca Change completion provider to be lazy if not Razor.
#1672
2017-09-06 12:56:11 -07:00
N. Taylor Mullen 61260ddf1c Add basic Razor directive completion.
- Added APIs to retrieve an `ITextBuffer` from a `Document` and to retrieve a `RazorCodeDocument` from an `ITextBuffer`.
- The `RazorCodeDocument` from `ITextBuffer` API supports both the new and old Razor parsers so we can transition seamlessly between the two.
- Added logic in the `RazorDirectiveCompletionProvider` to consume descriptions from `DirectiveDescriptor`s. This is then surfaced via tooltips.
- Retrieved currently active `RazorCodeDocument` given a Roslyn buffer and harvested all directives to display in the completion list.
- Added unit tests to validate each new services functionality.

#291
2017-09-05 10:08:31 -07:00
Ryan Nowak ae925049bb Add an example 2017-08-30 17:06:26 -07:00
Ryan Nowak 9dfe2a0a81 PR feedback 2017-08-30 16:39:12 -07:00
Ryan Nowak d8431067a5 Add TaskSchedulers to the dispatcher abstraction 2017-08-30 16:35:30 -07:00
Ryan Nowak c94c110de3 Move dispatcher to workspaces. 2017-08-30 16:35:29 -07:00
Ryan Nowak f3fecabe04 Bump Roslyn to a 2.6.0 build
Fixes #1654
2017-08-30 15:30:57 -07:00
Ajay Bhargav Baaskaran 5cb11b9bf4 Implmement a project system for Razor 2017-08-30 12:58:38 -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
N. Taylor Mullen 347e4158fb Skipped flakey tests.
- Instead of utilizing ConditionalFact's we're silently skipping these tests to avoid the mass warnings you get otherwise.
2017-08-25 15:30:29 -07:00
Ryan Nowak a9a86fa3bf Add foreground dispatcher 2017-08-24 11:11:25 -07:00
Ryan Nowak d87e0f7fbd Fixes #1632 - track textviews in the document tracker
I've stripped out some of the dead code and complexity from the document
tracker in an attempt to simplify it. I will bring this back as part of
the multi-targeting work.
2017-08-24 10:47:33 -07:00
N. Taylor Mullen 8b4fc0cef6 Take control of VisualStudioRazorParser reparse test mechanics.
#1644
2017-08-24 10:42:12 -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 24154ec4c2 Create a VisualStudio parser to handle the editing loop.
- Renamed `RazorEditorParser` => `VisualStudioRazorParser` (maintained a copy of the original in Legacy)
- Tried to make as little changes as possible to the `BackgroundParser` due to its complexity; mostly just removed the TreeStructureChanged logic since this is re-done on the Razor editor side of things.
- Split the `RazorEditorParserTest`s into two separate tests. Partial parser tests and the VS parsing tests.
- Updated `StringTextSnapshot` to support changes in order to test the VS parser.

#1536
2017-08-23 11:38:11 -07:00
Ajay Bhargav Baaskaran d726be6dd1 Removed duplicate extension methods 2017-08-17 16:40:13 -07:00
Ajay Bhargav Baaskaran 4fe07f2298 Added unit tests for DefaultTemplateEngineFactoryService 2017-08-09 12:31:51 -07:00
N. Taylor Mullen aa980fc67c Roslyn-ize our tooling contracts.
- Added `ILanguageServiceFactory` types for all serviceable contracts.
- Maintained binary compatibility by copy/pasting existing services into a Legacy folder.
- Added a Workspaces.Test project since their implementations moved.
- Updated binary incompatible version of `RazorSyntaxFactsService` to not depend on VisualStudio. Added an extension type to the VS.LanguageServices.Razor project to enable easy-access from VisualStudio.

Below on refers to the binary incompatible copies.
Core services that were **entirely** moved from VisualStudio.Razor => Razor.Workspaces are as follows:
- `RazorSyntaxFactsService`, this included mutating the API to not depend on VisualStudio and moving some primitive types such as `AcceptedCharacters`.
- `TagHelperCompletionService`
- `TagHelperFactsService`
These all have a `ServiceLayer` of `Editor`.

Bits that were partially moved:
- `RazorTemplateEngineFactoryService`. The Default implementation and its corresponding factory still live in VisualStudio.Razor. This way Razor.Workspaces can get by without a reference to Mvc.Razor.Extensions.
- `ITagHelperResolver` used to exist in VisualStudio.Razor. Removed the type and replaced its usage with the already-existing `TagHelperResolver` type in Razor.Workspaces. Both contracts were nearly identical.
These all have a `ServiceLayer` of `Default`.

#1260
2017-08-02 16:58:44 -07:00
Mike Harder 35c8da94bf Temporarily disable package downgrade warnings (#1576)
- Revert when RoslynDevVersion >= RoslynVersion
2017-07-20 13:13:04 -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
N. Taylor Mullen 4654997201 Add AllowedChildTagDescriptor.
- Changed the `AllowedChildTags` collection on `TagHelperDescriptor` to have a custom object type to represent child tags.
- Created comparers and builders to work with the child tag descriptor.
- Removed the validation methods on `TagHelperDescriptorBuilder` since there's no longer any bits to validate (they're contained within the sub-properties).
- Unit tested the `DisplayName`.

#1493
2017-07-03 11:04:10 -07:00
Ryan Brandenburg f5c55727a4 Remove AssetTargetFallback 2017-06-30 14:42:00 -07:00
Ajay Bhargav Baaskaran 9c031e6fb5 Moved all TagHelperDescriptor related builders to have getter setter
instead of methods

More polish to the tag helper descriptor builders.
- Expose underlying builders as getter only list
- Added AsDictionary() extension method to BoundAttributeDescriptorBuilder
- Expose diagnostics as RazorDiagnosticCollection
- Got rid of Require** prefix in TagMatchingRuleBuilder
- Workaround issue aspnet/Razor#1492 by copying the test descriptor
  extensions
2017-06-30 14:08:05 -07:00
Ajay Bhargav Baaskaran 34e3c249e4 Remove Test.Common dependency from LanguageServices.Razor.Test 2017-06-30 10:42:24 -07:00
Ajay Bhargav Baaskaran 7c7bb627b9 Moved typename and propertyname to extension methods 2017-06-29 16:47:53 -07:00
Ryan Brandenburg 511c7db541 Remove NetStandard.Library.NETFramework and Update Moq 2017-06-29 10:17:45 -07:00
Ryan Nowak 853b458893 This is a different take on Taylor's builders.
This makes it possible to use another 'kind' of tag helpers, which isn't
possible today.

This also further decouples the tag helper api surface from the default
implementation.

VCTH now have their own 'kind'.

Also improved generation of display names and error messages where it
was coupled to the type name.
2017-06-28 17:37:52 -07:00
Kiran Challa dea8948249 Merge branch 'rel/2.0.0-preview2' into dev-gate
# Conflicts:
#	build/dependencies.props
#	test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj
#	test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj
2017-06-15 04:23:55 -07:00
Mike Harder 5eea3f50c5 Changed all references of PackageTargetFallback to AssetTargetFallback (#1441) 2017-06-14 15:16:56 -07:00
Nate McMaster 4d18334573 Target .NET Standard 2.0 2017-06-08 16:37:27 -07:00
N. Taylor Mullen ebe8ab4612 Rename TagHelperBoundAttributeDescriptorBuilder => BoundAttributeDescriptorBuilder.
#1369
2017-05-19 12:44:07 -07:00
Ryan Nowak 94aaa3db9e Configure xunit for better display 2017-05-17 20:31:37 -07:00
N. Taylor Mullen 8616cf5dd0 Reduce catch all element completion usage.
- This makes it so if you have catch all `TagHelperDescriptor`s their completions don't apply to every existing completion. Instead, they now only apply to already TagHelperified completions and existing completions that are prefixed with a non-empty TagHelperPrefix.
- Updated existing test to have new expectations.
- Added new test to validate non-empty tag helper prefix case.

#1230
2017-05-16 11:06:05 -07:00
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