@@ -307,6 +307,7 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
307
307
DocumentRangeFormattingProvider = ccp . HasStaticHandler ( textDocumentCapabilities . RangeFormatting ) ,
308
308
DocumentSymbolProvider = ccp . HasStaticHandler ( textDocumentCapabilities . DocumentSymbol ) ,
309
309
ExecuteCommandProvider = ccp . GetStaticOptions ( workspaceCapabilities . ExecuteCommand ) . Reduce < IExecuteCommandOptions , ExecuteCommandOptions > ( ExecuteCommandOptions . Of ) ,
310
+ TextDocumentSync = ccp . GetStaticOptions ( textDocumentCapabilities . Synchronization ) . Reduce < ITextDocumentSyncOptions , TextDocumentSyncOptions > ( TextDocumentSyncOptions . Of ) ,
310
311
HoverProvider = ccp . HasStaticHandler ( textDocumentCapabilities . Hover ) ,
311
312
ReferencesProvider = ccp . HasStaticHandler ( textDocumentCapabilities . References ) ,
312
313
RenameProvider = ccp . GetStaticOptions ( textDocumentCapabilities . Rename ) . Get < IRenameOptions , RenameOptions > ( RenameOptions . Of ) ,
@@ -330,30 +331,33 @@ async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>
330
331
} ;
331
332
}
332
333
333
- var textDocumentSyncKind = _collection . ContainsHandler ( typeof ( IDidChangeTextDocumentHandler ) )
334
- ? _collection
335
- . Select ( x => x . Handler )
336
- . OfType < IDidChangeTextDocumentHandler > ( )
337
- . Where ( x => x . Change != TextDocumentSyncKind . None )
338
- . Min ( z => z . Change )
339
- : TextDocumentSyncKind . None ;
340
-
341
- if ( _clientVersion == ClientVersion . Lsp2 )
334
+ if ( ccp . HasStaticHandler ( textDocumentCapabilities . Synchronization ) )
342
335
{
343
- serverCapabilities . TextDocumentSync = textDocumentSyncKind ;
344
- }
345
- else
346
- {
347
- serverCapabilities . TextDocumentSync = new TextDocumentSyncOptions ( )
336
+ var textDocumentSyncKind = _collection . ContainsHandler ( typeof ( IDidChangeTextDocumentHandler ) )
337
+ ? _collection
338
+ . Select ( x => x . Handler )
339
+ . OfType < IDidChangeTextDocumentHandler > ( )
340
+ . Where ( x => x . Change != TextDocumentSyncKind . None )
341
+ . Min ( z => z . Change )
342
+ : TextDocumentSyncKind . None ;
343
+
344
+ if ( _clientVersion == ClientVersion . Lsp2 )
348
345
{
349
- Change = textDocumentSyncKind ,
350
- OpenClose = _collection . ContainsHandler ( typeof ( IDidOpenTextDocumentHandler ) ) || _collection . ContainsHandler ( typeof ( IDidCloseTextDocumentHandler ) ) ,
351
- Save = _collection . ContainsHandler ( typeof ( IDidSaveTextDocumentHandler ) ) ?
352
- new SaveOptions ( ) { IncludeText = true /* TODO: Make configurable */ } :
353
- null ,
354
- WillSave = _collection . ContainsHandler ( typeof ( IWillSaveTextDocumentHandler ) ) ,
355
- WillSaveWaitUntil = _collection . ContainsHandler ( typeof ( IWillSaveWaitUntilTextDocumentHandler ) )
356
- } ;
346
+ serverCapabilities . TextDocumentSync = textDocumentSyncKind ;
347
+ }
348
+ else
349
+ {
350
+ serverCapabilities . TextDocumentSync = new TextDocumentSyncOptions ( )
351
+ {
352
+ Change = textDocumentSyncKind ,
353
+ OpenClose = _collection . ContainsHandler ( typeof ( IDidOpenTextDocumentHandler ) ) || _collection . ContainsHandler ( typeof ( IDidCloseTextDocumentHandler ) ) ,
354
+ Save = _collection . ContainsHandler ( typeof ( IDidSaveTextDocumentHandler ) ) ?
355
+ new SaveOptions ( ) { IncludeText = true /* TODO: Make configurable */ } :
356
+ null ,
357
+ WillSave = _collection . ContainsHandler ( typeof ( IWillSaveTextDocumentHandler ) ) ,
358
+ WillSaveWaitUntil = _collection . ContainsHandler ( typeof ( IWillSaveWaitUntilTextDocumentHandler ) )
359
+ } ;
360
+ }
357
361
}
358
362
359
363
// TODO: Need a call back here
0 commit comments