A good example is how it works in Firefox - pinned tabs cannot be closed using Ctrl + W
When I have many tabs open (but only two are pinned), I use Ctrl + W to quickly close tab by tab (using the mouse is really unfriendly because https://github.com/microsoft/vscode/issues/40290)
As a result, pinned cards are also closed. This is undesirable behavior
@kanlukasz you can always restore a closed tab (including it's pinned state) via Ctrl+Shift+T (Reopen closed editor), did you see that?
@bpasero yes, I know that and sometimes I use it.
Anyway, I still think that this option could be useful
My point of view:
Pinned tabs means something different to me than a regular tab
Usually it is something like:
I use it for Git Graph , for .log files etc.
_The question remains whether pinning should mean locking (maybe these should be two separate issues, I don't know if there is a ticket about locking tabs)_
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
Yes, please.
It's way too easy to accidentally close a pinned tab. Especially when you ctrl + w multiple tabs, and it doesn't happen in a linear way. When I pin a tab, I'd like it to stay pinned "forever" until I intentionally unpin and close it.
And yes, you can "undo" withctrl + shift + t, but that's only useful when you _just_ closed it _and_ you notice it right away. Not when you quickly close 15 files, and the pinned file was file number 8.
This issue should be fixed at the source instead of being brushed off with a workaround and closed by the triage bot.
Blocking close is a standard UI expectation for pinned tabs, especially those modeled after web browsers.
This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
Ref: https://github.com/microsoft/vscode/issues/100738#issue-642862204 14 votes are in, just 6 more to go! 馃
:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
@kanlukasz and others, this can already be achieved today by configuring a keybinding such as:
{
"key": "cmd+w",
"command": "workbench.action.closeActiveEditor",
"when": "!editorSticky"
},
{
"key": "cmd+w",
"command": "-workbench.action.closeActiveEditor"
}
The condition "when": "!editorSticky" will ignore this keybinding when an editor is pinned. The naming is not ideal, but historically we had a editorPinned context already that was used for a different purpose.
Is there something missing giving this solution?
Nice! Adding the configurations shared by @bpasero worked and the behavior is as I expected.
It looks good to close this issue from my perspective.
Had been using this for an hour now and found a bug. Below are the steps to simulate the bug:
config provided by @bpasero Cmd + Shift + p to open the command palleteCtrl + W to close the pinned tabIdeally, the pinned tab should not have closed but it did.
1.48.2 on Mac
Yeah, um, _please no_. This should be a stable and default behavior of a pinned tab. Hacking it together with overriding keyboard shortcuts is not an acceptable "solution".
Can you guys _please_ just implement this _properly_? It shouldn't really be that complicated? 馃檹
@Svish we can certainly think about making it the default for the "Close Editor" keybinding that VSCode contributes. I asked about feedback because you can change this today to get this behaviour and it is certainly helpful for me to learn if the people that have a stake in this issue find this is the right path or not. As you can see from https://github.com/microsoft/vscode/issues/100738#issuecomment-688368264 there may even be a bug with how it works and this gives me a chance to fix the issues before landing this in the builds.
Does that make sense or do you have more to add?
@bkowshik thanks a lot for testing this and providing feedback. One thing that I may want to change is possibly renaming editorSticky to editorPinned and change the existing editorPinned to editorNotInPreview or similar to not confuse people. Pinned tabs are only called sticky internally but not in user facing labels.
Asking for feedback is perfectly fine, sorry if I came off as aggressive. Just tired of software where they "fix issues" by supplying brittle and inconsistent configuration hacks that users have to randomly stumble upon in issue trackers or forum threads. And then only to find out the hack doesn't even work anymore, because the software has been updated since the hack was come up with.
Just firmly believe this should be the standard and default behavior of a "pinned tab", just like it is in for example FireFox. Otherwise it really shouldn't be called a "pinned tab", but rather a "thin tab", or something like that. 馃槙
@bpasero, I tested it and can confirm it works.
Additional feedback from me:
While the workbench.editor.focusRecentEditorAfterClose parameter is set to true and you will end up with a pinned tab in the closing order, you cannot close another unpinned tab (you are stopped)
I have this option set to false permanently so everything is fine for me.
But look how this works in Firefox. When the pinned card is active and you clicking Crtl + W it will take you to the closest unpinned card.
Summing up - Using your solution + setting workbench.editor.focusRecentEditorAfterClose asfalse, is fine for me, but maybe it is worth considering improvement in the future
@kanlukasz yeah I noticed how it works in Firefox and like it too. To be honest, you can easily add a keybinding to "open next editor" and assign it to "cmd+w" with the when: activeEditorIsPinned condition to get this behaviour.
Bottom line, I am not 100% sure everyone wants this behaviour or not. I have a couple of changes I plan on pushing and it will include a change for this issue and then we can continue the discussion maybe when people can try it out in insiders.
@bpasero are you sure the activeEditorIsPinned condition is correct? I tried but it not working.
My example:
{
"key": "ctrl+w",
"command": "workbench.action.nextEditor",
"when": "activeEditorIsPinned"
}
@kanlukasz sorry, I renamed the key recently, try with editorSticky
This landed via https://github.com/microsoft/vscode/pull/106385 and will be available in tomorrows insider. Pinned tabs can no longer be closed via Cmd+W. Instead, the next recently used tab will be opened (similar to FF). To make this work identical to FF you will have to configure workbench.editor.focusRecentEditorAfterClose: false, otherwise you always end up back at the pinned tab.
To overrule this change, you can simply bind Cmd+W to the new workbench.action.closeActivePinnedEditor command.
Most helpful comment
:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!