Commit Graph

80 Commits

Author SHA1 Message Date
N. Taylor Mullen f025a27f04 Unify how AdhocWorkspace is constructed.
- Created a new `TestWorkspace` type to lock on `AdhocWorkspace` construction. This type can't be constructed/changed in parallel.
- Updated test usages of `AdhocWorkspace` to make use of `TestWorkspace`.
- Added a `Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common` project to have the `TestWorkspace` type.

#1913
2018-01-12 17:54:53 -08:00
Ajay Bhargav Baaskaran 34fe4099c2 Removed LegacyRazorDiagnostic and RazorError 2017-12-27 11:43:19 -08:00
N. Taylor Mullen 4b93741610 Add Mac project build change trigger.
- Added a Mac specific implementation of the project build change trigger. It applies to all types of project builds so we need to do a little extra filtering to ensure that we're not operating on a non-ASP.NET Core project.
- Added tests to validate that the project build event fires correctly.

#1851
2017-12-18 17:23:43 -08:00
N. Taylor Mullen 1aff9d0031 Make RazorEditorFactoryService VS agnostic.
- Moved the editor factory service into the Editor dll. It did not have any windows specific functionality within it.

#1789
2017-12-13 17:11:48 -08:00
N. Taylor Mullen b73c50be41 Add Mac implementation of FileChangeTracker.
- Added a LanguageServices Mac test project.
- Added a few tests for the new `DefaultFileChangeTracker`. There's currently an issue with the MonoDevelop.Core binaries we're compiling against which doesn't allow me to unit test other pieces of the class (they depend on instantiating mono develop objects).
- Added IVT from product projects to new mac testing project.

#1789
2017-12-12 15:47:16 -08:00
N. Taylor Mullen 4476a72ecf Refactor `ImportDocumentManager` to not be windows specific.
- Added a `FileChangeTracker`, `FileChangeTrackerFactory` and corresponding implementations. These types now enable us to implement Windows and Mac file change tracking instead of replacing the entire import manager.
- Changed the import manager to be a Roslyn based service.
- Moved import manager implementation to the editor.razor assembly now since it no longer depends on windows.
- Updated import manager unit tests.
- Added import manager integration test
- Added file change tracking tests.

#1804
2017-12-08 16:34:43 -08:00
Ajay Bhargav Baaskaran 8abbaa46cc Added imports tracking to TagHelper project system
- #1744
2017-12-01 16:54:36 -08:00
N. Taylor Mullen b6fb9bda50 Remove flaky, already tested test.
- This test was flaky due to the nature of what it was testing and had negative value due to the testing complexities. In the integration test pieces (running VS) this is already tested thoroughly.
2017-11-30 10:41:26 -08:00
N. Taylor Mullen 182714c324 Move away from WPF text view connection listener.
- Had to add a new NuGet feed to access latest VS bits.
- Updated tests to react to new ITextViewConnectionListener.

#1735
2017-11-28 10:42:35 -08:00
Ajay Bhargav Baaskaran 0a76ad7017 Added TagHelper discovery to Razor project systen 2017-11-22 10:56:52 -08:00
Ajay Bhargav Baaskaran 90120f6a3b Added necessary infrastructure for Tag helper project system imports
tracking
2017-11-22 08:48:57 -08:00
N. Taylor Mullen 4f7aab7720 Prevent Razor Core from running in non-core scenarios.
- Also added tests.

#1776
2017-11-16 16:23:24 -08:00
N. Taylor Mullen 44b4bf6bc6 Cleanup legacy and unintentionally public bits.
- Made `RazorTemplateEngineFactoryService`, `TagHelperResolver`, `RazorDiagnosticJsonConverter` and `RazorLanguageServiceException` internal.
- Deleted all items in the Legacy folder in VisualStudio.LanguageServices.Razor and `RazorLanguageServiceException`.

#1762
2017-11-14 15:42:40 -08:00
N. Taylor Mullen 44a47182b2 Add EditorSettingsManager as an exported MEF component.
- Internalized the core implementation of `EditorSettingsManagerInternal`.
- Added a `VisualStudioWorkspaceAccessor` to enable the `Microsoft.VisualStudio.Editor.Razor` project to have access to the current workspace. Only added the Windows specific implementation of this type since the VS for mac implementation will require infrastructural work to make happen.

#1762
2017-11-14 15:42:40 -08:00
Nate McMaster 4d737af167 Pin tool and package versions to make builds more repeatable
Part of aspnet/Universe#575
2017-11-01 18:12:08 -07:00
N. Taylor Mullen fb8aff12f1 Add EditorSettings management to workspaces.
- Built a design where there's a singleton `EditorSettingsManager` that handles the "current" settings state in the world. When it detects that settings have changed via an update method being called it dispatches a `Changed` event.
- Exposed editor settings on the document tracker. When the editor settings change the document tracker dispatches to any listeners that its context has changed.
- Added tests to validate all the various settings management.

#1718
2017-10-24 10:42:49 -07:00
N. Taylor Mullen 212d97e511 Manage VisualStudioRazorParser lifetime.
- Exposed `VisualStudioRazorParser`, `DocumentStructureChangedEventArgs` and `ICanHasContextChangedListener` as ways to consume the new parser for a Razor document.
- Split the `VisualStudioRazorParser` into an abstract base and an implementation to avoid internal constructors.
- Changed the parser and corresponding smart indenter to take in document trackers, template engine factories and parser context change listeners. Of these additions the parser context change listeners will be deprecated once we own the TagHelper discovery mechanisms.
- Changed how the parser manages its internal parsing life cycle. It now creates template engines when the document tracker tells it to. So when project changes happen or new documents are opened the parser will re-instantiate its internal parser to ensure that it is parsing against the correct configurations.
- Removed all accessor services in favor of a singular RazorEditorFactoryService. This service is responsible for retrieving/creating various Razor components.
- Changed the code document provider to now use the parser provider in order to locate code documents associated with buffers. Prior to this that logic was hard coded.
- Removed old template engine reconstruction logic in the document tracker now that the parser owns that piece.
- Updated tracker to notify listeners when it's unsubscribing. This is how listeners can know when to tear bits down.
- Refactored/added pieces to the `DefaultVisualStudioRazorParser` in order to improve its unit/integration testing ability.
- Updated existing tests to react to new signatures.
- Added new visual studio razor parser tests, uncommented existing ones, and re-enforced ones that were previously flakey.
- Added various tests for the new services added, i.e. text buffer factory service tests.

#1630
2017-10-23 14:39:15 -07:00
N. Taylor Mullen 31c16af40b Add smart indentation for brace completion.
- Added a standalone brace smart indenter that listens to `ITextBuffer` changed events to determine when a brace completion event needs to be handled.
- Added methods to deal with getting document trackers from `ITextBuffer`s.
- Added a `BraceSmartIndenterTest` and `BraceSmartIndenterIntegrationTest` to verify all parts of the smart indenter.
- Moved private test infrastructure classes into their own files and expanded on their functionality to enable the brace completion smart indent scenarios.

#1538
2017-10-12 15:30:28 -07:00
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