Commit Graph

98 Commits

Author SHA1 Message Date
N. Taylor Mullen 38e145389e Fix BackgroundDocumentGenerator flaky tests.
- Some time spans were too aggressive for parsing a Razor file on a slow environment.
- Fixed an obvious race where we'd expect 0 pending notifications when it was possible to be in the process of clearing notifications.

#2506
2018-07-27 14:49:12 -07:00
Ryan Nowak e248f2fb2a Rename a file 2018-06-06 09:30:24 -07:00
N. Taylor Mullen 56d69db0fa Add Razor document tracking to FallbackRazorProjectHost.
- VisualStudio defaults to adding a `<none>` link item when right click -> add existing item for Razor files; therefore, this also includes the knowledge of the "None" item group when finding Razor files.
- Added unit and functional tests to verify the new `FallbackRazorProjectHost` behavior.
- Added new schema items to represent the `Content` and `None` item type information (pulled from the project system repo).

#2373
2018-05-30 11:15:25 -07:00
N. Taylor Mullen 93d8a93498 Enable serialization of `TagHelperDescriptor`s.
- Added ability for TagHelpers to write their own json output.
2018-05-22 16:48:26 -07:00
Ryan Nowak fafdd7e3af Track the open/closed state of documents
This change intoduces content changes to our project snapshots. We now
know the open/closed state of documents that are initialized by the
Razor project system and listen to the correct data source based on
whether the file is open in the editor.

There are a few other random improvements in here as well like a
workaround for the upcoming name change to our OOP client type.
2018-05-11 08:18:08 -07:00
N. Taylor Mullen e0e1c39cce Added a LiveShareWorkspaceProvider to enable location of the remote workspace in live share scenarios.
- MEF is the primary means of resolving the new live share provider therefore we allow it to not be registered.
- The new contract is in the Editor.Razor binary so the LiveShare bits don't have to take the dependency on the windows binary in Razor (has a lot of baggage).
- This is specific to live share but providing a generic way to resolve workspaces didn't seem reasonable given the varying expectations in VS4Mac. If we need to make a more generic solution in the future we'll revisit this; for now this is a straight forward inclusion of live share functionality.
- Added tests to validate the new behavior.
- This unblocks the live share scenario of resolving the remote workspace. We can't rely on the projection buffers to provide the correct workspace because that workspace is wired up too late in the process of opening a Razor file.

#2335
2018-05-08 16:54:43 -07:00
Ryan Nowak 1d5245c421 Reorganize file tracker
This is precursor to a much bigger change. Pushing out some of the
changes that have broad impact early to make it easier to review the
real change.
2018-05-08 16:27:51 -07:00
Ryan Nowak e0612d7e07 Fixes for the document window state 2018-05-03 10:28:13 -07:00
Ryan Nowak e2edc280c5 Add documents, engine, tag helpers to snapshot
The project snapshot now maintains a RazorProjectEngine as well as set
of Tag Helpers that are known for that snapshot.

Pivoted some more services to be snapshot-centric.

Also added the ability to track .cshtml documents to the project system.
For now most components just ignore document changes.
2018-04-25 19:05:54 -04:00
N. Taylor Mullen 1d602d1205 Add host project system for VS4Mac.
- Tied into VS4Macs ProjectExtensions in order to bootstrap our Razor world.
- We currently watch all DotNet projects with the expectation that they're the only ones that can potentially turn into Razor compatible projects.
- Added a fallback Razor project host which is used for pre-Razor SDK Razor versions (< 2.1).
- Added a default Razor project host which consumes all MSBuild data from the users packages and sets up the Razor world accordingly.
- Had to modify some existing contracts to work better with new expectations. one of these was the VS4Mac specific Workspace accessor; essentially we needed to be able to lookup a workspace from a solution.
- Some of our previous expectations about addins were wrong (not being able to directly reference your libraries). To avoid using reflection to bootstrap our types I tried out directly referencing our libraries and all worked fine.
- Refactored the DefaultRazorProjectHost in windows (since we had to in Mac) for testing purposes.

#2081
2018-03-13 15:31:45 -07:00
N. Taylor Mullen 492e958114 Change HostProjectBuildComplete to persist workspace projects.
- This was missed in the VS15.7 movement to dev.
2018-03-13 15:11:21 -07:00
Ajay Bhargav Baaskaran fcd4484542 Fix TagHelperDescriptor.Kind serialization 2018-03-12 15:44:38 -07:00
N. Taylor Mullen 5c456fbd04 Merge branch 'rel/vs15.7' into dev
# Conflicts:
#	build/dependencies.props
#	src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs
#	src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs
#	src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorker.cs
#	src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorkerFactory.cs
#	src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs
#	src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotUpdateContext.cs
#	src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTracker.cs
#	src/Microsoft.VisualStudio.LanguageServices.Razor/Legacy/LegacyTagHelperResolver.cs
#	src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj
#	src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorConfiguration.cs
#	src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorExtension.cs
#	src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorGeneral.cs
#	src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorProjectProperties.cs
#	test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs
#	test/Microsoft.VisualStudio.Editor.Razor.Test/Microsoft.VisualStudio.Editor.Razor.Test.csproj
2018-03-05 22:58:07 -08:00
Ryan Nowak d6784b5f16 Report faults on Razor project system exceptions
Using the async-tasks service will automatically handle and report
exceptions from the project system
2018-02-28 13:04:42 -08:00
Ryan Nowak 0b777dad3f Decouple tooling from MVC assemblies 2018-02-19 14:39:19 -08:00
Ryan Nowak 5008c7803c Add a project system
Step 1: Add HostProject

This is a somewhat complex addition to the ProjectSnapshotManager. Now
that we accept updates from the underlying IDE project system we need to
coordinate those with the Workspace.

This means that ProjectSnapshot itself now also has a version concept.

Step 2: Introduce a new project system based on CPS

We use project capabilities defined by the Razor SDK to determine
whether to rely on MSBuild evaluation to detect the configuration or
whether to fallback to assembly-based detection.

Step 3: Flow RazorConfiguration everywhere

We use now expose the RazorConfiguration to the language service and
editor. This means that we no longer need to detect the project's
configuration asynchronously, it happens much faster now.
2018-02-19 14:39:19 -08:00
Nate McMaster 13824c418e Catch 15.7 up with dev
This change integrates most of the non-breaking work that we did in 2.1
including the updates to make Razor less coupled to MVC.
2018-02-19 10:46:16 -08:00
N. Taylor Mullen 6d2460ae7f Update DefaultRazorEditorFactoryService to be per-workspace.
- Updated the a `VisualStudioWorkspaceAccessor` API in windows to enable the factory to retrieve a workspace given a text buffer.
- Added a way to add test services to `AdhocWorkspace` so we can test against services being retrieved from a `Workspace`. This will be much more common once we rely on services coming from `TextBuffer`s in our other tooling pieces.
- Added tests for the default workspace provider.

#1989
2018-02-01 14:51:23 -08:00
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