|
51 | 51 | import org.eclipse.lsp4j.DocumentFormattingParams; |
52 | 52 | import org.eclipse.lsp4j.DocumentSymbol; |
53 | 53 | import org.eclipse.lsp4j.DocumentSymbolParams; |
| 54 | +import org.eclipse.lsp4j.DynamicRegistrationCapabilities; |
54 | 55 | import org.eclipse.lsp4j.FoldingRange; |
55 | 56 | import org.eclipse.lsp4j.FoldingRangeRequestParams; |
56 | 57 | import org.eclipse.lsp4j.Hover; |
|
77 | 78 | import org.eclipse.lsp4j.SetTraceParams; |
78 | 79 | import org.eclipse.lsp4j.SymbolInformation; |
79 | 80 | import org.eclipse.lsp4j.TextDocumentChangeRegistrationOptions; |
| 81 | +import org.eclipse.lsp4j.TextDocumentClientCapabilities; |
80 | 82 | import org.eclipse.lsp4j.TextDocumentContentChangeEvent; |
81 | 83 | import org.eclipse.lsp4j.TextDocumentIdentifier; |
82 | 84 | import org.eclipse.lsp4j.TextDocumentRegistrationOptions; |
@@ -273,10 +275,11 @@ public void initialized(InitializedParams params) { |
273 | 275 | } |
274 | 276 |
|
275 | 277 | private boolean isDynamicSyncRegistrationSupported() { |
276 | | - return clientCapabilities != null |
277 | | - && clientCapabilities.getTextDocument() != null |
278 | | - && clientCapabilities.getTextDocument().getSynchronization() != null |
279 | | - && clientCapabilities.getTextDocument().getSynchronization().getDynamicRegistration(); |
| 278 | + return Optional.ofNullable(clientCapabilities) |
| 279 | + .map(ClientCapabilities::getTextDocument) |
| 280 | + .map(TextDocumentClientCapabilities::getSynchronization) |
| 281 | + .map(DynamicRegistrationCapabilities::getDynamicRegistration) |
| 282 | + .orElse(false); |
280 | 283 | } |
281 | 284 |
|
282 | 285 | private void registerDocumentSynchronization() { |
|
0 commit comments