提交 63865cba 编写于 作者: B Benjamin Pasero

fix #45195

上级 21c8bb66
......@@ -325,7 +325,7 @@ export function template(template: string, values: { [key: string]: string | ISe
const left = segments[index - 1];
const right = segments[index + 1];
return [left, right].every(segment => segment && segment.type === Type.VARIABLE && segment.value.length > 0);
return [left, right].every(segment => segment && (segment.type === Type.VARIABLE || segment.type === Type.TEXT) && segment.value.length > 0);
}
// accept any TEXT and VARIABLE
......
......@@ -125,9 +125,9 @@ suite('Labels', () => {
// conditional separator
assert.strictEqual(labels.template('Foo${separator}Bar'), 'FooBar');
assert.strictEqual(labels.template('Foo${separator}Bar', { separator: { label: ' - ' } }), 'FooBar');
assert.strictEqual(labels.template('${separator}Foo${separator}Bar', { value: 'something', separator: { label: ' - ' } }), 'FooBar');
assert.strictEqual(labels.template('${value} Foo${separator}Bar', { value: 'something', separator: { label: ' - ' } }), 'something FooBar');
assert.strictEqual(labels.template('Foo${separator}Bar', { separator: { label: ' - ' } }), 'Foo - Bar');
assert.strictEqual(labels.template('${separator}Foo${separator}Bar', { value: 'something', separator: { label: ' - ' } }), 'Foo - Bar');
assert.strictEqual(labels.template('${value} Foo${separator}Bar', { value: 'something', separator: { label: ' - ' } }), 'something Foo - Bar');
// // real world example (macOS)
let t = '${activeEditorShort}${separator}${rootName}';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册