@@ -19,13 +19,15 @@ export function register(tree: SymbolsTree, context: vscode.ExtensionContext): v
19
19
}
20
20
}
21
21
22
- function setTypeHierarchyDirection ( value : TypeHierarchyDirection , anchor : TypeItem | unknown ) {
22
+ function setTypeHierarchyDirection ( value : TypeHierarchyDirection , anchor : TypeItem | vscode . Location | unknown ) {
23
23
direction . value = value ;
24
24
25
25
let newInput : TypesTreeInput | undefined ;
26
26
const oldInput = tree . getInput ( ) ;
27
27
if ( anchor instanceof TypeItem ) {
28
28
newInput = new TypesTreeInput ( new vscode . Location ( anchor . item . uri , anchor . item . selectionRange . start ) , direction . value ) ;
29
+ } else if ( anchor instanceof vscode . Location ) {
30
+ newInput = new TypesTreeInput ( anchor , direction . value ) ;
29
31
} else if ( oldInput instanceof TypesTreeInput ) {
30
32
newInput = new TypesTreeInput ( oldInput . location , direction . value ) ;
31
33
}
@@ -36,8 +38,8 @@ export function register(tree: SymbolsTree, context: vscode.ExtensionContext): v
36
38
37
39
context . subscriptions . push (
38
40
vscode . commands . registerCommand ( 'references-view.showTypeHierarchy' , showTypeHierarchy ) ,
39
- vscode . commands . registerCommand ( 'references-view.showSupertypes' , ( item : TypeItem | unknown ) => setTypeHierarchyDirection ( TypeHierarchyDirection . Supertypes , item ) ) ,
40
- vscode . commands . registerCommand ( 'references-view.showSubtypes' , ( item : TypeItem | unknown ) => setTypeHierarchyDirection ( TypeHierarchyDirection . Subtypes , item ) ) ,
41
+ vscode . commands . registerCommand ( 'references-view.showSupertypes' , ( item : TypeItem | vscode . Location | unknown ) => setTypeHierarchyDirection ( TypeHierarchyDirection . Supertypes , item ) ) ,
42
+ vscode . commands . registerCommand ( 'references-view.showSubtypes' , ( item : TypeItem | vscode . Location | unknown ) => setTypeHierarchyDirection ( TypeHierarchyDirection . Subtypes , item ) ) ,
41
43
vscode . commands . registerCommand ( 'references-view.removeTypeItem' , removeTypeItem )
42
44
) ;
43
45
}
0 commit comments