Move TagHelperCompletionService to VS.Editor.Razor and export it.
- Moved service poco types: `AttributeCompletionContext`, `AttributeCompletionResult`, `ElementCompletionContext` and `ElementCompletionResult`. - Exported DefaultTagHelperCompletionService. #1762
This commit is contained in:
parent
458111ad03
commit
6cf78ceb1b
|
|
@ -1,18 +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 Microsoft.CodeAnalysis.Host;
|
||||
using Microsoft.CodeAnalysis.Host.Mef;
|
||||
|
||||
namespace Microsoft.CodeAnalysis.Razor
|
||||
{
|
||||
[ExportLanguageServiceFactory(typeof(TagHelperCompletionService), RazorLanguage.Name, ServiceLayer.Default)]
|
||||
internal class DefaultTagHelperCompletionServiceFactory : ILanguageServiceFactory
|
||||
{
|
||||
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
|
||||
{
|
||||
var tagHelperFactsService = languageServices.GetRequiredService<TagHelperFactsServiceInternal>();
|
||||
return new DefaultTagHelperCompletionService(tagHelperFactsService);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
|
||||
namespace Microsoft.CodeAnalysis.Razor
|
||||
namespace Microsoft.VisualStudio.Editor.Razor
|
||||
{
|
||||
public class AttributeCompletionContext
|
||||
{
|
||||
|
|
@ -5,7 +5,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
|
||||
namespace Microsoft.CodeAnalysis.Razor
|
||||
namespace Microsoft.VisualStudio.Editor.Razor
|
||||
{
|
||||
public abstract class AttributeCompletionResult
|
||||
{
|
||||
|
|
@ -3,18 +3,30 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.CodeAnalysis.Razor;
|
||||
|
||||
namespace Microsoft.CodeAnalysis.Razor
|
||||
namespace Microsoft.VisualStudio.Editor.Razor
|
||||
{
|
||||
[System.Composition.Shared]
|
||||
[Export(typeof(TagHelperCompletionService))]
|
||||
internal class DefaultTagHelperCompletionService : TagHelperCompletionService
|
||||
{
|
||||
private readonly TagHelperFactsServiceInternal _tagHelperFactsService;
|
||||
private static readonly HashSet<TagHelperDescriptor> _emptyHashSet = new HashSet<TagHelperDescriptor>();
|
||||
|
||||
public DefaultTagHelperCompletionService(TagHelperFactsServiceInternal tagHelperFactsService)
|
||||
[ImportingConstructor]
|
||||
public DefaultTagHelperCompletionService(VisualStudioWorkspaceAccessor workspaceAccessor)
|
||||
{
|
||||
var razorLanguageServices = workspaceAccessor.Workspace.Services.GetLanguageServices(RazorLanguage.Name);
|
||||
_tagHelperFactsService = razorLanguageServices.GetRequiredService<TagHelperFactsServiceInternal>();
|
||||
}
|
||||
|
||||
// Internal for testing
|
||||
internal DefaultTagHelperCompletionService(TagHelperFactsServiceInternal tagHelperFactsService)
|
||||
{
|
||||
_tagHelperFactsService = tagHelperFactsService;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
|
||||
namespace Microsoft.CodeAnalysis.Razor
|
||||
namespace Microsoft.VisualStudio.Editor.Razor
|
||||
{
|
||||
public sealed class ElementCompletionContext
|
||||
{
|
||||
|
|
@ -5,7 +5,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
|
||||
namespace Microsoft.CodeAnalysis.Razor
|
||||
namespace Microsoft.VisualStudio.Editor.Razor
|
||||
{
|
||||
public abstract class ElementCompletionResult
|
||||
{
|
||||
|
|
@ -1,11 +1,9 @@
|
|||
// 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.CodeAnalysis.Razor
|
||||
namespace Microsoft.VisualStudio.Editor.Razor
|
||||
{
|
||||
public abstract class TagHelperCompletionService : ILanguageService
|
||||
public abstract class TagHelperCompletionService
|
||||
{
|
||||
public abstract AttributeCompletionResult GetAttributeCompletions(AttributeCompletionContext completionContext);
|
||||
|
||||
|
|
@ -4,9 +4,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.CodeAnalysis.Razor;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.CodeAnalysis.Razor
|
||||
namespace Microsoft.VisualStudio.Editor.Razor
|
||||
{
|
||||
public class DefaultTagHelperCompletionServiceTest
|
||||
{
|
||||
Loading…
Reference in New Issue