Skip to content

Commit

Permalink
Option to show project path in title bar (fixes #21002)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Feb 22, 2017
1 parent d744666 commit 256d76f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export class SettingsDocument {
const completions: vscode.CompletionItem[] = [];

completions.push(this.newSimpleCompletionItem('${activeEditorName}', range, localize('activeEditorName', "e.g. myFile.txt")));
completions.push(this.newSimpleCompletionItem('${activeFilePath}', range, localize('activeFilePath', "e.g. /Users/Development/myProject/myFile.txt")));
completions.push(this.newSimpleCompletionItem('${activeFilePath}', range, localize('activeFilePath', "e.g. /Users/Development/myProject/myFolder/myFile.txt")));
completions.push(this.newSimpleCompletionItem('${activeFilePathRelative}', range, localize('activeFilePathRelative', "e.g. /Users/Development/myProject/myFolder/myFile.txt")));
completions.push(this.newSimpleCompletionItem('${rootName}', range, localize('rootName', "e.g. myProject")));
completions.push(this.newSimpleCompletionItem('${rootPath}', range, localize('rootPath', "e.g. /Users/Development/myProject")));
completions.push(this.newSimpleCompletionItem('${appName}', range, localize('appName', "e.g. VS Code")));
Expand Down
5 changes: 4 additions & 1 deletion src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ export class TitlebarPart extends Part implements ITitleService {
* Possible template values:
*
* {activeEditorName}: e.g. myFile.txt
* {activeFilePath}: e.g. /Users/Development/myProject/myFile.txt
* {activeFilePath}: e.g. /Users/Development/myProject/myFolder/myFile.txt
* {activeFilePathRelative}: e.g. myFolder/myFile.txt
* {rootName}: e.g. myProject
* {rootPath}: e.g. /Users/Development/myProject
* {appName}: e.g. VS Code
Expand All @@ -167,6 +168,7 @@ export class TitlebarPart extends Part implements ITitleService {
// Variables
const activeEditorName = input ? input.getName() : '';
const activeFilePath = file ? this.tildify(labels.getPathLabel(file)) : '';
const activeFilePathRelative = file ? labels.getPathLabel(file, this.contextService) : '';
const rootName = workspace ? workspace.name : '';
const rootPath = workspace ? this.workspacePath : '';
const dirty = input && input.isDirty() ? TitlebarPart.TITLE_DIRTY : '';
Expand All @@ -176,6 +178,7 @@ export class TitlebarPart extends Part implements ITitleService {
return labels.template(this.titleTemplate, {
activeEditorName,
activeFilePath,
activeFilePathRelative,
rootName,
rootPath,
dirty,
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/electron-browser/main.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ Note that there can still be cases where this setting is ignored (e.g. when usin
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'title' },
`Controls the window title based on the active editor. Variables are substituted based on the context:
\${activeEditorName}: e.g. myFile.txt
\${activeFilePath}: e.g. /Users/Development/myProject/myFile.txt
\${activeFilePath}: e.g. /Users/Development/myProject/myFolder/myFile.txt
\${activeFilePathRelative}: e.g. myFolder/myFile.txt
\${rootName}: e.g. myProject
\${rootPath}: e.g. /Users/Development/myProject
\${appName}: e.g. VS Code
Expand Down

0 comments on commit 256d76f

Please sign in to comment.