- 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
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.
- 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
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.
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.
- 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
- 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
- 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
- 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
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
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.
- 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
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.
- 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
- 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
- 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
- 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
- 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