BenWildeman / vscode-tabulous

Adds tabs for each terminal process to the status bar
https://marketplace.visualstudio.com/items?itemName=bwildeman.tabulous
MIT License
12 stars 2 forks source link

Option to name tabs by current directory instead of current process #17

Closed plwalsh closed 3 years ago

plwalsh commented 4 years ago

It would be great to have setting that gives you the option of having tabs automatically be named by their current directory rather than their currently running process. I like to have multiple terminal tabs open to different directories to easily hop around my project.

With such an option enabled, it would also be great for the tab names to update immediately upon directory change, rather than on tab change, as is the current behavior with process-named tabs.

BenWildeman commented 4 years ago

could I ask how you currently create your terminals? is it through right clicking and then using "open terminal"

plwalsh commented 4 years ago

I had been using a keybinding on workbench.action.terminal.new, like so:

    {
        "key": "ctrl+shift+t",
        "command": "workbench.action.terminal.new",
        "when": "terminalFocus"
    },

which I then switched to tabulous.createTerminal like:

    {
        "key": "ctrl+shift+t",
        "command": "tabulous.createTerminal",
        "when": "terminalFocus"
    },

Both methods result in using the current process as default names for the tabs, in my case "bash" when they open up, and then switching to whatever process I run (like, "gdb"):

image

I was hoping those tab icons could be named for the current folder that each tab is in, like: 💻 project-root | 💻 doc | 💻 src

BenWildeman commented 4 years ago

you could switch createTerminal out for createNamedTerminal which will prompt you to name it prior to creation

BenWildeman commented 4 years ago

I would also advise you to utilise workspaces so you can setup defaultTerminals per project you're working on to automatically open them on startup 🙂

plwalsh commented 4 years ago

I could. I was just hoping for something automatic/dynamic. I'm constantly opening up new tabs, and closing and reopening, and would prefer not to be interrupted each time with a prompt. I was also hoping that since it was able to pull the running process name automatically, that it could also be configured to pull the folder name automatically.

Just something to think about. Nothing more than a convenience feature. The extension is incredibly useful regardless.

BenWildeman commented 4 years ago

I do wish there was more granular control with the integrated terminal VS code has, but the API available is very limited. there's no listeners you can attach to when a name of a terminal changes unfortunately for that part. not sure if there's something accessible for which directory the terminal has opened within but I can look into that, I assume not though

plwalsh commented 4 years ago

That makes sense. I was assuming VS Code would give you a lot more access than that. But I realize now that the default names are just being pulled directly from the VS Code internals, and not being set by your extension. Thanks for entertaining the idea, though!

BenWildeman commented 4 years ago

@plwalsh thinking of adding a new option for opening a terminal for a directory using the context menu, and also a command for opening in the current directory. do you have a preference on how you want these to be named?

plwalsh commented 4 years ago

I like that idea! I couldn't say I have any strong preference. I assume you wouldn't want the entire absolute path to the directory to be the name since that could get lengthy. So maybe just the directory name, possibly with a trailing slash to indicate it is a directory? Like src/ or test/?

sghsri commented 4 years ago

any update on this?

BenWildeman commented 3 years ago

sorry it has taken so long to get around to this. it's been implemented now so will be in the next update of the extension

BenWildeman commented 3 years ago

@plwalsh @sghsri little niggle with this feature. for some reason it's not possible to edit the order of the context menu, so my "open in terminal here" command is at the top of the context menu which could potentially break muscle memory when using the context menu say for creating a new file (which was the first menu option, can see the screenshot in the PR)

EDIT: no longer an issue as I've found out how to correctly order this within the navigation portion of the explorer context menu (required jumping through the vscode codebase to figure out how to get it after the "Open in Integrated Terminal" button)