Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TestDocumentMappingService #10976

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public DelegatedCompletionListProvider(
IClientConnection clientConnection,
CompletionListCache completionListCache)
{
_responseRewriters = responseRewriters.OrderBy(rewriter => rewriter.Order).ToImmutableArray();
_responseRewriters = responseRewriters.OrderByAsArray(static x => x.Order);
_documentMappingService = documentMappingService;
_clientConnection = clientConnection;
_completionListCache = completionListCache;
Expand All @@ -57,7 +57,9 @@ public DelegatedCompletionListProvider(
Guid correlationId,
CancellationToken cancellationToken)
{
var positionInfo = await _documentMappingService.GetPositionInfoAsync(documentContext, absoluteIndex, cancellationToken).ConfigureAwait(false);
var positionInfo = await _documentMappingService
.GetPositionInfoAsync(documentContext, absoluteIndex, cancellationToken)
.ConfigureAwait(false);

if (positionInfo.LanguageKind == RazorLanguageKind.Razor)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.LanguageServer.Hosting;
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer;
using Microsoft.CodeAnalysis.Razor.DocumentMapping;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
using Microsoft.CodeAnalysis.Razor.Protocol;
using Microsoft.CodeAnalysis.Testing;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Moq;
using Xunit;
using Xunit.Abstractions;

Expand Down Expand Up @@ -284,15 +287,16 @@ public async Task ShouldIncludeSnippets(string input, bool shouldIncludeSnippets
var codeDocument = CreateCodeDocument(code);
var documentContext = TestDocumentContext.From("C:/path/to/file.cshtml", codeDocument, hostDocumentVersion: 1337);

var documentMappingService = new TestDocumentMappingService()
{
LanguageKind = RazorLanguageKind.Html,
GeneratedPosition = new LinePosition(0, cursorPosition)
};
var generatedPosition = new LinePosition(0, cursorPosition);

var documentMappingServiceMock = new StrictMock<IDocumentMappingService>();
documentMappingServiceMock
.Setup(x => x.TryMapToGeneratedDocumentPosition(It.IsAny<IRazorGeneratedDocument>(), It.IsAny<int>(), out generatedPosition, out It.Ref<int>.IsAny))
.Returns(true);

var completionProvider = new DelegatedCompletionListProvider(
Array.Empty<DelegatedCompletionResponseRewriter>(),
documentMappingService,
responseRewriters: [],
documentMappingServiceMock.Object,
clientConnection,
new CompletionListCache());

Expand Down

This file was deleted.