@@ -29,12 +29,13 @@ import * as fileEventHandler from './fileEventHandler';
2929import { markdownPreviewProvider } from "./markdownPreviewProvider" ;
3030import { RefactorDocumentProvider , javaRefactorKinds } from "./codeActionProvider" ;
3131import { typeHierarchyTree } from "./typeHierarchy/typeHierarchyTree" ;
32- import { TypeHierarchyDirection , TypeHierarchyItem } from "./typeHierarchy/protocol" ;
3332import { buildFilePatterns } from './plugin' ;
3433import { pomCodeActionMetadata , PomCodeActionProvider } from "./pom/pomCodeActionProvider" ;
3534import { findRuntimes , IJavaRuntime } from "jdk-utils" ;
3635import { snippetCompletionProvider } from "./snippetCompletionProvider" ;
3736import { JavaInlayHintsProvider } from "./inlayHintsProvider" ;
37+ import { TypeHierarchyFeature } from "vscode-languageclient/lib/common/proposed.typeHierarchy" ;
38+ import { CodeTypeHierarchyItem } from "./typeHierarchy/protocol" ;
3839
3940const extensionName = 'Language Support for Java' ;
4041const GRADLE_CHECKSUM = "gradle/checksum/prompt" ;
@@ -100,7 +101,7 @@ export class StandardLanguageClient {
100101
101102 // Create the language client and start the client.
102103 this . languageClient = new LanguageClient ( 'java' , extensionName , serverOptions , clientOptions ) ;
103-
104+ this . languageClient . registerFeature ( new TypeHierarchyFeature ( this . languageClient ) ) ;
104105 this . languageClient . onReady ( ) . then ( ( ) => {
105106 activationProgressNotification . showProgress ( ) ;
106107 this . languageClient . onNotification ( StatusNotification . type , ( report ) => {
@@ -375,30 +376,18 @@ export class StandardLanguageClient {
375376 }
376377 } ) ) ;
377378
378- context . subscriptions . push ( commands . registerCommand ( Commands . SHOW_TYPE_HIERARCHY , ( location : any ) => {
379+ context . subscriptions . push ( commands . registerCommand ( Commands . SHOW_CLASS_HIERARCHY , ( location : any ) => {
379380 if ( location instanceof Uri ) {
380- typeHierarchyTree . setTypeHierarchy ( new Location ( location , window . activeTextEditor . selection . active ) , TypeHierarchyDirection . Both ) ;
381+ typeHierarchyTree . setTypeHierarchy ( new Location ( location , window . activeTextEditor . selection . active ) ) ;
381382 } else {
382383 if ( window . activeTextEditor ?. document ?. languageId !== "java" ) {
383384 return ;
384385 }
385- typeHierarchyTree . setTypeHierarchy ( new Location ( window . activeTextEditor . document . uri , window . activeTextEditor . selection . active ) , TypeHierarchyDirection . Both ) ;
386+ typeHierarchyTree . setTypeHierarchy ( new Location ( window . activeTextEditor . document . uri , window . activeTextEditor . selection . active ) ) ;
386387 }
387388 } ) ) ;
388389
389- context . subscriptions . push ( commands . registerCommand ( Commands . SHOW_CLASS_HIERARCHY , ( ) => {
390- typeHierarchyTree . changeDirection ( TypeHierarchyDirection . Both ) ;
391- } ) ) ;
392-
393- context . subscriptions . push ( commands . registerCommand ( Commands . SHOW_SUPERTYPE_HIERARCHY , ( ) => {
394- typeHierarchyTree . changeDirection ( TypeHierarchyDirection . Parents ) ;
395- } ) ) ;
396-
397- context . subscriptions . push ( commands . registerCommand ( Commands . SHOW_SUBTYPE_HIERARCHY , ( ) => {
398- typeHierarchyTree . changeDirection ( TypeHierarchyDirection . Children ) ;
399- } ) ) ;
400-
401- context . subscriptions . push ( commands . registerCommand ( Commands . CHANGE_BASE_TYPE , async ( item : TypeHierarchyItem ) => {
390+ context . subscriptions . push ( commands . registerCommand ( Commands . CHANGE_BASE_TYPE , async ( item : CodeTypeHierarchyItem ) => {
402391 typeHierarchyTree . changeBaseItem ( item ) ;
403392 } ) ) ;
404393
0 commit comments