@@ -36,6 +36,26 @@ function mt:_flushServer()
3636 files .reset ()
3737end
3838
39+ --- @async
40+ function mt :initialize (params )
41+ self :awaitRequest (' initialize' , params or {})
42+ self :notify (' initialized' )
43+ end
44+
45+ function mt :reportHangs ()
46+ local hangs = {}
47+ hangs [# hangs + 1 ] = (' ====== C -> S ======' )
48+ for _ , waiting in util .sortPairs (self ._waiting ) do
49+ hangs [# hangs + 1 ] = (' %03d %s' ):format (waiting .id , waiting .method )
50+ end
51+ hangs [# hangs + 1 ] = (' ====== S -> C ======' )
52+ for _ , waiting in util .sortPairs (proto .waiting ) do
53+ hangs [# hangs + 1 ] = (' %03d %s' ):format (waiting .id , waiting .method )
54+ end
55+ hangs [# hangs + 1 ] = (' ====================' )
56+ return table.concat (hangs , ' \n ' )
57+ end
58+
3959--- @param callback async fun ( client : languageClient )
4060function mt :start (callback )
4161 self :_fakeProto ()
@@ -68,7 +88,7 @@ function mt:start(callback)
6888 timer .timeJump (1.0 )
6989 jumpedTime = jumpedTime + 1.0
7090 if jumpedTime > 2 * 60 * 60 then
71- error (' two hours later ...' )
91+ error (' two hours later ...\n ' .. self : reportHangs () )
7292 end
7393 :: CONTINUE::
7494 end
93113
94114function mt :request (method , params , callback )
95115 local id = counter ()
96- self ._waiting [id ] = callback
116+ self ._waiting [id ] = {
117+ id = id ,
118+ params = params ,
119+ callback = callback ,
120+ }
97121 proto .doMethod {
98122 id = id ,
99123 method = method ,
@@ -126,7 +150,7 @@ function mt:update()
126150 error (' Unknown method: ' .. out .method )
127151 end
128152 else
129- local callback = self ._waiting [out .id ]
153+ local callback = self ._waiting [out .id ]. callback
130154 self ._waiting [out .id ] = nil
131155 callback (out .result , out .error )
132156 end
141165function mt :registerFakers ()
142166 for _ , method in ipairs {
143167 ' workspace/configuration' ,
168+ ' workspace/semanticTokens/refresh' ,
169+ ' window/workDoneProgress/create' ,
144170 ' textDocument/publishDiagnostics' ,
145171 } do
146172 self :register (method , function ()
0 commit comments