Sublime Forum

[Solved][Question] How hide popout menu by trigger?

#1

Briefly

I can not find, how I can run only command for hide popout menu by trigger (hotkey preferable).

Detail

«Popout menu» — name of autocompletes menu in «Writing Sublime Plugins» book.

I need command, only hide popout menu by triggers. If I record macros, some commands have different behavior when popout menu disabled and enabled. For example, command: run_macro_file {"file": "res://Packages/Default/Add Line Before.sublime-macro"} have different carriage position:

Also, if I have pressing Tab or Enter in my macros, I have different behavior, when popout menu disabled/enabled.

Do not offer

  • Please, don’t offer add in my User/Preferences.sublime-settings file line
"auto_complete": false,

I need use autocompletes, but I need command for hide it.

  • Please, do not offer add in User/Preferences.sublime-settings file line
"auto_complete_commit_on_tab": true,

It has nothing to do with my question.

  • Please, do not offer, how switch "auto_complete": true, to false and false to true in settings by trigger. Users don’t must need disabled autocompletes that run macros.

Thanks.

0 Likes

#2

we know that we can press Esc to close the autocomplete popup, so by checking in the Default keybindings file, we find:

{ "keys": ["escape"], "command": "hide_auto_complete", "context":
    [
        { "key": "auto_complete_visible", "operator": "equal", "operand": true }
    ]
},

so the answer is that the hide_auto_complete command will hide the autocomplete “popout menu” if it is shown

6 Likes

#3

Thank you very much! It’s worked!

But I not understand, why we need "operator": "equal", "operand": true. Always I not write these parameters.

{ "keys": ["escape"], "command": "hide_auto_complete", "context":
    [
        { "key": "auto_complete_visible"}
    ]
},

I read documentation page, but I did not understand what the need "operator": "equal", "operand": true.

Thanks.

0 Likes

#4

These are the default values for operator and operand, so you can omit them. However if you want to enable a keybinding if the autocomplete is not visible you need to change "operator": "not_equal" (x)or "operand": false.

1 Like