@@ -365,19 +365,24 @@ func sendRequest[Params, Resp any](t *testing.T, f *FourslashTest, info lsproto.
365365 // !!! remove if `config` is handled in initialization and there are no other server-initiated requests
366366 if resp .Kind == lsproto .MessageKindRequest {
367367 req := resp .AsRequest ()
368- switch req .Method {
369- case lsproto .MethodWorkspaceConfiguration :
370- req := lsproto.ResponseMessage {
371- ID : req .ID ,
372- JSONRPC : req .JSONRPC ,
373- Result : []any {f .userPreferences },
374- }
375- f .writeMsg (t , req .Message ())
376- resp = f .readMsg (t )
377- default :
378- // other types of requests not yet used in fourslash; implement them if needed
379- t .Fatalf ("Unexpected request received: %s" , req .Method )
368+
369+ assert .Equal (t , req .Method , lsproto .MethodWorkspaceConfiguration , "Unexpected request received: %s" , req .Method )
370+ res := lsproto.ResponseMessage {
371+ ID : req .ID ,
372+ JSONRPC : req .JSONRPC ,
373+ Result : []any {f .userPreferences },
380374 }
375+ f .writeMsg (t , res .Message ())
376+ req = f .readMsg (t ).AsRequest ()
377+
378+ assert .Equal (t , req .Method , lsproto .MethodClientRegisterCapability , "Unexpected request received: %s" , req .Method )
379+ res = lsproto.ResponseMessage {
380+ ID : req .ID ,
381+ JSONRPC : req .JSONRPC ,
382+ Result : lsproto.Null {},
383+ }
384+ f .writeMsg (t , res .Message ())
385+ resp = f .readMsg (t )
381386 }
382387
383388 if resp == nil {
@@ -413,9 +418,16 @@ func (f *FourslashTest) readMsg(t *testing.T) *lsproto.Message {
413418}
414419
415420func (f * FourslashTest ) Configure (t * testing.T , config * lsutil.UserPreferences ) {
421+ // !!!
422+ // Callers to this function may need to consider
423+ // sending a more specific configuration for 'javascript'
424+ // or 'js/ts' as well. For now, we only send 'typescript',
425+ // and most tests probably just want this.
416426 f .userPreferences = config
417427 sendNotification (t , f , lsproto .WorkspaceDidChangeConfigurationInfo , & lsproto.DidChangeConfigurationParams {
418- Settings : config ,
428+ Settings : map [string ]any {
429+ "typescript" : config ,
430+ },
419431 })
420432}
421433
0 commit comments