Sublime Forum

Consol Panel Set Logging true and Enter

#1

Hi I’m trying to ‘send’ commands to the consol panel (the one activated by ctrl+`. Here are some things that don’t work !

  {
    "keys": [
      "super+l", "super+c"
    ],
    "command": "multicommand",
    "args": {
      "commands": [
        {
          "command": "show_panel", "args": {
            "panel": "console",
            "toggle": true}
        },
        {
          "command": "insert", "args": {"characters": "sublime.log_commands(True)"}
         }, 
        {
          "command": "insert", "args": {"characters": "\n: "} ,
        }
      ]
    }
  },

Getting the enter key press to work isn’t ! (Not that I was expecting it to work, but hey though I’d give it a go !)
This doesn’t work also:

{ "keys": ["super+l", "super+c"], "command": "toggle_log_command"},

I use that panel a lot as well as logging commands as true as well as one or two other options. Would be very handy to have bound to some keys…

Any thoughts pls folks ?

Cheers Loz

0 Likes

#2

You might be interested in the plugin below if the goal is to toggle the state of logging on and off.

It’s a bit out of date in as much as there are other logging facilities now that this doesn’t cover (such as sublime.log_control_tree()) and the fact that in ST4 you can both toggle the state of logging by invoking the endpoint without an argument as well as query what the current value is.

Regardless, it will still work just fine, so long as you don’t reload the plugin while logging is turned on (which in practice should never happen).

1 Like

#3

Thank you. I’ve been Pythoning all day, so back to the C++ for the last hour or two in the day. Child care tomorrow, so will get back on it’s performance prob beginning of week.

:unicorn: :skull_and_crossbones:

0 Likes

#4
 In a sublime-menu, the command will display as checked when logging for that
# type of log is enabled if  you include the "checkbox" attribute to the menu
# entry. The command also has a default description which displays what command
# it will execute when it's selected.
#
# As an example, you can add the following to a file named Context.sublime-menu
# in your User package to include the commands in the context menu.
#
# [
    # { "caption": "-", "id": "end" },
    # {
    #     "command": "toggle_sublime_logging",
    #     "checkbox": true,
    #     "caption": "Log Commands",
    #     "args": {"log_type": "log_commands"},
    # },
    # {
    #     "command": "toggle_sublime_logging",
    #     "checkbox": true,
    #     "caption": "Log Input",
    #     "args": {"log_type": "log_input"},
    # },
    # {
    #     "command": "toggle_sublime_logging",
    #     "checkbox": true,
    #     "caption": "Log Result Regex",
    #     "args": {"log_type": "log_result_regex"},
    # },
    # {
    #     "command": "toggle_sublime_logging",
    #     "checkbox": true,
    #     "caption": "Log Build Systems",
    #     "args": {"log_type": "log_build_systens"},
    # }
# ]

The bit above is what I don’t understand. I’ve tried the context.sublime-menu example on the relavent page but couldn’t get it to work. Can I just skip the context menu, and will it just toggle the values ?

0 Likes

#5

Yeah that would work find as well. Note that the name of the file is important; context.sublime-menu won’t work; it has to be upper case Context.sublime-menu. If it works, you see the relevant items in the context menu.

0 Likes