Sublime Forum

What are reasons why Sublime would grey out a plugin's menu options

#1

A plugin I use (filterlines) sometimes has a problem where the menu options that it adds via the Main.sublime-menu file are greyed out and unselectable.

I’m not the developer but I have looked at the code and there’s nothing in the plugin that looks like it would influence the “enabled” status of these menu items. (the developer has not been able to reproduce the issue, but a couple users have had it – see https://github.com/davidpeckham/sublime-filterlines/issues/53)

I am aware that plugins can implement a is_enabled callback which can be used to influence the enabled status of the commands. However, this plugin does not implement is_enabled, and according to the is_enabled documentation

(is_enabled) Returns True if the command is able to be run at this time. The default implementation simply always returns True

What other reasons, besides is_enabled might a plugin’s menu items be greyed out?

1 Like

#2

Can those commands be triggered by keybindings if they are grey-ed out? It looks like there is no steady way found yet to reproduce this issue?

0 Likes

#3

I believe when I had this issue I tried the keybinding and it did not work either. It has been a while since I have actually had this issue on my machine.

0 Likes

#4

Yes, that is correct, shortcuts don’t work either. I see the following command, but nothing happens.

command: prompt_filter_to_lines {"invert_search": false, "search_type": "string"}
0 Likes

#5

Menu items are disabled when the commands that they’re bound to are missing (for example if the plugin that contains them fails to load). In such a case you would expect that the commands are just always disabled unless the package that contains them was upgraded while Sublime is running, though.

In a similar vein if the plugin host goes away all plugin commands are inherently missing as a consequence (though in that case you’d likely notice that most everything is gone, which doesn’t sound like what’s happening here).

There is a known issue where package resources will not be loaded if the path inside the package contains the name of an ignored package, which would stop the plugin from loading for some people if they happened to have just the right packages ignored. However this package doesn’t appear to use a package layout like that.

1 Like

#6

You should check your console contents and look for load errors of the plugin(s) that provide the commands you are missing.

0 Likes

#7

No errors on console, and the fold commands for the plugin continue to work, but not the filter ones.

0 Likes

#8

Thanks all who contributed to isolating and fixing this. I released an update today that should fix the disabled menus.

FichteFoll pointed out that by importing the commands in filter.py into fold.py, I was forcing the ST plugin loader to load both commands twice, since it scans package root for subclasses of sublime_plugin.

So I merged to two files to resolve this issue.

1 Like