@@ -191,6 +191,73 @@ public async Task Completions_Success()
191
191
} ) ;
192
192
}
193
193
194
+ /// <summary>
195
+ /// Ensure that the language client can successfully request SignatureHelp.
196
+ /// </summary>
197
+ [ Fact ( DisplayName = "Language client can successfully request signature help" , Skip = "Periodic failures" ) ]
198
+ public async Task SignatureHelp_Success ( )
199
+ {
200
+ await Connect ( ) ;
201
+
202
+ const int line = 5 ;
203
+ const int column = 5 ;
204
+ var expectedDocumentPath = AbsoluteDocumentPath ;
205
+ var expectedDocumentUri = DocumentUri . FromFileSystemPath ( expectedDocumentPath ) ;
206
+
207
+ var expectedSignatureHelp = new SignatureHelp {
208
+ ActiveParameter = 0 ,
209
+ ActiveSignature = 0 ,
210
+ Signatures = new [ ] {
211
+ new SignatureInformation {
212
+ Documentation = new StringOrMarkupContent ( "test documentation" ) ,
213
+ Label = "TestSignature" ,
214
+ Parameters = new [ ] {
215
+ new ParameterInformation {
216
+ Documentation = "test parameter documentation" ,
217
+ Label = "parameter label"
218
+ }
219
+ }
220
+ }
221
+ }
222
+ } ;
223
+
224
+ ServerDispatcher . HandleRequest < TextDocumentPositionParams , SignatureHelp > ( DocumentNames . SignatureHelp , ( request , cancellationToken ) => {
225
+ Assert . NotNull ( request . TextDocument ) ;
226
+
227
+ Assert . Equal ( expectedDocumentUri , request . TextDocument . Uri ) ;
228
+
229
+ Assert . Equal ( line , request . Position . Line ) ;
230
+ Assert . Equal ( column , request . Position . Character ) ;
231
+
232
+ return Task . FromResult ( expectedSignatureHelp ) ;
233
+ } ) ;
234
+
235
+ var actualSignatureHelp = await LanguageClient . TextDocument . SignatureHelp ( AbsoluteDocumentPath , line , column ) ;
236
+
237
+ Assert . Equal ( expectedSignatureHelp . ActiveParameter , actualSignatureHelp . ActiveParameter ) ;
238
+ Assert . Equal ( expectedSignatureHelp . ActiveSignature , actualSignatureHelp . ActiveSignature ) ;
239
+
240
+ var actualSignatures = actualSignatureHelp . Signatures . ToArray ( ) ;
241
+ Assert . Collection ( actualSignatures , actualSignature => {
242
+ var expectedSignature = expectedSignatureHelp . Signatures . ToArray ( ) [ 0 ] ;
243
+
244
+ Assert . True ( actualSignature . Documentation . HasString ) ;
245
+ Assert . Equal ( expectedSignature . Documentation . String , actualSignature . Documentation . String ) ;
246
+
247
+ Assert . Equal ( expectedSignature . Label , actualSignature . Label ) ;
248
+
249
+ var expectedParameters = expectedSignature . Parameters . ToArray ( ) ;
250
+ var actualParameters = actualSignature . Parameters . ToArray ( ) ;
251
+
252
+ Assert . Collection ( actualParameters , actualParameter => {
253
+ var expectedParameter = expectedParameters [ 0 ] ;
254
+ Assert . True ( actualParameter . Documentation . HasString ) ;
255
+ Assert . Equal ( expectedParameter . Documentation . String , actualParameter . Documentation . String ) ;
256
+ Assert . Equal ( expectedParameter . Label , actualParameter . Label ) ;
257
+ } ) ;
258
+ } ) ;
259
+ }
260
+
194
261
/// <summary>
195
262
/// Ensure that the language client can successfully receive Diagnostics from the server.
196
263
/// </summary>
0 commit comments