From 465d91dbbe9e7fe5f7c38f8f99b9702a711907e9 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Oct 2017 11:20:53 +0100 Subject: [PATCH] fix test failure --- .../contrib/snippet/browser/snippetParser.ts | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/vs/editor/contrib/snippet/browser/snippetParser.ts b/src/vs/editor/contrib/snippet/browser/snippetParser.ts index df29adf911b..db06494d4a8 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 { -- GitLab