Skip to content

Commit 21ba4ab

Browse files
Added preprocessing for notifications
1 parent ae45bf7 commit 21ba4ab

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Server/LspRequestRouter.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ public async Task RouteNotification(IHandlerDescriptor descriptor, Notification
9393
{
9494
_logger.LogDebug("Converting params for Notification {Method} to {Type}", notification.Method, descriptor.Params.FullName);
9595
var @params = notification.Params.ToObject(descriptor.Params, _serializer.JsonSerializer);
96+
97+
var lspDescriptor = descriptor as ILspHandlerDescriptor;
98+
99+
foreach (var preProcessor in _routeMatchers.ForHandlerPreProcessorMatcher()
100+
.SelectMany(strat => strat.FindPreProcessor(lspDescriptor, @params)))
101+
{
102+
@params = preProcessor.Process(lspDescriptor, @params);
103+
}
104+
96105
await ReflectionRequestHandlers.HandleNotification(descriptor, @params);
97106
}
98107
}
@@ -138,6 +147,7 @@ public async Task<ErrorResponse> RouteRequest(IHandlerDescriptor descriptor, Req
138147
_logger.LogError(new EventId(-32602), cannotDeserializeRequestParams, "Failed to deserialise request parameters.");
139148
return new InvalidParams(request.Id);
140149
}
150+
141151
var lspDescriptor = descriptor as ILspHandlerDescriptor;
142152

143153
foreach (var preProcessor in _routeMatchers.ForHandlerPreProcessorMatcher()

0 commit comments

Comments
 (0)