@@ -410,17 +410,6 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
410
410
411
411
var ccp = new ClientCapabilityProvider ( _collection ) ;
412
412
413
- var defaultTextDocumentSyncOptions = new TextDocumentSyncOptions ( )
414
- {
415
- Change = TextDocumentSyncKind . None ,
416
- OpenClose = _collection . ContainsHandler ( typeof ( IDidOpenTextDocumentHandler ) ) || _collection . ContainsHandler ( typeof ( IDidCloseTextDocumentHandler ) ) ,
417
- Save = _collection . ContainsHandler ( typeof ( IDidSaveTextDocumentHandler ) ) ?
418
- new SaveOptions ( ) { IncludeText = true /* TODO: Make configurable */ } :
419
- null ,
420
- WillSave = _collection . ContainsHandler ( typeof ( IWillSaveTextDocumentHandler ) ) ,
421
- WillSaveWaitUntil = _collection . ContainsHandler ( typeof ( IWillSaveWaitUntilTextDocumentHandler ) )
422
- } ;
423
-
424
413
var serverCapabilities = new ServerCapabilities ( )
425
414
{
426
415
CodeActionProvider = ccp . GetStaticOptions ( textDocumentCapabilities . CodeAction ) . Get < ICodeActionOptions , CodeActionOptions > ( CodeActionOptions . Of ) ,
@@ -434,7 +423,7 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
434
423
DocumentRangeFormattingProvider = ccp . HasStaticHandler ( textDocumentCapabilities . RangeFormatting ) ,
435
424
DocumentSymbolProvider = ccp . HasStaticHandler ( textDocumentCapabilities . DocumentSymbol ) ,
436
425
ExecuteCommandProvider = ccp . GetStaticOptions ( workspaceCapabilities . ExecuteCommand ) . Reduce < IExecuteCommandOptions , ExecuteCommandOptions > ( ExecuteCommandOptions . Of ) ,
437
- TextDocumentSync = ccp . GetStaticOptions ( textDocumentCapabilities . Synchronization ) . Reduce < ITextDocumentSyncOptions , TextDocumentSyncOptions > ( TextDocumentSyncOptions . Of ( defaultTextDocumentSyncOptions ) ) ,
426
+ TextDocumentSync = ccp . GetStaticOptions ( textDocumentCapabilities . Synchronization ) . Reduce < ITextDocumentSyncOptions , TextDocumentSyncOptions > ( TextDocumentSyncOptions . Of ) ,
438
427
HoverProvider = ccp . HasStaticHandler ( textDocumentCapabilities . Hover ) ,
439
428
ReferencesProvider = ccp . HasStaticHandler ( textDocumentCapabilities . References ) ,
440
429
RenameProvider = ccp . GetStaticOptions ( textDocumentCapabilities . Rename ) . Get < IRenameOptions , RenameOptions > ( RenameOptions . Of ) ,
@@ -446,10 +435,6 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
446
435
FoldingRangeProvider = ccp . GetStaticOptions ( textDocumentCapabilities . FoldingRange ) . Get < IFoldingRangeOptions , FoldingRangeOptions > ( FoldingRangeOptions . Of ) ,
447
436
DeclarationProvider = ccp . GetStaticOptions ( textDocumentCapabilities . Declaration ) . Get < IDeclarationOptions , DeclarationOptions > ( DeclarationOptions . Of ) ,
448
437
} ;
449
- if ( serverCapabilities . TextDocumentSync . HasOptions )
450
- {
451
- defaultTextDocumentSyncOptions = serverCapabilities . TextDocumentSync . Options ;
452
- }
453
438
454
439
if ( _collection . ContainsHandler ( typeof ( IDidChangeWorkspaceFoldersHandler ) ) )
455
440
{
@@ -486,7 +471,16 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
486
471
}
487
472
else
488
473
{
489
- defaultTextDocumentSyncOptions . Change = textDocumentSyncKind ;
474
+ serverCapabilities . TextDocumentSync = new TextDocumentSyncOptions ( )
475
+ {
476
+ Change = TextDocumentSyncKind . None ,
477
+ OpenClose = ( _collection . ContainsHandler ( typeof ( IDidOpenTextDocumentHandler ) ) || _collection . ContainsHandler ( typeof ( IDidCloseTextDocumentHandler ) ) ) ,
478
+ Save = _collection . ContainsHandler ( typeof ( IDidSaveTextDocumentHandler ) ) ?
479
+ new SaveOptions ( ) { IncludeText = true /* TODO: Make configurable */ } :
480
+ null ,
481
+ WillSave = _collection . ContainsHandler ( typeof ( IWillSaveTextDocumentHandler ) ) ,
482
+ WillSaveWaitUntil = _collection . ContainsHandler ( typeof ( IWillSaveWaitUntilTextDocumentHandler ) )
483
+ } ;
490
484
}
491
485
}
492
486
0 commit comments