Skip to content

Commit

Permalink
Respect client capabilities for type hierarchy.
Browse files Browse the repository at this point in the history
Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
  • Loading branch information
rgrunber committed Aug 24, 2023
1 parent e843c2c commit 8f12703
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ public void registerCapabilities(InitializeResult initializeResult) {
capabilities.setInlayHintProvider(Boolean.TRUE);
}

if (!preferenceManager.getClientPreferences().isTypeHierarchyDynamicRegistrationSupported()) {
capabilities.setTypeHierarchyProvider(Boolean.TRUE);
}

capabilities.setCallHierarchyProvider(Boolean.TRUE);
TextDocumentSyncOptions textDocumentSyncOptions = new TextDocumentSyncOptions();
textDocumentSyncOptions.setOpenClose(Boolean.TRUE);
Expand Down Expand Up @@ -221,7 +225,6 @@ public void registerCapabilities(InitializeResult initializeResult) {
semanticTokensOptions.setDocumentSelector(List.of(new DocumentFilter("java", "file", null), new DocumentFilter("java", "jdt", null)));
semanticTokensOptions.setLegend(SemanticTokensHandler.legend());
capabilities.setSemanticTokensProvider(semanticTokensOptions);
capabilities.setTypeHierarchyProvider(Boolean.TRUE);

initializeResult.setCapabilities(capabilities);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ public boolean isCallHierarchyDynamicRegistered() {
return v3supported && isDynamicRegistrationSupported(capabilities.getTextDocument().getCallHierarchy());
}

public boolean isTypeHierarchyDynamicRegistrationSupported() {
return v3supported && isDynamicRegistrationSupported(capabilities.getTextDocument().getTypeHierarchy());
}

public boolean isResolveCodeActionSupported() {
//@formatter:off
return v3supported && capabilities.getTextDocument().getCodeAction() != null
Expand Down

0 comments on commit 8f12703

Please sign in to comment.