Fix RazorDirectiveCompletionProvider MEF dependency.

This commit is contained in:
N. Taylor Mullen 2018-03-14 14:41:22 -07:00
parent a6d03bd407
commit f9ad346be8
2 changed files with 4 additions and 40 deletions

View File

@ -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)

View File

@ -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);
}
}
}