baincd / vscode-copy-path-unixstyle

Copy Windows paths to clipboard in Unix/Linux/POSIX style
MIT License
7 stars 2 forks source link

copy in different style #1

Closed Yousuf28 closed 2 years ago

Yousuf28 commented 2 years ago

Thanks for the extension. It's really useful. so right now for windows directory like "C:\Users\Md.Ali" it returns "/c/Users/Md.Ali" Is it possible to a add option so it returns "C:/Users/Md.Ali" ? Basically only replace the backslash with forward slash.

Yousuf28 commented 2 years ago

So I replaced this line (33) paths.push(isWindows ? path.replace(/\\/g, '/').replace(/^(\/[A-Za-z]):\//, '$1/') : path); with following line. paths.push(isWindows ? path.replace(/\\/g, '/').replace("/c", "C") : path); and it works the way I wanted. Thanks

baincd commented 2 years ago

Hi @Yousuf28, Thank you for your feedback! I'm so glad you were able to get the extension to work the way you wanted it to.

I am curious - what the use cases are for the format C:/Users/Md.Ali? I haven't run into needing this format too frequently myself.

I'm hesitant to add new commands/menu items to support this additional format, as not everyone may have a need for this format and I wouldn't want to add more clutter to menus with items that may not be used. I have a couple of ideas if there is general interest in the C:/Users/Md.Ali format (A setting to toggle between formats, a separate extension just for this format, or new menu items for this format that can be enabled/disabled via settings), but I would like to better understand the use cases and see if there is general interest before going down any of those paths.

Yousuf28 commented 2 years ago

Hi @baincd, thank you for your response. I am using vscode for R programming language. The expected file path in R for windows is like C:/Users/Md.Ali. If I use default copy path it return C:\Users\Md.Ali. I just need to replace backslash with forward slash. Most R programmer use RStudio IDE. But recently I see many people using vscode and I expect that would grow over time. So a setting to toggle between formats would be great. Thanks

baincd commented 2 years ago

OK, thank you for the explanation on the use case.

I'm considering adding a separate set of menu items and commands to copy paths in the C:\path\file format, with a setting to control if these new menu items/commands are available. This would allow users the ability to choose if they only one one set of menu items and commands, or both.

One tricky thing is what to refer to each format as to differentiate them. My first thought is something like

I'll see if I can come up with a better name, or if someone can suggest better names to use.

Yousuf28 commented 2 years ago

This sounds great. Thank You for your consideration.

baincd commented 2 years ago

@Yousuf28 I have added support for copying the path in the format c:\path\file.txt format (which I'm calling Universal Windows format). You can change the format of the default command to this, or you can enable an additional command specifically to copy in Universal Windows format.

I would like to gather some feedback before releasing this to the VS Code Marketplace. If you'd like to test and provide feedback, I would greatly appreciate it. You can install pre-release version 2.0.0-RC1 by downloading the .vsix file from the release page and installing in VS Code via the "Extensions: Install from VSIX" command.

baincd commented 2 years ago

@Yousuf28 FYI, there is a newer pre-release version - v2.0.0-RC2. One of the changes I made was to changing the name of the c:\path\file.txt format to "Windows format using /"

baincd commented 2 years ago

@Yousuf28 FYI I've published a newer pre-release version - v2.0.0-RC3.

Yousuf28 commented 2 years ago

Sorry for the late response. Thank you for the update @baincd .

char-iot commented 2 years ago

@baincd Hi man, it works really well now, you mind release it on vscode?

baincd commented 2 years ago

Released as part of v2.0.0. Thank you for the feedback and testing!