@@ -48,7 +48,7 @@ struct LanguageServerConfig
48
48
// /
49
49
// / Params:
50
50
// / ExtensionModule = a module defining the following members:
51
- // / - `moduleMembers `: an AliasSeq list of all imported modules that should
51
+ // / - `memberModules `: an AliasSeq list of all imported modules that should
52
52
// / be introspected to be called automatically on matching RPC commands.
53
53
// / - `InitializeResult initialize(InitializeParams)`: initialization method.
54
54
// /
@@ -62,9 +62,11 @@ struct LanguageServerConfig
62
62
// / - `parallelMain`: an optional method which is run alongside everything
63
63
// / else in parallel using fibers. Should yield as much as possible when
64
64
// / there is nothing to do.
65
- mixin template LanguageServerRouter(alias ExtensionModule, LanguageServerConfig serverConfig = LanguageServerConfig.init)
65
+ mixin template LanguageServerRouter(alias ExtensionModule, LanguageServerConfig serverConfig
66
+ = LanguageServerConfig.init)
66
67
{
67
- static assert (is (typeof (ExtensionModule.initialize)), " Missing initialize function in ExtensionModule " ~ ExtensionModule.stringof);
68
+ static assert (is (typeof (ExtensionModule.initialize)), " Missing initialize function in ExtensionModule " ~
69
+ ExtensionModule.stringof);
68
70
69
71
import core.sync.mutex ;
70
72
import core.thread ;
@@ -103,7 +105,7 @@ mixin template LanguageServerRouter(alias ExtensionModule, LanguageServerConfig
103
105
else static if (__traits(hasMember, ExtensionModule, " memberModules" ))
104
106
{ /* ok */ }
105
107
else
106
- static assert (false , " Missing members field in ExtensionModule " ~ ExtensionModule.stringof);
108
+ static assert (false , " Missing members or memberModules field in ExtensionModule " ~ ExtensionModule.stringof);
107
109
mixin EventProcessor! (ExtensionModule, serverConfig.eventConfig) eventProcessor;
108
110
109
111
// / Calls a method associated with the given request type in the
@@ -183,7 +185,8 @@ mixin template LanguageServerRouter(alias ExtensionModule, LanguageServerConfig
183
185
scope (exit)
184
186
working-- ;
185
187
auto thisId = working;
186
- trace(" Partial " , thisId, " / " , numHandlers, " ... " , partialResultToken.length ? " (supported)" : " (no support)" );
188
+ trace(" Partial " , thisId, " / " , numHandlers, " ... " , partialResultToken.length ?
189
+ " (supported)" : " (no support)" );
187
190
auto result = fn(args.expand);
188
191
trace(" Partial " , thisId, " = " , result);
189
192
auto json = result.serializeJson;
@@ -202,7 +205,8 @@ mixin template LanguageServerRouter(alias ExtensionModule, LanguageServerConfig
202
205
scope (exit)
203
206
working-- ;
204
207
auto thisId = working;
205
- trace(" Partial iterator as " , thisId, " / " , numHandlers, " ... " , partialResultToken.length ? " (supported)" : " (no support)" );
208
+ trace(" Partial iterator as " , thisId, " / " , numHandlers, " ... " ,
209
+ partialResultToken.length ? " (supported)" : " (no support)" );
206
210
auto result = fn(args.expand);
207
211
foreach (chunk; result)
208
212
{
@@ -325,7 +329,7 @@ mixin template LanguageServerRouter(alias ExtensionModule, LanguageServerConfig
325
329
return res;
326
330
}
327
331
328
- // calls @postProcotolMethod methods for the given request
332
+ // calls @postProtocolMethod methods for the given request
329
333
private void processRequestObservers (T)(RequestMessageRaw msg, T result)
330
334
{
331
335
eventProcessor.emitProtocol! (postProtocolMethod, (name, callSymbol, uda) {
@@ -441,7 +445,8 @@ mixin template LanguageServerRouter(alias ExtensionModule, LanguageServerConfig
441
445
__gshared FiberManager fibers;
442
446
__gshared Mutex fibersMutex;
443
447
444
- void pushFiber (T)(string name, T callback, int pages = serverConfig.defaultPages, string file = __FILE__ , int line = __LINE__ )
448
+ void pushFiber (T)(string name, T callback, int pages = serverConfig.defaultPages,
449
+ string file = __FILE__ , int line = __LINE__ )
445
450
{
446
451
synchronized (fibersMutex)
447
452
fibers.put(name, new Fiber (callback, serverConfig.fiberPageSize * pages), file, line);
@@ -540,7 +545,6 @@ mixin template LanguageServerRouter(alias ExtensionModule, LanguageServerConfig
540
545
541
546
fibers.put(" RPC manager" , rpc);
542
547
543
- spawnFiberImpl = (&pushFiber! (void delegate ())).toDelegate;
544
548
defaultFiberPages = serverConfig.defaultPages;
545
549
546
550
static if (is (typeof (ExtensionModule.parallelMain)))
@@ -597,7 +601,7 @@ unittest
597
601
bool sanityFalse;
598
602
}
599
603
600
- __gshared static int calledCustomNotify;
604
+ __gshared int calledCustomNotify;
601
605
602
606
static struct UTServer
603
607
{
0 commit comments