diff --git a/src/vs/editor/contrib/snippet/browser/snippetParser.ts b/src/vs/editor/contrib/snippet/browser/snippetParser.ts index df29adf911b0189c0b382631b636132b346db365..db06494d4a87da153961a32398211e35d207aab4 100644 --- a/src/vs/editor/contrib/snippet/browser/snippetParser.ts +++ b/src/vs/editor/contrib/snippet/browser/snippetParser.ts @@ -346,20 +346,19 @@ export class FormatString extends Marker { } resolve(value: string): string { - if (value) { - if (this.shorthandName === 'upcase') { - return value.toLocaleUpperCase(); - } else if (this.shorthandName === 'downcase') { - return value.toLocaleLowerCase(); - } else if (this.shorthandName === 'capitalize') { - return value[0].toLocaleUpperCase() + value.substr(1); - } else if (Boolean(value) && typeof this.ifValue === 'string') { - return this.ifValue; - } else if (!Boolean(value) && typeof this.elseValue === 'string') { - return this.elseValue; - } + if (this.shorthandName === 'upcase') { + return !value ? '' : value.toLocaleUpperCase(); + } else if (this.shorthandName === 'downcase') { + return !value ? '' : value.toLocaleLowerCase(); + } else if (this.shorthandName === 'capitalize') { + return !value ? '' : (value[0].toLocaleUpperCase() + value.substr(1)); + } else if (Boolean(value) && typeof this.ifValue === 'string') { + return this.ifValue; + } else if (!Boolean(value) && typeof this.elseValue === 'string') { + return this.elseValue; + } else { + return value || ''; } - return value || ''; } toTextmateString(): string {