Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: --<!-- Use Help Report Issue to prefill these. --Version: 1.52.1 Commit: Date: 2020-12-16T16:30:02.420Z Electron: 9.3.5 Chrome: 83.0.4103.122 12.14.1 V8: 8.3.110.13-electron.0 OS: Darwin x64 20.2.0 Steps to Reproduce: a file called in the explorer. that file. that file. new file name is , where it should be . <img width="220" alt="Screenshot 2021-01-05 at 11 08 23" src="https://user-"<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.485 --- <!-- score: 0.474 --<!-- potentialduplicatescomment --
I think the code is in Last time I checked there was also no test case for that.
Thanks. I acknowledge the issue. And we would welcome a PR that neatly fixes this and adds a test, thus adding help wanted label.
Not a Typescript magician here, otherwise I would have provided a pull request.
I can submit a PR. looking at the file/folder checks it looks like these two sets should be . If they look right, I will send a PR for them. File without extension - Version number only, without extension =
makes sense. Make sure to cover with tests and no need to go too fancy! Thanks
One other incrementing that I am not sure about. becomes , without the leading 0. Is this right, or should it maintain the number of leading 0s?
If you have zero leading paddings it usually means the amount of characters should be maintained. So making out of 0999 would be wrong IMO. It should just become 1000. Me two cents.
I agree with
it would be great if you can try this out with vscode insdiers from tomorrow and give us feedback. Thanks to for providing a PR
Will there be a release or how do I get my hands on the right version to test locally?
releases every day. Just get the release tomorrow and you should be good.
Tested the latest insider build. I could not break it. Works for me. Thanks a lot for the contribution.
Thanks for letting us know. Adding verified label.

Discussion:
return `${name.substr(0, lastIndexOfDot)}.1${name.substr(lastIndexOfDot)}`; } <ins> // 123 => 124 let noNameNoExtensionRegex = RegExp('(d+)$'); if (!isFolder && lastIndexOfDot === -1 && name.match(noNameNoExtensionRegex)) { return name.replace(noNameNoExtensionRegex, (match, g1?) => { let number = parseInt(g1); return number < maxNumber ? String(number + 1).padStart(g1.length, '0') : `${g1}.1`; }); } // file => file1 // file1 => file2 let noExtensionRegex = RegExp('(.*)(d*)$'); if (!isFolder && lastIndexOfDot === -1 && name.match(noExtensionRegex)) { return name.replace(noExtensionRegex, (match, g1?, g2?) => { let number = parseInt(g2); if (isNaN(number)) { number = 0; } return number < maxNumber ? g1 + String(number + 1).padStart(g2.length, '0') : `${g1}${g2}.1`; }); } </ins> // folder.1=>folder.2 if (isFolder && name.match(/(d+)$/)) { return name.replace(/(d+)$/, (match, ...groups) => {

assert.strictEqual(result, '2-test.js'); }); <del> test('Increment file name with prefix version with `-` as separator', function () { </del> <ins> test('Increment file name with prefix version with `_` as separator', function () { </ins> const name = '1_test.js'; const result = incrementFileName(name, false, 'smart'); assert.strictEqual(result, '2_test.js');

assert.strictEqual(result, '9007199254740992.test.1.js'); }); <ins> test('Increment file name with just version and no extension', function () { const name = '001004'; const result = incrementFileName(name, false, 'smart'); assert.strictEqual(result, '001005'); }); test('Increment file name with just version and no extension, too big number', function () { const name = '9007199254740992'; const result = incrementFileName(name, false, 'smart'); assert.strictEqual(result, '9007199254740992.1'); }); test('Increment file name with no extension and no version', function () { const name = 'file'; const result = incrementFileName(name, false, 'smart'); assert.strictEqual(result, 'file1'); }); test('Increment file name with no extension', function () { const name = 'file1'; const result = incrementFileName(name, false, 'smart'); assert.strictEqual(result, 'file2'); }); test('Increment file name with no extension, too big number', function () { const name = 'file9007199254740992'; const result = incrementFileName(name, false, 'smart'); assert.strictEqual(result, 'file9007199254740992.1'); }); </ins> test('Increment folder name with prefix version', function () { const name = '1.test'; const result = incrementFileName(name, true, 'smart');