@@ -410,17 +410,6 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
410410
411411 var ccp = new ClientCapabilityProvider ( _collection ) ;
412412
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-
424413 var serverCapabilities = new ServerCapabilities ( )
425414 {
426415 CodeActionProvider = ccp . GetStaticOptions ( textDocumentCapabilities . CodeAction ) . Get < ICodeActionOptions , CodeActionOptions > ( CodeActionOptions . Of ) ,
@@ -434,7 +423,7 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
434423 DocumentRangeFormattingProvider = ccp . HasStaticHandler ( textDocumentCapabilities . RangeFormatting ) ,
435424 DocumentSymbolProvider = ccp . HasStaticHandler ( textDocumentCapabilities . DocumentSymbol ) ,
436425 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 ) ,
438427 HoverProvider = ccp . HasStaticHandler ( textDocumentCapabilities . Hover ) ,
439428 ReferencesProvider = ccp . HasStaticHandler ( textDocumentCapabilities . References ) ,
440429 RenameProvider = ccp . GetStaticOptions ( textDocumentCapabilities . Rename ) . Get < IRenameOptions , RenameOptions > ( RenameOptions . Of ) ,
@@ -446,10 +435,6 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
446435 FoldingRangeProvider = ccp . GetStaticOptions ( textDocumentCapabilities . FoldingRange ) . Get < IFoldingRangeOptions , FoldingRangeOptions > ( FoldingRangeOptions . Of ) ,
447436 DeclarationProvider = ccp . GetStaticOptions ( textDocumentCapabilities . Declaration ) . Get < IDeclarationOptions , DeclarationOptions > ( DeclarationOptions . Of ) ,
448437 } ;
449- if ( serverCapabilities . TextDocumentSync . HasOptions )
450- {
451- defaultTextDocumentSyncOptions = serverCapabilities . TextDocumentSync . Options ;
452- }
453438
454439 if ( _collection . ContainsHandler ( typeof ( IDidChangeWorkspaceFoldersHandler ) ) )
455440 {
@@ -486,7 +471,16 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
486471 }
487472 else
488473 {
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+ } ;
490484 }
491485 }
492486
0 commit comments