Sublime Forum

How to hide parent menu entry using the `is_visible`?

#1

How to hide parent menu entry using the is_visible?

Well, if there is the is_visible for the children, why not for its parent?

I tried to use the is_visible command as this bellow, but not success:

import sublime
import sublime_plugin

class AnacondaContextMenuVisibilityCommand(sublime_plugin.TextCommand):

    def run(self, edit):

        return False


    def is_visible(self):

        print( ' Calling AnacondaContextMenuVisibilityCommand is_visible...' )
        return False

Does not work for this menu entry file:

[
    {
        "caption": "Anaconda",
        "command": "anaconda_context_menu_visibility",
        "id": "anaconda_context",
        "children":
        [
            {
                "command": "anaconda_goto",
                "caption": "Goto Definition"
            },
        ]
    }
]

Related threads:

  1. https://github.com/DamnWidget/anaconda/issues/571
  2. https://github.com/SublimeTextIssues/Core/issues/1095
  3. Hide parent menu item in context menu
0 Likes