提交 7714e993 编写于 作者: B Benjamin Pasero

Missing dash separating filename from Code application title (fixes #20236)

上级 2535217a
......@@ -189,7 +189,10 @@ export function template(template: string, values: { [key: string]: string | ISe
// Separator
else if (resolved) {
segments.push({ value: resolved.label, type: Type.SEPARATOR });
const prevSegment = segments[segments.length - 1];
if (!prevSegment || prevSegment.type !== Type.SEPARATOR) {
segments.push({ value: resolved.label, type: Type.SEPARATOR }); // prevent duplicate separators
}
}
curVal = '';
......
......@@ -125,6 +125,7 @@ suite('Labels', () => {
t = '${dirty}${activeEditorName}${separator}${rootName}${separator}${appName}';
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: '', rootName: '', appName: '', separator: { label: ' - ' } }), '');
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: '', rootName: '', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'Visual Studio Code');
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: 'Untitled-1', rootName: '', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'Untitled-1 - Visual Studio Code');
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: '', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'monaco - Visual Studio Code');
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: 'somefile.txt', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'somefile.txt - monaco - Visual Studio Code');
assert.strictEqual(labels.template(t, { dirty: '* ', activeEditorName: 'somefile.txt', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), '* somefile.txt - monaco - Visual Studio Code');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册