Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move TypeHierarchy to LSP #2033

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions org.eclipse.jdt.ls.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ Export-Package: org.eclipse.jdt.ls.core.contentassist;x-friends:="org.eclipse.jd
org.eclipse.jdt.ls.core.internal.syntaxserver;x-friends:="org.eclipse.jdt.ls.tests.syntaxserver",
org.eclipse.jdt.ls.core.internal.text.correction;x-friends:="org.eclipse.jdt.ls.tests",
org.eclipse.jdt.ls.internal.gradle.checksums;x-friends:="org.eclipse.jdt.ls.tests",
org.eclipse.lsp4j.extended;x-friends:="org.eclipse.jdt.ls.tests",
org.eclipse.lsp4j.legacy.typeHierarchy;x-friends:="org.eclipse.jdt.ls.tests"
org.eclipse.lsp4j.extended;x-friends:="org.eclipse.jdt.ls.tests"
Bundle-ClassPath: lib/jsoup-1.14.2.jar,
lib/remark-1.2.0.jar,
.
Expand Down
6 changes: 0 additions & 6 deletions org.eclipse.jdt.ls.core/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@
<command
id="java.project.resolveStackTraceLocation">
</command>
<command
id="java.navigate.openTypeHierarchy">
</command>
<command
id="java.navigate.resolveTypeHierarchy">
</command>
<command
id="java.project.upgradeGradle">
</command>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.eclipse.jdt.ls.core.internal.commands.ProjectCommand;
import org.eclipse.jdt.ls.core.internal.commands.ProjectCommand.ClasspathOptions;
import org.eclipse.jdt.ls.core.internal.commands.SourceAttachmentCommand;
import org.eclipse.jdt.ls.core.internal.commands.TypeHierarchyCommand;
import org.eclipse.jdt.ls.core.internal.framework.protobuf.ProtobufSupport;
import org.eclipse.jdt.ls.core.internal.handlers.BundleUtils;
import org.eclipse.jdt.ls.core.internal.handlers.CompletionHandler;
Expand All @@ -42,12 +41,7 @@
import org.eclipse.jdt.ls.core.internal.handlers.ResolveSourceMappingHandler;
import org.eclipse.jdt.ls.core.internal.managers.GradleProjectImporter;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.TextDocumentPositionParams;
import org.eclipse.lsp4j.WorkspaceEdit;
import org.eclipse.lsp4j.legacy.typeHierarchy.ResolveTypeHierarchyItemParams;
import org.eclipse.lsp4j.legacy.typeHierarchy.TypeHierarchyDirection;
import org.eclipse.lsp4j.legacy.typeHierarchy.TypeHierarchyItem;
import org.eclipse.lsp4j.legacy.typeHierarchy.TypeHierarchyParams;

public class JDTDelegateCommandHandler implements IDelegateCommandHandler {

Expand Down Expand Up @@ -108,29 +102,6 @@ public Object executeCommand(String commandId, List<Object> arguments, IProgress
projectNames = (ArrayList<String>) arguments.get(1);
}
return ResolveSourceMappingHandler.resolveStackTraceLocation((String) arguments.get(0), projectNames);
case "java.navigate.resolveTypeHierarchy":
TypeHierarchyCommand resolveTypeHierarchyCommand = new TypeHierarchyCommand();
TypeHierarchyItem toResolve = JSONUtility.toModel(arguments.get(0), TypeHierarchyItem.class);
TypeHierarchyDirection resolveDirection = TypeHierarchyDirection.forValue(JSONUtility.toModel(arguments.get(1), Integer.class));
int resolveDepth = JSONUtility.toModel(arguments.get(2), Integer.class);
ResolveTypeHierarchyItemParams resolveParams = new ResolveTypeHierarchyItemParams();
resolveParams.setItem(toResolve);
resolveParams.setDirection(resolveDirection);
resolveParams.setResolve(resolveDepth);
TypeHierarchyItem resolvedItem = resolveTypeHierarchyCommand.resolveTypeHierarchy(resolveParams, monitor);
return resolvedItem;
case "java.navigate.openTypeHierarchy":
TypeHierarchyCommand typeHierarchyCommand = new TypeHierarchyCommand();
TypeHierarchyParams params = new TypeHierarchyParams();
TextDocumentPositionParams textParams = JSONUtility.toModel(arguments.get(0), TextDocumentPositionParams.class);
TypeHierarchyDirection direction = TypeHierarchyDirection.forValue(JSONUtility.toModel(arguments.get(1), Integer.class));
int resolve = JSONUtility.toModel(arguments.get(2), Integer.class);
params.setResolve(resolve);
params.setDirection(direction);
params.setTextDocument(textParams.getTextDocument());
params.setPosition(textParams.getPosition());
TypeHierarchyItem typeHierarchyItem = typeHierarchyCommand.typeHierarchy(params, monitor);
return typeHierarchyItem;
case "java.project.upgradeGradle":
String projectUri = (String) arguments.get(0);
String gradleVersion = arguments.size() > 1 ? (String) arguments.get(1) : null;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ 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
Loading