This page documents how HardPin can be enabled in your copy of Visual Studio Code. Unfortunately, HardPin relies on DOM access. Thus, it can not be published as an extension (see VS Code extension restrictions) and must be manually applied. Hopefully, this feature can someday be implemented in to the actual product.
Why is HardPin not implemented directly in the source of VS Code? See How It Works.
- Copy the code from below in to your clipboard.
- Open VS Code.
- Help > Toggle Developer Tools > Console.
- Paste the copied code in to the Console and execute it.
- Enjoy! Note: These steps must be completed for each VS Code window separately (including on restart).
To use a separate row for pinned tabs, run the following code in the console (after completing the steps above):
To revert back to the single row, run the following code in the console:
To toggle the pinned state of the currently active tab press
Ctrl + Alt + P or
Cmd + Option + P.
Must be executed once per window
The custom code must be applied once per window, but can still act as a major time saver if the same window is used for a long time.
Forgetting the state
Because HardPin is externally executed, VS Code will not remember which tabs were hard pinned during startup.
The command "Close tabs to the right" closes hard pinned tabs
HardPin does not change the internal order of tabs in VS Code, just the visual order of them. This means that "Close tabs to the right" might close hard pinned tabs. By implementing HardPin directly in to VS Code this could be fixed.
Fixing the Issues
All issues could be fixed, with relative ease, if HardPin would be implemented directly in to the source of VS Code.