mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-06 14:34:17 +01:00
Merge pull request #122796 from jeanp413/fix-122255
Fixes pascalCase snippet formatter fails to process numbers
This commit is contained in:
@@ -388,11 +388,11 @@ export class FormatString extends Marker {
|
||||
}
|
||||
|
||||
private _toPascalCase(value: string): string {
|
||||
const match = value.match(/[a-z]+/gi);
|
||||
const match = value.match(/[a-z0-9]+/gi);
|
||||
if (!match) {
|
||||
return value;
|
||||
}
|
||||
return match.map(function (word) {
|
||||
return match.map(word => {
|
||||
return word.charAt(0).toUpperCase()
|
||||
+ word.substr(1).toLowerCase();
|
||||
})
|
||||
|
||||
@@ -655,6 +655,7 @@ suite('SnippetParser', () => {
|
||||
assert.strictEqual(new FormatString(1, 'capitalize').resolve('bar'), 'Bar');
|
||||
assert.strictEqual(new FormatString(1, 'capitalize').resolve('bar no repeat'), 'Bar no repeat');
|
||||
assert.strictEqual(new FormatString(1, 'pascalcase').resolve('bar-foo'), 'BarFoo');
|
||||
assert.strictEqual(new FormatString(1, 'pascalcase').resolve('bar-42-foo'), 'Bar42Foo');
|
||||
assert.strictEqual(new FormatString(1, 'notKnown').resolve('input'), 'input');
|
||||
|
||||
// if
|
||||
|
||||
Reference in New Issue
Block a user