Move completion resolve code to common layer

This commit is contained in:
Alex Gavrilov (DEV PROD) 2024-11-03 13:40:53 -08:00
Родитель 62df8df06a
Коммит b3762aff2b
7 изменённых файлов: 12 добавлений и 20 удалений

Просмотреть файл

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Razor.PooledObjects;
using Microsoft.CodeAnalysis.Razor.Logging;
using Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion;
namespace Microsoft.CodeAnalysis.Razor.Completion;
internal class AggregateCompletionItemResolver
{

Просмотреть файл

@ -5,7 +5,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion;
namespace Microsoft.CodeAnalysis.Razor.Completion;
internal abstract class CompletionItemResolver
{

Просмотреть файл

@ -5,15 +5,13 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Razor.Completion;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
using Microsoft.CodeAnalysis.Razor.Tooltip;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Text.Adornments;
namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion;
namespace Microsoft.CodeAnalysis.Razor.Completion;
internal class RazorCompletionItemResolver(IProjectSnapshotManager projectManager) : CompletionItemResolver
{

Просмотреть файл

@ -4,10 +4,8 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.AspNetCore.Razor.PooledObjects;
using Microsoft.AspNetCore.Razor.Utilities;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem;
namespace Microsoft.CodeAnalysis.Razor.ProjectSystem;
internal static partial class IProjectSnapshotManagerExtensions
{

Просмотреть файл

@ -6,11 +6,9 @@ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.AspNetCore.Razor.PooledObjects;
using Microsoft.AspNetCore.Razor.Utilities;
using Microsoft.CodeAnalysis.Razor;
using Microsoft.CodeAnalysis.Razor.Logging;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem;
namespace Microsoft.CodeAnalysis.Razor.ProjectSystem;
internal static partial class IProjectSnapshotManagerExtensions
{

Просмотреть файл

@ -5,11 +5,9 @@ using System;
using System.IO;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Utilities;
using Microsoft.CodeAnalysis.Razor;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem;
namespace Microsoft.CodeAnalysis.Razor.ProjectSystem;
internal sealed record class MiscFilesHostProject : HostProject
{

Просмотреть файл

@ -8,11 +8,11 @@ using Microsoft.AspNetCore.Razor.Language.Components;
using Microsoft.AspNetCore.Razor.ProjectSystem;
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
using Microsoft.CodeAnalysis.Razor.Workspaces.Test;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
using static Microsoft.AspNetCore.Razor.Language.CommonMetadata;
using IProjectSnapshotManagerExtensions = Microsoft.CodeAnalysis.Razor.Workspaces.Test.IProjectSnapshotManagerExtensions;
namespace Microsoft.CodeAnalysis.Razor.Tooltip;
@ -22,7 +22,7 @@ public class ProjectAvailabilityTests(ITestOutputHelper testOutput) : ToolingTes
public async Task GetProjectAvailabilityText_NoProjects_ReturnsNull()
{
var projectManager = CreateProjectSnapshotManager();
var solutionQueryOperations = projectManager.GetQueryOperations();
var solutionQueryOperations = IProjectSnapshotManagerExtensions.GetQueryOperations(projectManager);
var availability = await solutionQueryOperations.GetProjectAvailabilityTextAsync("file.razor", "MyTagHelper", DisposalToken);
@ -60,7 +60,7 @@ public class ProjectAvailabilityTests(ITestOutputHelper testOutput) : ToolingTes
updater.DocumentAdded(hostProject.Key, hostDocument, TestMocks.CreateTextLoader(hostDocument.FilePath, text: ""));
});
var solutionQueryOperations = projectManager.GetQueryOperations();
var solutionQueryOperations = IProjectSnapshotManagerExtensions.GetQueryOperations(projectManager);
var availability = await solutionQueryOperations.GetProjectAvailabilityTextAsync(hostDocument.FilePath, tagHelperTypeName, DisposalToken);
@ -109,7 +109,7 @@ public class ProjectAvailabilityTests(ITestOutputHelper testOutput) : ToolingTes
updater.DocumentAdded(hostProject2.Key, hostDocument, TestMocks.CreateTextLoader(hostDocument.FilePath, text: ""));
});
var solutionQueryOperations = projectManager.GetQueryOperations();
var solutionQueryOperations = IProjectSnapshotManagerExtensions.GetQueryOperations(projectManager);
var availability = await solutionQueryOperations.GetProjectAvailabilityTextAsync(hostDocument.FilePath, tagHelperTypeName, DisposalToken);
@ -157,7 +157,7 @@ public class ProjectAvailabilityTests(ITestOutputHelper testOutput) : ToolingTes
updater.DocumentAdded(hostProject2.Key, hostDocument, TestMocks.CreateTextLoader(hostDocument.FilePath, text: ""));
});
var solutionQueryOperations = projectManager.GetQueryOperations();
var solutionQueryOperations = IProjectSnapshotManagerExtensions.GetQueryOperations(projectManager);
var availability = await solutionQueryOperations.GetProjectAvailabilityTextAsync(hostDocument.FilePath, tagHelperTypeName, DisposalToken);
@ -201,7 +201,7 @@ public class ProjectAvailabilityTests(ITestOutputHelper testOutput) : ToolingTes
updater.DocumentAdded(hostProject2.Key, hostDocument, TestMocks.CreateTextLoader(hostDocument.FilePath, text: ""));
});
var solutionQueryOperations = projectManager.GetQueryOperations();
var solutionQueryOperations = IProjectSnapshotManagerExtensions.GetQueryOperations(projectManager);
var availability = await solutionQueryOperations.GetProjectAvailabilityTextAsync(hostDocument.FilePath, "MyTagHelper", DisposalToken);