@@ -252,6 +252,11 @@ defmodule NextLS do
252
252
} ,
253
253
% { assigns: % { ready: true } } = lsp
254
254
) do
255
+ for task <- Task.Supervisor . children ( lsp . assigns . task_supervisor ) ,
256
+ task != lsp . assigns . runtime_task . pid do
257
+ Process . exit ( task , :kill )
258
+ end
259
+
255
260
token = token ( )
256
261
257
262
progress_start ( lsp , token , "Compiling..." )
@@ -339,15 +344,7 @@ defmodule NextLS do
339
344
Process . demonitor ( ref , [ :flush ] )
340
345
{ { token , msg } , refs } = Map . pop ( refs , ref )
341
346
342
- GenLSP . notify ( lsp , % GenLSP.Notifications.DollarProgress {
343
- params: % GenLSP.Structures.ProgressParams {
344
- token: token ,
345
- value: % WorkDoneProgressEnd {
346
- kind: "end" ,
347
- message: msg
348
- }
349
- }
350
- } )
347
+ progress_end ( lsp , token , msg )
351
348
352
349
lsp =
353
350
case resp do
@@ -371,7 +368,9 @@ defmodule NextLS do
371
368
372
369
def handle_info ( { :DOWN , ref , :process , _pid , _reason } , % { assigns: % { refresh_refs: refs } } = lsp )
373
370
when is_map_key ( refs , ref ) do
374
- { _token , refs } = Map . pop ( refs , ref )
371
+ { { token , _ } , refs } = Map . pop ( refs , ref )
372
+
373
+ progress_end ( lsp , token )
375
374
376
375
{ :noreply , assign ( lsp , refresh_refs: refs ) }
377
376
end
@@ -425,6 +424,18 @@ defmodule NextLS do
425
424
} )
426
425
end
427
426
427
+ defp progress_end ( lsp , token , msg \\ nil ) do
428
+ GenLSP . notify ( lsp , % GenLSP.Notifications.DollarProgress {
429
+ params: % GenLSP.Structures.ProgressParams {
430
+ token: token ,
431
+ value: % WorkDoneProgressEnd {
432
+ kind: "end" ,
433
+ message: msg
434
+ }
435
+ }
436
+ } )
437
+ end
438
+
428
439
defp token ( ) do
429
440
8
430
441
|> :crypto . strong_rand_bytes ( )
0 commit comments