Remove redundant mapping code, because GetPositionInfo already does this

This commit is contained in:
David Wengier 2024-11-19 18:13:14 +11:00
Родитель f3aaba93ee
Коммит 70bb96ebc3
2 изменённых файлов: 2 добавлений и 14 удалений

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

@ -76,12 +76,6 @@ internal sealed class RemoteGoToDefinitionService(in ServiceArgs args) : RazorDo
return CallHtml;
}
if (!DocumentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), positionInfo.HostDocumentIndex, out var mappedPosition, out _))
{
// If we can't map to the generated C# file, we're done.
return NoFurtherHandling;
}
// Finally, call into C#.
var generatedDocument = await context.Snapshot
.GetGeneratedDocumentAsync(cancellationToken)
@ -92,7 +86,7 @@ internal sealed class RemoteGoToDefinitionService(in ServiceArgs args) : RazorDo
RemoteWorkspaceAccessor.GetWorkspace(),
generatedDocument,
typeOnly: false,
mappedPosition,
positionInfo.Position.ToLinePosition(),
cancellationToken)
.ConfigureAwait(false);

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

@ -66,12 +66,6 @@ internal sealed class RemoteGoToImplementationService(in ServiceArgs args) : Raz
return CallHtml;
}
if (!DocumentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), positionInfo.HostDocumentIndex, out var mappedPosition, out _))
{
// If we can't map to the generated C# file, we're done.
return NoFurtherHandling;
}
// Finally, call into C#.
var generatedDocument = await context.Snapshot
.GetGeneratedDocumentAsync(cancellationToken)
@ -80,7 +74,7 @@ internal sealed class RemoteGoToImplementationService(in ServiceArgs args) : Raz
var locations = await ExternalHandlers.GoToImplementation
.FindImplementationsAsync(
generatedDocument,
mappedPosition,
positionInfo.Position.ToLinePosition(),
supportsVisualStudioExtensions: true,
cancellationToken)
.ConfigureAwait(false);