@@ -27,15 +27,18 @@ import { ColorPresentation } from 'vscode-html-languageservice';
2727import { DynamicFileInfoHandler } from '../../razor/src/dynamicFile/dynamicFileInfoHandler' ;
2828import { ProvideDynamicFileParams } from '../../razor/src/dynamicFile/provideDynamicFileParams' ;
2929import { ProvideDynamicFileResponse } from '../../razor/src/dynamicFile/provideDynamicFileResponse' ;
30+ import { RazorMapSpansParams } from '../../razor/src/mapping/razorMapSpansParams' ;
31+ import { RazorMapSpansResponse } from '../../razor/src/mapping/razorMapSpansResponse' ;
32+ import { MappingHandler } from '../../razor/src/mapping/mappingHandler' ;
3033
3134export function registerRazorEndpoints (
3235 context : vscode . ExtensionContext ,
33- languageServer : RoslynLanguageServer ,
36+ roslynLanguageServer : RoslynLanguageServer ,
3437 razorLogger : RazorLogger ,
3538 platformInfo : PlatformInformation
3639) {
3740 const logNotificationType = new NotificationType < LogMessageParams > ( 'razor/log' ) ;
38- languageServer . registerOnNotificationWithParams ( logNotificationType , ( params ) =>
41+ roslynLanguageServer . registerOnNotificationWithParams ( logNotificationType , ( params ) =>
3942 razorLogger . log ( params . message , params . type )
4043 ) ;
4144
@@ -78,8 +81,6 @@ export function registerRazorEndpoints(
7881 }
7982
8083 function registerNonCohostingEndpoints ( ) {
81- // When the Roslyn language server sends a request for Razor dynamic file info, we forward that request along to Razor via
82- // a command.
8384 registerRequestHandler < ProvideDynamicFileParams , ProvideDynamicFileResponse > (
8485 'razor/provideDynamicFileInfo' ,
8586 async ( params ) =>
@@ -91,12 +92,15 @@ export function registerRazorEndpoints(
9192 async ( params ) =>
9293 vscode . commands . executeCommand ( DynamicFileInfoHandler . provideDynamicFileInfoCommand , params )
9394 ) ;
95+ registerRequestHandler < RazorMapSpansParams , RazorMapSpansResponse > ( 'razor/mapSpans' , async ( params ) => {
96+ return await vscode . commands . executeCommand < RazorMapSpansResponse > ( MappingHandler . MapSpansCommand , params ) ;
97+ } ) ;
9498 }
9599
96100 // Helper method that registers a request handler, and logs errors to the Razor logger.
97101 function registerRequestHandler < Params , Result > ( method : string , invocation : ( params : Params ) => Promise < Result > ) {
98102 const requestType = new RequestType < Params , Result , Error > ( method ) ;
99- languageServer . registerOnRequest ( requestType , async ( params ) => {
103+ roslynLanguageServer . registerOnRequest ( requestType , async ( params ) => {
100104 try {
101105 return await invocation ( params ) ;
102106 } catch ( error ) {
0 commit comments