-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Currently Razor tooling provides an implementation of ISpanMappingService, and various features in Roslyn call into it in order to map locations in Razor generated C# code, back to the originating .razor or .cshtml file. With cohosting, we want to remove the need for this service and have Roslyn honour #line directives instead. Some of all of these items could potentially be limited to only supporting enhanced line directives, to ensure full fidelity of results. Further, it might be desirable to only support #line directives if there isn't an ISpanMappingService for the document in question, to allow venus/legacy Razor editor to be unaffected.
Things that might need specific changes
-
Renamer.RenameDocumentAsync:
- Used to not rename generated documents.
- No action hopefully, source generated documents filtered out elsewhere?
-
AddImportPlacementOptionsProviders.AllowImportsInHiddenRegions:
- Used to allow generating imports in hidden regions
- No action hopefully, Razor generates usings into non-hidden regions now (Don't emit
#line defaultand#line hiddenbetween consecutive using directives razor#9991)
Things that can be changed to use line directives
(with varying degrees of difficulty, and appropriate API changes to ensure relevant Location data is available)
-
RemoteCodeLensReferencesService.FixUpDescriptorsAsync
-
VisualStudioDocumentNavigationService.GetNavigationCallbackAsync
-
VisualStudioWorkspaceImpl.ShouldApplyChangesToMappedDocuments
- called from VisualStudioWorkspaceImpl.GetMappedTextChangesAsync
- called from VisualStudioWorkspaceImpl.ApplyMappedFileChanges
- called from VisualStudioWorkspaceImpl.GetMappedTextChangesAsync
-
ProtocolConversions.GetMappedSpanResultAsync
- called from ProtocolConversions.ChangedDocumentsToTextDocumentEditsAsync
- called from RenameHandler.HandleRequestAsync
- called from ProtocolConversions.TextSpanToLocationAsync
- called from WorkspaceSymbolsHandler.AddItemAsync
- called from AbstractGoToDefinitionHandler.GetDefinitionAsync
- called from ProtocolConversions.ChangedDocumentsToTextDocumentEditsAsync
-
AbstractDocumentSpanEntry.TryMapAndGetFirstAsync
Part of dotnet/razor#9519