Skip to content

Type hierarchy actions missing or not handled correctly #297

@asmodeus812

Description

@asmodeus812

Problem: Currently you HAVE to first call the typeHierarchy action to load the contents, then call the class, sub or super type to change the direction, then open the java.action.showTypeHierarchy again, to be able to then see the hierarchy, that is somewhat counter intuitive, one would expect that all of those open the panel

The extension registers several types of type hierarchy such as class, super, sub types. However these are not exposed as actions, to be visible to the user.

Expected: I would like to be able to programatically directly show the super,sub or class type hierarchy of the type under the cursor.

The final goal is to be able to programatically do the following, to directly open the given hierarchy.

            if action == "showSuperTypes" then
                vim.fn.CocAction("runCommand", "java.action.showSupertypeHierarchy", ...)
                handled = true
            elseif action == "showSubTypes" then
                vim.fn.CocAction("runCommand", "java.action.showSubtypeHierarchy", ...)
                handled = true
            end
      context.subscriptions.push(commands.registerCommand(Commands.SHOW_CLASS_HIERARCHY, () => {
        typeHierarchyTree.changeDirection(TypeHierarchyDirection.both)
      }, null, true))

      context.subscriptions.push(commands.registerCommand(Commands.SHOW_SUPERTYPE_HIERARCHY, () => {
        typeHierarchyTree.changeDirection(TypeHierarchyDirection.parents)
      }, null, true))

      context.subscriptions.push(commands.registerCommand(Commands.SHOW_SUBTYPE_HIERARCHY, () => {
        typeHierarchyTree.changeDirection(TypeHierarchyDirection.children)
      }, null, true))
      {
        "command": "java.action.showClassHierarchy",
        "title": "Show Class Hierarchy",
        "icon": "$(type-hierarchy)",
        "enablement": "typeHierarchyDirection != both && typeHierarchySymbolKind != 10",
        "category": "Java"
      },
      {
        "command": "java.action.showSupertypeHierarchy",
        "title": "Show Supertype Hierarchy",
        "icon": "$(type-hierarchy-super)",
        "enablement": "typeHierarchyDirection != parents",
        "category": "Java"
      },
      {
        "command": "java.action.showSubtypeHierarchy",
        "title": "Show Subtype Hierarchy",
        "icon": "$(type-hierarchy-sub)",
        "enablement": "typeHierarchyDirection != children",
        "category": "Java"
      },

Related: neoclide/coc.nvim#5351 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions