eerohele / Tutkain

A Sublime Text package for interactive Clojure development
https://tutkain.flowthing.me
Other
68 stars 8 forks source link

Define ouput view type through user settings file, instead REPL output view is `panel` by deafult, #103

Closed lensgolda closed 1 year ago

lensgolda commented 1 year ago

Hi, By default output view is created with ouput=panel when run TutkainConnectCommand through ST Command Pallette. And there is no way to set this option with Tutkain user settings file, accept ...well, Tutkain Keybindings like this:

// Connect to a socket server.
    {
        "keys": ["ctrl+c", "ctrl+x"],
        "command": "tutkain_connect",
        "args": {"host": "localhost", "output": "view"}
    },

So only when you set something different from "output": "panel", REPL view opens in vertical oriented tab, like normal file view, here it is. And this is what i actually want should be. Because maybe i'm the only one, who don't like that REPL view opened at the window bottom, and showed horizontally oriented. Ok, maybe i didn't found how to do that another way. The one thing i have found, is that option

// Valid options:
  // - "horizontal"
  // - "vertical"
  "layout": "horizontal",

but it's not working for me, no matter where and how i'm trying to configure it.

-- All the Best

eerohele commented 1 year ago

Thanks for reporting the issue!

Defining a key binding as above combined with Package Settings » Tutkain » "layout": "vertical" definitely should work. I just tested it, and it works on my machine™.

I'm not sure why it's not working for you. I'll try to look into it a bit more when I get the time.

lensgolda commented 1 year ago

Thanks for reply! Like i mentioned, that works like a charm, when you call Connect from binded keys pressed, and output set to view. But, ST has it's own Command Pallette (by default keys mapped are Cmd+Shift+P, type Tutkain Connect and press Enter, and it would be shown at the bottom and horizontally.

eerohele commented 1 year ago

Oh, I see, I misunderstood — apologies.

Yeah, Tutkain doesn't let you choose between a panel and a view when connecting via the command palette, because I don't want to force the user to go through too many inputs.

One thing you could do is make your own custom command:

  1. In the User directory under the Sublime Text Packages directory (you can find it via Preferences » Browse Packages… on macOS), create a file called MyAwesomeCommands.sublime-commands.
  2. In MyAwesomeCommands.sublime-commands, add this content:

    {
      "caption": "Tutkain: My Awesome Connect",
      "command": "tutkain_connect",
      "args": {"host": "localhost", "output": "view"}
    },
  3. Save the file.

Tutkain: My Awesome Connect should now show up in your command palette.

You can obviously further customize the command (e.g. add a port number if you always connect to the same port).

An additional tip: you can use .sublime-commands to add all kinds of useful commands into the Command Palette. For example, here's my custom command file (and a bit of explanation if you're in the Clojurians Slack).

lensgolda commented 1 year ago

Thank you many times, it suits me perfectly!