Skip to content

Commit 8e4e0a2

Browse files
author
Benjamin Pasero
committed
1 parent 28011c3 commit 8e4e0a2

4 files changed

Lines changed: 27 additions & 27 deletions

File tree

extensions/configuration-editing/src/settingsDocumentHelper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export class SettingsDocument {
3838
private provideWindowTitleCompletionItems(location: Location, range: vscode.Range): vscode.ProviderResult<vscode.CompletionItem[]> {
3939
const completions: vscode.CompletionItem[] = [];
4040

41-
completions.push(this.newSimpleCompletionItem('${activeEditorName}', range, localize('activeEditorName', "e.g. myFile.txt")));
42-
completions.push(this.newSimpleCompletionItem('${activeFilePath}', range, localize('activeFilePath', "e.g. /Users/Development/myProject/myFolder/myFile.txt")));
43-
completions.push(this.newSimpleCompletionItem('${activeFilePathRelative}', range, localize('activeFilePathRelative', "e.g. /Users/Development/myProject/myFolder/myFile.txt")));
41+
completions.push(this.newSimpleCompletionItem('${activeEditorShort}', range, localize('activeEditorShort', "e.g. myFile.txt")));
42+
completions.push(this.newSimpleCompletionItem('${activeEditorMedium}', range, localize('activeEditorMedium', "e.g. myFolder/myFile.txt")));
43+
completions.push(this.newSimpleCompletionItem('${activeEditorLong}', range, localize('activeEditorLong', "e.g. /Users/Development/myProject/myFolder/myFile.txt")));
4444
completions.push(this.newSimpleCompletionItem('${rootName}', range, localize('rootName', "e.g. myProject")));
4545
completions.push(this.newSimpleCompletionItem('${rootPath}', range, localize('rootPath', "e.g. /Users/Development/myProject")));
4646
completions.push(this.newSimpleCompletionItem('${appName}', range, localize('appName', "e.g. VS Code")));

src/vs/base/test/common/labels.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,18 @@ suite('Labels', () => {
123123
assert.strictEqual(labels.template('${value} Foo${separator}Bar', { value: 'something', separator: { label: ' - ' } }), 'something FooBar');
124124

125125
// // real world example (macOS)
126-
let t = '${activeEditorName}${separator}${rootName}';
127-
assert.strictEqual(labels.template(t, { activeEditorName: '', rootName: '', separator: { label: ' - ' } }), '');
128-
assert.strictEqual(labels.template(t, { activeEditorName: '', rootName: 'root', separator: { label: ' - ' } }), 'root');
129-
assert.strictEqual(labels.template(t, { activeEditorName: 'markdown.txt', rootName: 'root', separator: { label: ' - ' } }), 'markdown.txt - root');
126+
let t = '${activeEditorShort}${separator}${rootName}';
127+
assert.strictEqual(labels.template(t, { activeEditorShort: '', rootName: '', separator: { label: ' - ' } }), '');
128+
assert.strictEqual(labels.template(t, { activeEditorShort: '', rootName: 'root', separator: { label: ' - ' } }), 'root');
129+
assert.strictEqual(labels.template(t, { activeEditorShort: 'markdown.txt', rootName: 'root', separator: { label: ' - ' } }), 'markdown.txt - root');
130130

131131
// // real world example (other)
132-
t = '${dirty}${activeEditorName}${separator}${rootName}${separator}${appName}';
133-
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: '', rootName: '', appName: '', separator: { label: ' - ' } }), '');
134-
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: '', rootName: '', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'Visual Studio Code');
135-
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: 'Untitled-1', rootName: '', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'Untitled-1 - Visual Studio Code');
136-
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: '', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'monaco - Visual Studio Code');
137-
assert.strictEqual(labels.template(t, { dirty: '', activeEditorName: 'somefile.txt', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'somefile.txt - monaco - Visual Studio Code');
138-
assert.strictEqual(labels.template(t, { dirty: '* ', activeEditorName: 'somefile.txt', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), '* somefile.txt - monaco - Visual Studio Code');
132+
t = '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}';
133+
assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: '', rootName: '', appName: '', separator: { label: ' - ' } }), '');
134+
assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: '', rootName: '', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'Visual Studio Code');
135+
assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: 'Untitled-1', rootName: '', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'Untitled-1 - Visual Studio Code');
136+
assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: '', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'monaco - Visual Studio Code');
137+
assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: 'somefile.txt', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'somefile.txt - monaco - Visual Studio Code');
138+
assert.strictEqual(labels.template(t, { dirty: '* ', activeEditorShort: 'somefile.txt', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), '* somefile.txt - monaco - Visual Studio Code');
139139
});
140140
});

src/vs/workbench/browser/parts/titlebar/titlebarPart.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ export class TitlebarPart extends Part implements ITitleService {
151151
/**
152152
* Possible template values:
153153
*
154-
* {activeEditorName}: e.g. myFile.txt
155-
* {activeFilePath}: e.g. /Users/Development/myProject/myFolder/myFile.txt
156-
* {activeFilePathRelative}: e.g. myFolder/myFile.txt
154+
* {activeEditorLong}: e.g. /Users/Development/myProject/myFolder/myFile.txt
155+
* {activeEditorMedium}: e.g. myFolder/myFile.txt
156+
* {activeEditorShort}: e.g. myFile.txt
157157
* {rootName}: e.g. myProject
158158
* {rootPath}: e.g. /Users/Development/myProject
159159
* {appName}: e.g. VS Code
@@ -166,19 +166,19 @@ export class TitlebarPart extends Part implements ITitleService {
166166
const file = toResource(input, { filter: 'file' });
167167

168168
// Variables
169-
const activeEditorName = input ? input.getName() : '';
170-
const activeFilePath = file ? this.tildify(labels.getPathLabel(file)) : '';
171-
const activeFilePathRelative = file ? labels.getPathLabel(file, this.contextService) : '';
169+
const activeEditorShort = input ? input.getName() : '';
170+
const activeEditorMedium = file ? labels.getPathLabel(file, this.contextService) : activeEditorShort;
171+
const activeEditorLong = file ? this.tildify(labels.getPathLabel(file)) : activeEditorMedium;
172172
const rootName = workspace ? workspace.name : '';
173173
const rootPath = workspace ? this.workspacePath : '';
174174
const dirty = input && input.isDirty() ? TitlebarPart.TITLE_DIRTY : '';
175175
const appName = this.environmentService.appNameLong;
176176
const separator = TitlebarPart.TITLE_SEPARATOR;
177177

178178
return labels.template(this.titleTemplate, {
179-
activeEditorName,
180-
activeFilePath,
181-
activeFilePathRelative,
179+
activeEditorShort,
180+
activeEditorLong,
181+
activeEditorMedium,
182182
rootName,
183183
rootPath,
184184
dirty,

src/vs/workbench/electron-browser/main.contribution.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,12 @@ Note that there can still be cases where this setting is ignored (e.g. when usin
196196
},
197197
'window.title': {
198198
'type': 'string',
199-
'default': isMacintosh ? '${activeEditorName}${separator}${rootName}' : '${dirty}${activeEditorName}${separator}${rootName}${separator}${appName}',
199+
'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}',
200200
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'title' },
201201
`Controls the window title based on the active editor. Variables are substituted based on the context:
202-
\${activeEditorName}: e.g. myFile.txt
203-
\${activeFilePath}: e.g. /Users/Development/myProject/myFolder/myFile.txt
204-
\${activeFilePathRelative}: e.g. myFolder/myFile.txt
202+
\${activeEditorShort}: e.g. myFile.txt
203+
\${activeEditorMedium}: e.g. myFolder/myFile.txt
204+
\${activeEditorLong}: e.g. /Users/Development/myProject/myFolder/myFile.txt
205205
\${rootName}: e.g. myProject
206206
\${rootPath}: e.g. /Users/Development/myProject
207207
\${appName}: e.g. VS Code

0 commit comments

Comments
 (0)