5
5
import * as vscode from 'vscode' ;
6
6
import { RequestType } from 'vscode-jsonrpc' ;
7
7
import { RoslynLanguageServer } from '../server/roslynLanguageServer' ;
8
+ import { PartialResultParams , ProtocolRequestType } from 'vscode-languageserver-protocol' ;
8
9
9
10
export class RoslynLanguageServerExport {
10
11
constructor ( private _serverInitialized : Promise < RoslynLanguageServer > ) { }
@@ -20,4 +21,17 @@ export class RoslynLanguageServerExport {
20
21
const newType = new RequestType < Params , Response , Error > ( type . method ) ;
21
22
return await server . sendRequest ( newType , params , token ) ;
22
23
}
24
+
25
+ public async sendRequestWithProgress < Params extends PartialResultParams , Response , PartialResult , Error , RegistrationOptions > (
26
+ type : ProtocolRequestType < Params , Response , PartialResult , Error , RegistrationOptions > ,
27
+ params : Params ,
28
+ onProgress : ( p : PartialResult ) => Promise < any > ,
29
+ token ?: vscode . CancellationToken
30
+ ) : Promise < Response > {
31
+ const server = await this . _serverInitialized ;
32
+ // We need to recreate the type parameter to ensure that the prototypes line up. The `ProtocolRequestType` we receive could have been
33
+ // from a different version.
34
+ const newType = new ProtocolRequestType < Params , Response , PartialResult , Error , RegistrationOptions > ( type . method ) ;
35
+ return await server . sendRequestWithProgress ( newType , params , onProgress , token ) ;
36
+ }
23
37
}
0 commit comments