A Visual Studio Code extension that simplifies working with Windows Subsystem for Linux (WSL) by providing quick actions to copy file and folder paths in the WSL format directly to your clipboard.
Features
This extension adds two convenient commands to your VS Code Explorer and Editor Tab context menus (right-click menus):
Copy as WSL
If a file is selected: Copies the full Windows file path converted to its WSL equivalent (e.g., C:\path\to\file.txt becomes /mnt/c/path/to/file.txt).
If a folder is selected: Copies the full Windows folder path converted to its WSL equivalent (e.g., C:\path\to\myfolder\ becomes /mnt/c/path/to/myfolder/).
Copy folder as WSL
If a file is selected: Extracts the containing folder's path and copies its WSL equivalent (e.g., C:\path\to\file.txt becomes /mnt/c/path/to/).
If a folder is selected: Copies the full Windows folder path converted to its WSL equivalent (e.g., C:\path\to\myfolder\ becomes /mnt/c/path/to/myfolder/).
These commands are only visible when VS Code is running in a Windows OS environment.
Installation
From the Visual Studio Code Marketplace (Recommended)
Once published to the Marketplace:
Open Visual Studio Code.
Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X).
Search for Copy As WSL.
Click Install.
Manual Installation (.vsix file)
If you have the .vsix file (generated by vsce package):
Open Visual Studio Code.
Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X).
Click on the ... (More Actions) menu in the top-right of the Extensions view.
Select Install from VSIX....
Browse to and select the copy-as-wsl-X.Y.Z.vsix file.
Usage
Ensure you are running VS Code on a Windows operating system.
In the Explorer View
Right-click on any file or folder.
You will see a section with Copy as WSL and Copy folder as WSL options.
On an Editor Tab
Right-click on the tab of an open file.
You will see the Copy as WSL and Copy folder as WSL options.
Click the desired option, and the corresponding WSL path will be copied to your clipboard. A notification will confirm the action.
Requirements
Visual Studio Code (version ^1.101.0 or higher).
Windows Operating System (with WSL installed if you plan to use the copied paths in WSL environments).
Author: Junior Mayhé
Feel free to contribute, report issues, or suggest improvements on the GitHub Repository.