Skip to content

Commit 58984fe

Browse files
authored
Remove redundant mapping code, because GetPositionInfo already does this (#11230)
Noticed while working on FAR in cohosting today.
2 parents 7030366 + cc80827 commit 58984fe

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToDefinition/RemoteGoToDefinitionService.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Threading;
55
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore.Razor.Language;
76
using Microsoft.AspNetCore.Razor.PooledObjects;
87
using Microsoft.CodeAnalysis.ExternalAccess.Razor;
98
using Microsoft.CodeAnalysis.Razor.DocumentMapping;
@@ -76,12 +75,6 @@ protected override IRemoteGoToDefinitionService CreateService(in ServiceArgs arg
7675
return CallHtml;
7776
}
7877

79-
if (!DocumentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), positionInfo.HostDocumentIndex, out var mappedPosition, out _))
80-
{
81-
// If we can't map to the generated C# file, we're done.
82-
return NoFurtherHandling;
83-
}
84-
8578
// Finally, call into C#.
8679
var generatedDocument = await context.Snapshot
8780
.GetGeneratedDocumentAsync(cancellationToken)
@@ -92,7 +85,7 @@ protected override IRemoteGoToDefinitionService CreateService(in ServiceArgs arg
9285
RemoteWorkspaceAccessor.GetWorkspace(),
9386
generatedDocument,
9487
typeOnly: false,
95-
mappedPosition,
88+
positionInfo.Position.ToLinePosition(),
9689
cancellationToken)
9790
.ConfigureAwait(false);
9891

src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToImplementation/RemoteGoToImplementationService.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Threading;
55
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore.Razor.Language;
76
using Microsoft.AspNetCore.Razor.PooledObjects;
87
using Microsoft.CodeAnalysis.ExternalAccess.Razor;
98
using Microsoft.CodeAnalysis.Razor.DocumentMapping;
@@ -66,12 +65,6 @@ protected override IRemoteGoToImplementationService CreateService(in ServiceArgs
6665
return CallHtml;
6766
}
6867

69-
if (!DocumentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), positionInfo.HostDocumentIndex, out var mappedPosition, out _))
70-
{
71-
// If we can't map to the generated C# file, we're done.
72-
return NoFurtherHandling;
73-
}
74-
7568
// Finally, call into C#.
7669
var generatedDocument = await context.Snapshot
7770
.GetGeneratedDocumentAsync(cancellationToken)
@@ -80,7 +73,7 @@ protected override IRemoteGoToImplementationService CreateService(in ServiceArgs
8073
var locations = await ExternalHandlers.GoToImplementation
8174
.FindImplementationsAsync(
8275
generatedDocument,
83-
mappedPosition,
76+
positionInfo.Position.ToLinePosition(),
8477
supportsVisualStudioExtensions: true,
8578
cancellationToken)
8679
.ConfigureAwait(false);

0 commit comments

Comments
 (0)