Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Preserve file extension when duplicating files #45

Open
Epigene opened this issue Feb 23, 2018 · 4 comments
Open

Feature: Preserve file extension when duplicating files #45

Epigene opened this issue Feb 23, 2018 · 4 comments
Assignees

Comments

@Epigene
Copy link

Epigene commented Feb 23, 2018

VSCode Version: 1.20.1
OS Version: macOS High Sierra 10.13.2
Settings: https://gist.github.com/Epigene/a65bbf5e88d847b5e0622d42019fb678
Wrongly opened issue in VSC repo: microsoft/vscode#44254

Needed behavior:
When duplicating a file it would be nice to have it append the "-copy" just before the file extension.

Current behavior:
Duplication overrides file extension with "-copy".

Discussion:
As can be seen in the example image below, I choose to duplicate a file named "calendar.apib" and the default duplicate file-name is "calendar-copy" where "calendar-copy.apib" would be much more useful.
bad_dup

@mrmlnc mrmlnc self-assigned this Mar 12, 2018
@mrmlnc
Copy link
Owner

mrmlnc commented Apr 7, 2018

Hello, @Epigene,

Sorry for delay. By default, the extension remains unchanged.

  • Original: index.d.ts
  • Popup with input: index.d (.d, because we don't know how many points is an extension)
  • Saved file: index.d.ts

But if the extension does not match the original one, it will be changed:

  • Original: index.d.ts
  • Popup with input: index.dindex.d.ts2
  • Saved file: index.d.ts2

Do you want the file extension to be displayed completely always?

@Epigene
Copy link
Author

Epigene commented Apr 9, 2018

I never realised that is the behaviour. 😅
A config option that toggles whether the file extension is displayed would be nice.

@btisdall
Copy link

btisdall commented Jun 26, 2018

Hi, thanks for the extension! It looks like duplication doesn't work as expected if the filename contains more than one period (which is not an uncommon idiom in the *nix world).

How to reproduce:

  1. Create foo.dev.json
  2. Hit Duplicate file or directory – the new filename is displayed as foo-copy (ie minus the .dev.json suffix).
  3. Enter foo.test

Expected filename: foo.test.json
Actual filename: foo.test

@notpushkin
Copy link

IMO a better option (if possible with Code APIs) would be to preserve extension(s) while selecting the filename part in the prompt, i. e. for file foo.d.ts a prompt [foo].d.ts ([] denoting a selection) is presented, from where user can:

  • rename file while keeping extension by just typing new name,
  • add a suffix before the extension ( and type the suffix),
  • change the extension (End Ctrl+Backspace and type new extension),
  • finally, rename file completely (Ctrl+A and type new filename).

I can work out a PR if this kind of functionality is okay with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants