From 37eed518f8311a5646668b02a7aebd2d76159343 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 6 Dec 2017 17:23:45 -0800 Subject: [PATCH] Make VisualStudioRazorParserFactory VisualStudio agnostic. - Removed the `Microsoft.VisualStudio.Language.IntelliSense` dependency from `Microsoft.VisualStudio.Editor.Razor` because it isn't supported in VS for mac. - Replaced `ICompletionBroker` usage in the VS agnostic dll with a new abstract type `VisualStudioCompletionBroker`. This also enables us to implement completion - Added Mac implementation of new `VisualStudioCompletionBroker`. #1789 --- build/dependencies.props | 1 + .../DefaultVisualStudioRazorParser.cs | 5 +-- .../DefaultVisualStudioRazorParserFactory.cs | 42 ++++++++++--------- ...ltVisualStudioRazorParserFactoryFactory.cs | 36 ++++++++++++++++ ...Microsoft.VisualStudio.Editor.Razor.csproj | 2 +- .../VisualStudioCompletionBroker.cs | 13 ++++++ .../VisualStudioRazorParserFactory.cs | 4 +- .../DefaultRazorEditorFactoryService.cs | 8 +--- .../DefaultVisualStudioCompletionBroker.cs | 36 ++++++++++++++++ ...aultVisualStudioCompletionBrokerFactory.cs | 41 ++++++++++++++++++ ...VisualStudio.LanguageServices.Razor.csproj | 1 + .../DefaultVisualStudioCompletionBroker.cs | 29 +++++++++++++ ...aultVisualStudioCompletionBrokerFactory.cs | 27 ++++++++++++ ...tVisualStudioRazorParserIntegrationTest.cs | 33 +-------------- .../DefaultVisualStudioRazorParserTest.cs | 24 +++++------ 15 files changed, 226 insertions(+), 76 deletions(-) rename src/{Microsoft.VisualStudio.LanguageServices.Razor/Editor => Microsoft.VisualStudio.Editor.Razor}/DefaultVisualStudioRazorParserFactory.cs (51%) create mode 100644 src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs create mode 100644 src/Microsoft.VisualStudio.Editor.Razor/VisualStudioCompletionBroker.cs create mode 100644 src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs create mode 100644 src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs create mode 100644 src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs create mode 100644 src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs diff --git a/build/dependencies.props b/build/dependencies.props index 4debd6fbde..db59c25af2 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -27,6 +27,7 @@ 8.0.50727 9.0.30729 7.10.6071 + 15.6.161-preview 1.3.7 1.0.0 4.7.49 diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs index f480dec0a2..baa9aa049c 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.Editor; -using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Text; using ITextBuffer = Microsoft.VisualStudio.Text.ITextBuffer; using Timer = System.Threading.Timer; @@ -28,7 +27,7 @@ namespace Microsoft.VisualStudio.Editor.Razor internal ChangeReference _latestChangeReference; private readonly object IdleLock = new object(); - private readonly ICompletionBroker _completionBroker; + private readonly VisualStudioCompletionBroker _completionBroker; private readonly VisualStudioDocumentTracker _documentTracker; private readonly ForegroundDispatcher _dispatcher; private readonly RazorTemplateEngineFactoryService _templateEngineFactory; @@ -50,7 +49,7 @@ namespace Microsoft.VisualStudio.Editor.Razor VisualStudioDocumentTracker documentTracker, RazorTemplateEngineFactoryService templateEngineFactory, ErrorReporter errorReporter, - ICompletionBroker completionBroker) + VisualStudioCompletionBroker completionBroker) { if (dispatcher == null) { diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioRazorParserFactory.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs similarity index 51% rename from src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioRazorParserFactory.cs rename to src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs index 3e881f05ad..9e9ea12135 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioRazorParserFactory.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs @@ -2,45 +2,47 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Language.Intellisense; -using TemplateEngineFactoryService = Microsoft.CodeAnalysis.Razor.RazorTemplateEngineFactoryService; -namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor +namespace Microsoft.VisualStudio.Editor.Razor { - [System.Composition.Shared] - [Export(typeof(VisualStudioRazorParserFactory))] internal class DefaultVisualStudioRazorParserFactory : VisualStudioRazorParserFactory { private readonly ForegroundDispatcher _dispatcher; - private readonly TemplateEngineFactoryService _templateEngineFactoryService; - private readonly ICompletionBroker _completionBroker; + private readonly RazorTemplateEngineFactoryService _templateEngineFactoryService; + private readonly VisualStudioCompletionBroker _completionBroker; private readonly ErrorReporter _errorReporter; - [ImportingConstructor] public DefaultVisualStudioRazorParserFactory( - ICompletionBroker completionBroker, - [Import(typeof(VisualStudioWorkspace))] Workspace workspace) + ForegroundDispatcher dispatcher, + ErrorReporter errorReporter, + VisualStudioCompletionBroker completionBroker, + RazorTemplateEngineFactoryService templateEngineFactoryService) { + if (dispatcher == null) + { + throw new ArgumentNullException(nameof(dispatcher)); + } + + if (errorReporter == null) + { + throw new ArgumentNullException(nameof(errorReporter)); + } + if (completionBroker == null) { throw new ArgumentNullException(nameof(completionBroker)); } - if (workspace == null) + if (templateEngineFactoryService == null) { - throw new ArgumentNullException(nameof(workspace)); + throw new ArgumentNullException(nameof(templateEngineFactoryService)); } + _dispatcher = dispatcher; + _errorReporter = errorReporter; _completionBroker = completionBroker; - _dispatcher = workspace.Services.GetRequiredService(); - _errorReporter = workspace.Services.GetRequiredService(); - var razorLanguageServices = workspace.Services.GetLanguageServices(RazorLanguage.Name); - _templateEngineFactoryService = razorLanguageServices.GetRequiredService(); + _templateEngineFactoryService = templateEngineFactoryService; } public override VisualStudioRazorParser Create(VisualStudioDocumentTracker documentTracker) diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs new file mode 100644 index 0000000000..cdbdafd818 --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs @@ -0,0 +1,36 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Razor; + +namespace Microsoft.VisualStudio.Editor.Razor +{ + [Shared] + [ExportLanguageServiceFactory(typeof(VisualStudioRazorParserFactory), RazorLanguage.Name, ServiceLayer.Default)] + internal class DefaultVisualStudioRazorParserFactoryFactory : ILanguageServiceFactory + { + public ILanguageService CreateLanguageService(HostLanguageServices languageServices) + { + if (languageServices == null) + { + throw new ArgumentNullException(nameof(languageServices)); + } + + var workspaceServices = languageServices.WorkspaceServices; + var dispatcher = workspaceServices.GetRequiredService(); + var errorReporter = workspaceServices.GetRequiredService(); + var completionBroker = languageServices.GetRequiredService(); + var templateEngineFactoryService = languageServices.GetRequiredService(); + + return new DefaultVisualStudioRazorParserFactory( + dispatcher, + errorReporter, + completionBroker, + templateEngineFactoryService); + } + } +} \ No newline at end of file diff --git a/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj b/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj index 32b484f542..0c367a461e 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj +++ b/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioCompletionBroker.cs b/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioCompletionBroker.cs new file mode 100644 index 0000000000..a86810b290 --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioCompletionBroker.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Host; +using Microsoft.VisualStudio.Text.Editor; + +namespace Microsoft.VisualStudio.Editor.Razor +{ + internal abstract class VisualStudioCompletionBroker : ILanguageService + { + public abstract bool IsCompletionActive(ITextView textView); + } +} diff --git a/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParserFactory.cs b/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParserFactory.cs index 580b33cc62..7d30a46027 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParserFactory.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParserFactory.cs @@ -1,9 +1,11 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.CodeAnalysis.Host; + namespace Microsoft.VisualStudio.Editor.Razor { - internal abstract class VisualStudioRazorParserFactory + internal abstract class VisualStudioRazorParserFactory : ILanguageService { public abstract VisualStudioRazorParser Create(VisualStudioDocumentTracker documentTracker); } diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultRazorEditorFactoryService.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultRazorEditorFactoryService.cs index 2b2e098669..dfb2b51d93 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultRazorEditorFactoryService.cs +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultRazorEditorFactoryService.cs @@ -23,7 +23,6 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor [ImportingConstructor] public DefaultRazorEditorFactoryService( VisualStudioDocumentTrackerFactory documentTrackerFactory, - VisualStudioRazorParserFactory parserFactory, VisualStudioWorkspaceAccessor workspaceAccessor) { if (documentTrackerFactory == null) @@ -31,20 +30,15 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor throw new ArgumentNullException(nameof(documentTrackerFactory)); } - if (parserFactory == null) - { - throw new ArgumentNullException(nameof(parserFactory)); - } - if (workspaceAccessor == null) { throw new ArgumentNullException(nameof(workspaceAccessor)); } _documentTrackerFactory = documentTrackerFactory; - _parserFactory = parserFactory; var razorLanguageServices = workspaceAccessor.Workspace.Services.GetLanguageServices(RazorLanguage.Name); + _parserFactory = razorLanguageServices.GetRequiredService(); _braceSmartIndenterFactory = razorLanguageServices.GetRequiredService(); } diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs new file mode 100644 index 0000000000..577035aa9d --- /dev/null +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs @@ -0,0 +1,36 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.VisualStudio.Editor.Razor; +using Microsoft.VisualStudio.Language.Intellisense; +using Microsoft.VisualStudio.Text.Editor; + +namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor +{ + internal class DefaultVisualStudioCompletionBroker : VisualStudioCompletionBroker + { + private readonly ICompletionBroker _completionBroker; + + public DefaultVisualStudioCompletionBroker(ICompletionBroker completionBroker) + { + if (completionBroker == null) + { + throw new ArgumentNullException(nameof(completionBroker)); + } + + _completionBroker = completionBroker; + } + + public override bool IsCompletionActive(ITextView textView) + { + if (textView == null) + { + throw new ArgumentNullException(nameof(textView)); + } + + var completionIsActive = _completionBroker.IsCompletionActive(textView); + return completionIsActive; + } + } +} diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs new file mode 100644 index 0000000000..f0c6086f99 --- /dev/null +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs @@ -0,0 +1,41 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Razor; +using Microsoft.VisualStudio.Editor.Razor; +using Microsoft.VisualStudio.Language.Intellisense; + +namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor +{ + [Shared] + [ExportLanguageServiceFactory(typeof(VisualStudioCompletionBroker), RazorLanguage.Name, ServiceLayer.Default)] + internal class DefaultVisualStudioCompletionBrokerFactory : ILanguageServiceFactory + { + private readonly ICompletionBroker _completionBroker; + + [ImportingConstructor] + public DefaultVisualStudioCompletionBrokerFactory(ICompletionBroker completionBroker) + { + if (completionBroker == null) + { + throw new ArgumentNullException(nameof(completionBroker)); + } + + _completionBroker = completionBroker; + } + + public ILanguageService CreateLanguageService(HostLanguageServices languageServices) + { + if (languageServices == null) + { + throw new ArgumentNullException(nameof(languageServices)); + } + + return new DefaultVisualStudioCompletionBroker(_completionBroker); + } + } +} diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj b/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj index bc0f4bcaa8..4d20fad2fe 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj @@ -23,6 +23,7 @@ + diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs new file mode 100644 index 0000000000..ff34982f1c --- /dev/null +++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs @@ -0,0 +1,29 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.VisualStudio.Editor.Razor; +using Microsoft.VisualStudio.Text.Editor; +using MonoDevelop.Ide.CodeCompletion; + +namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor +{ + internal class DefaultVisualStudioCompletionBroker : VisualStudioCompletionBroker + { + public override bool IsCompletionActive(ITextView textView) + { + if (textView == null) + { + throw new ArgumentNullException(nameof(textView)); + } + + if (textView.HasAggregateFocus) + { + return CompletionWindowManager.IsVisible; + } + + // Text view does not have focus, if the completion window is visible it's for a different text view. + return false; + } + } +} diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs new file mode 100644 index 0000000000..a087c17471 --- /dev/null +++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs @@ -0,0 +1,27 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Razor; +using Microsoft.VisualStudio.Editor.Razor; + +namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor +{ + [Shared] + [ExportLanguageServiceFactory(typeof(VisualStudioCompletionBroker), RazorLanguage.Name, ServiceLayer.Default)] + internal class DefaultVisualStudioCompletionBrokerFactory : ILanguageServiceFactory + { + public ILanguageService CreateLanguageService(HostLanguageServices languageServices) + { + if (languageServices == null) + { + throw new ArgumentNullException(nameof(languageServices)); + } + + return new DefaultVisualStudioCompletionBroker(); + } + } +} diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserIntegrationTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserIntegrationTest.cs index 3117f5b585..6943801c87 100644 --- a/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserIntegrationTest.cs +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserIntegrationTest.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Mvc.Razor.Extensions; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Test; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; @@ -711,37 +710,9 @@ namespace Microsoft.VisualStudio.Editor.Razor } } - private class TestCompletionBroker : ICompletionBroker + private class TestCompletionBroker : VisualStudioCompletionBroker { - public ICompletionSession CreateCompletionSession(ITextView textView, ITrackingPoint triggerPoint, bool trackCaret) - { - throw new NotImplementedException(); - } - - public void DismissAllSessions(ITextView textView) - { - throw new NotImplementedException(); - } - - public ReadOnlyCollection GetSessions(ITextView textView) - { - throw new NotImplementedException(); - } - - public bool IsCompletionActive(ITextView textView) - { - return false; - } - - public ICompletionSession TriggerCompletion(ITextView textView) - { - throw new NotImplementedException(); - } - - public ICompletionSession TriggerCompletion(ITextView textView, ITrackingPoint triggerPoint, bool trackCaret) - { - throw new NotImplementedException(); - } + public override bool IsCompletionActive(ITextView textView) => false; } } } \ No newline at end of file diff --git a/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserTest.cs b/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserTest.cs index ecb42b2067..494e9ed190 100644 --- a/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserTest.cs +++ b/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserTest.cs @@ -2,11 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Linq; using System.Threading; using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Test; using Microsoft.VisualStudio.Text; using Moq; @@ -36,7 +34,7 @@ namespace Microsoft.VisualStudio.Editor.Razor CreateDocumentTracker(), Mock.Of(), new DefaultErrorReporter(), - Mock.Of()); + Mock.Of()); parser.Dispose(); // Act & Assert @@ -52,7 +50,7 @@ namespace Microsoft.VisualStudio.Editor.Razor CreateDocumentTracker(), Mock.Of(), new DefaultErrorReporter(), - Mock.Of()); + Mock.Of()); parser.Dispose(); // Act & Assert @@ -68,7 +66,7 @@ namespace Microsoft.VisualStudio.Editor.Razor CreateDocumentTracker(), Mock.Of(), new DefaultErrorReporter(), - Mock.Of()); + Mock.Of()); parser.Dispose(); // Act & Assert @@ -84,7 +82,7 @@ namespace Microsoft.VisualStudio.Editor.Razor CreateDocumentTracker(), Mock.Of(), new DefaultErrorReporter(), - Mock.Of())) + Mock.Of())) { var called = false; parser.DocumentStructureChanged += (sender, e) => called = true; @@ -112,7 +110,7 @@ namespace Microsoft.VisualStudio.Editor.Razor documentTracker, Mock.Of(), new DefaultErrorReporter(), - Mock.Of())) + Mock.Of())) { var called = false; parser.DocumentStructureChanged += (sender, e) => called = true; @@ -141,7 +139,7 @@ namespace Microsoft.VisualStudio.Editor.Razor CreateDocumentTracker(), Mock.Of(), new DefaultErrorReporter(), - Mock.Of()) + Mock.Of()) { BlockBackgroundIdleWork = new ManualResetEventSlim(), IdleDelay = TimeSpan.FromSeconds(5) @@ -171,7 +169,7 @@ namespace Microsoft.VisualStudio.Editor.Razor CreateDocumentTracker(), Mock.Of(), new DefaultErrorReporter(), - Mock.Of()) + Mock.Of()) { BlockBackgroundIdleWork = new ManualResetEventSlim(), IdleDelay = TimeSpan.FromSeconds(5) @@ -200,7 +198,7 @@ namespace Microsoft.VisualStudio.Editor.Razor CreateDocumentTracker(), Mock.Of(), new DefaultErrorReporter(), - Mock.Of())) + Mock.Of())) { parser.StartParser(); @@ -224,7 +222,7 @@ namespace Microsoft.VisualStudio.Editor.Razor documentTracker, Mock.Of(), new DefaultErrorReporter(), - Mock.Of())) + Mock.Of())) { // Act parser.StartParser(); @@ -244,7 +242,7 @@ namespace Microsoft.VisualStudio.Editor.Razor CreateDocumentTracker(isSupportedProject: true), Mock.Of(), new DefaultErrorReporter(), - Mock.Of())) + Mock.Of())) { // Act var result = parser.TryReinitializeParser(); @@ -263,7 +261,7 @@ namespace Microsoft.VisualStudio.Editor.Razor CreateDocumentTracker(isSupportedProject: false), Mock.Of(), new DefaultErrorReporter(), - Mock.Of())) + Mock.Of())) { // Act var result = parser.TryReinitializeParser();