diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs index 5ddecbd9dc..22efa0ec08 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.ComponentModel.Composition; using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Text; @@ -10,10 +11,13 @@ using Microsoft.VisualStudio.Text.Projection; namespace Microsoft.VisualStudio.Editor.Razor { + [System.Composition.Shared] + [Export(typeof(RazorTextBufferProvider))] internal class DefaultTextBufferProvider : RazorTextBufferProvider { private readonly IBufferGraphFactoryService _bufferGraphService; + [ImportingConstructor] public DefaultTextBufferProvider(IBufferGraphFactoryService bufferGraphService) { if (bufferGraphService == null) diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProviderFactory.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProviderFactory.cs deleted file mode 100644 index 834e10a5be..0000000000 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProviderFactory.cs +++ /dev/null @@ -1,40 +0,0 @@ -// 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.Text.Projection; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(RazorTextBufferProvider), RazorLanguage.Name)] - internal class DefaultTextBufferProviderFactory : ILanguageServiceFactory - { - private readonly IBufferGraphFactoryService _bufferGraphService; - - [ImportingConstructor] - public DefaultTextBufferProviderFactory(IBufferGraphFactoryService bufferGraphService) - { - if (bufferGraphService == null) - { - throw new ArgumentNullException(nameof(bufferGraphService)); - } - - _bufferGraphService = bufferGraphService; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - return new DefaultTextBufferProvider(_bufferGraphService); - } - } -}