Skip to content

Add prefix case for incrementFileName#50003

Merged
isidorn merged 4 commits intomicrosoft:masterfrom
Krzysztof-Cieslak:prefixFileNameIncremenr
May 17, 2018
Merged

Add prefix case for incrementFileName#50003
isidorn merged 4 commits intomicrosoft:masterfrom
Krzysztof-Cieslak:prefixFileNameIncremenr

Conversation

@Krzysztof-Cieslak
Copy link
Contributor

Fixes #47014

CC: @isidorn

@Krzysztof-Cieslak
Copy link
Contributor Author

While this is naive way to add new case there are couple of problems with incrementFileName in general:

  1. It's always using . as separator of version prefix/suffix, it would be good to support also other separators (like -, app-1.js should be incremented to app-2.js)
  2. Since it's just parsing version string to int we lose leading zeros (right now app.0001.js is incremented to app.2.js which is probably wrong behavior.)

@isidorn isidorn added this to the May 2018 milestone May 17, 2018
@isidorn
Copy link
Collaborator

isidorn commented May 17, 2018

@Krzysztof-Cieslak thanks a lot for your PR.
I would be happy merging this in if we add some unit tests - they would increase my confidence and would use as a documentation how this beahves. Could you export function incrementFileNameand add a fileActions.test.ts and test out that method.

@Krzysztof-Cieslak
Copy link
Contributor Author

@isidorn, I've added couple of tests. Should I also tackle those 2 problems I've mentioned in an earlier message?

@isidorn
Copy link
Collaborator

isidorn commented May 17, 2018

@Krzysztof-Cieslak yeah that would be great! Adding tests for those cases would also be awesome! Thanks

@Krzysztof-Cieslak
Copy link
Contributor Author

This is ready for review.

@isidorn
Copy link
Collaborator

isidorn commented May 17, 2018

@Krzysztof-Cieslak thanks a lot! I love the tests, they give me confidence looking at all these regexes.
Merging in, thanks again!

@isidorn isidorn merged commit 19bf185 into microsoft:master May 17, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to increment prefix when duplicating file/folder

2 participants