1
- using System ;
1
+ using System ;
2
2
using System . Collections . Concurrent ;
3
3
using System . Collections . Generic ;
4
4
using System . Diagnostics ;
13
13
using OmniSharp . Extensions . LanguageServer . Client . Dispatcher ;
14
14
using OmniSharp . Extensions . LanguageServer . Client . Handlers ;
15
15
using OmniSharp . Extensions . LanguageServer . Client . Logging ;
16
+ using OmniSharp . Extensions . LanguageServer . Protocol ;
16
17
using JsonRpcMessages = OmniSharp . Extensions . JsonRpc . Server . Messages ;
17
18
18
19
namespace OmniSharp . Extensions . LanguageServer . Client . Protocol
@@ -293,7 +294,7 @@ public void Disconnect(bool flushOutgoing = false)
293
294
/// </param>
294
295
public void SendEmptyNotification ( string method )
295
296
{
296
- if ( String . IsNullOrWhiteSpace ( method ) )
297
+ if ( string . IsNullOrWhiteSpace ( method ) )
297
298
throw new ArgumentException ( $ "Argument cannot be null, empty, or entirely composed of whitespace: { nameof ( method ) } .", nameof ( method ) ) ;
298
299
299
300
if ( ! IsOpen )
@@ -317,7 +318,7 @@ public void SendEmptyNotification(string method)
317
318
/// </param>
318
319
public void SendNotification ( string method , object notification )
319
320
{
320
- if ( String . IsNullOrWhiteSpace ( method ) )
321
+ if ( string . IsNullOrWhiteSpace ( method ) )
321
322
throw new ArgumentException ( $ "Argument cannot be null, empty, or entirely composed of whitespace: { nameof ( method ) } .", nameof ( method ) ) ;
322
323
323
324
if ( notification == null )
@@ -351,7 +352,7 @@ public void SendNotification(string method, object notification)
351
352
/// </returns>
352
353
public async Task SendRequest ( string method , object request , CancellationToken cancellationToken = default ( CancellationToken ) )
353
354
{
354
- if ( String . IsNullOrWhiteSpace ( method ) )
355
+ if ( string . IsNullOrWhiteSpace ( method ) )
355
356
throw new ArgumentException ( $ "Argument cannot be null, empty, or entirely composed of whitespace: { nameof ( method ) } .", nameof ( method ) ) ;
356
357
357
358
if ( request == null )
@@ -374,7 +375,7 @@ public void SendNotification(string method, object notification)
374
375
{
375
376
_outgoing . TryAdd ( new ClientMessage
376
377
{
377
- Method = "$/cancelRequest" ,
378
+ Method = GeneralNames . CancelRequest ,
378
379
Params = new JObject (
379
380
new JProperty ( "id" , requestId )
380
381
)
@@ -414,7 +415,7 @@ public void SendNotification(string method, object notification)
414
415
/// </returns>
415
416
public async Task < TResponse > SendRequest < TResponse > ( string method , object request , CancellationToken cancellationToken = default ( CancellationToken ) )
416
417
{
417
- if ( String . IsNullOrWhiteSpace ( method ) )
418
+ if ( string . IsNullOrWhiteSpace ( method ) )
418
419
throw new ArgumentException ( $ "Argument cannot be null, empty, or entirely composed of whitespace: { nameof ( method ) } .", nameof ( method ) ) ;
419
420
420
421
if ( request == null )
@@ -437,7 +438,7 @@ public void SendNotification(string method, object notification)
437
438
{
438
439
_outgoing . TryAdd ( new ClientMessage
439
440
{
440
- Method = "$/cancelRequest" ,
441
+ Method = GeneralNames . CancelRequest ,
441
442
Params = new JObject (
442
443
new JProperty ( "id" , requestId )
443
444
)
@@ -713,7 +714,7 @@ async Task<ServerMessage> ReceiveMessage()
713
714
string headers = HeaderEncoding . GetString ( headerBuffer , 0 , bytesRead ) ;
714
715
Log . LogDebug ( "Got raw headers: {Headers}" , headers ) ;
715
716
716
- if ( String . IsNullOrWhiteSpace ( headers ) )
717
+ if ( string . IsNullOrWhiteSpace ( headers ) )
717
718
return null ; // Stream closed.
718
719
719
720
Log . LogDebug ( "Read response headers {Headers}." , headers ) ;
@@ -806,7 +807,7 @@ async Task DispatchLoop()
806
807
if ( message . Id != null )
807
808
{
808
809
// Request.
809
- if ( message . Method == "$/cancelRequest" )
810
+ if ( message . Method == GeneralNames . CancelRequest )
810
811
CancelRequest ( message ) ;
811
812
else
812
813
DispatchRequest ( message ) ;
0 commit comments