提交 cd0f833f 编写于 作者: B Benjamin Pasero

title - introduce remoteName as variable

上级 95e877c1
...@@ -54,6 +54,7 @@ export class SettingsDocument { ...@@ -54,6 +54,7 @@ export class SettingsDocument {
completions.push(this.newSimpleCompletionItem('${folderName}', range, localize('folderName', "name of the workspace folder the file is contained in (e.g. myFolder)"))); completions.push(this.newSimpleCompletionItem('${folderName}', range, localize('folderName', "name of the workspace folder the file is contained in (e.g. myFolder)")));
completions.push(this.newSimpleCompletionItem('${folderPath}', range, localize('folderPath', "file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder)"))); completions.push(this.newSimpleCompletionItem('${folderPath}', range, localize('folderPath', "file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder)")));
completions.push(this.newSimpleCompletionItem('${appName}', range, localize('appName', "e.g. VS Code"))); completions.push(this.newSimpleCompletionItem('${appName}', range, localize('appName', "e.g. VS Code")));
completions.push(this.newSimpleCompletionItem('${remoteName}', range, localize('remoteName', "e.g. SSH")));
completions.push(this.newSimpleCompletionItem('${dirty}', range, localize('dirty', "a dirty indicator if the active editor is dirty"))); completions.push(this.newSimpleCompletionItem('${dirty}', range, localize('dirty', "a dirty indicator if the active editor is dirty")));
completions.push(this.newSimpleCompletionItem('${separator}', range, localize('separator', "a conditional separator (' - ') that only shows when surrounded by variables with values"))); completions.push(this.newSimpleCompletionItem('${separator}', range, localize('separator', "a conditional separator (' - ') that only shows when surrounded by variables with values")));
......
...@@ -257,6 +257,7 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -257,6 +257,7 @@ export class TitlebarPart extends Part implements ITitleService {
* {folderName}: e.g. myFolder * {folderName}: e.g. myFolder
* {folderPath}: e.g. /Users/Development/myFolder * {folderPath}: e.g. /Users/Development/myFolder
* {appName}: e.g. VS Code * {appName}: e.g. VS Code
* {remoteName}: e.g. SSH
* {dirty}: indicator * {dirty}: indicator
* {separator}: conditional separator * {separator}: conditional separator
*/ */
...@@ -297,6 +298,7 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -297,6 +298,7 @@ export class TitlebarPart extends Part implements ITitleService {
const folderPath = folder ? this.labelService.getUriLabel(folder.uri) : ''; const folderPath = folder ? this.labelService.getUriLabel(folder.uri) : '';
const dirty = editor && editor.isDirty() ? TitlebarPart.TITLE_DIRTY : ''; const dirty = editor && editor.isDirty() ? TitlebarPart.TITLE_DIRTY : '';
const appName = this.environmentService.appNameLong; const appName = this.environmentService.appNameLong;
const remoteName = this.environmentService.configuration.remoteAuthority;
const separator = TitlebarPart.TITLE_SEPARATOR; const separator = TitlebarPart.TITLE_SEPARATOR;
const titleTemplate = this.configurationService.getValue<string>('window.title'); const titleTemplate = this.configurationService.getValue<string>('window.title');
...@@ -313,6 +315,7 @@ export class TitlebarPart extends Part implements ITitleService { ...@@ -313,6 +315,7 @@ export class TitlebarPart extends Part implements ITitleService {
folderPath, folderPath,
dirty, dirty,
appName, appName,
remoteName,
separator: { label: separator } separator: { label: separator }
}); });
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform'; import { isMacintosh, isWindows, isLinux, isWeb, isNative } from 'vs/base/common/platform';
// Configuration // Configuration
(function registerConfiguration(): void { (function registerConfiguration(): void {
...@@ -263,6 +263,7 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform' ...@@ -263,6 +263,7 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform'
nls.localize('rootName', "`\${rootName}`: name of the workspace (e.g. myFolder or myWorkspace)."), nls.localize('rootName', "`\${rootName}`: name of the workspace (e.g. myFolder or myWorkspace)."),
nls.localize('rootPath', "`\${rootPath}`: file path of the workspace (e.g. /Users/Development/myWorkspace)."), nls.localize('rootPath', "`\${rootPath}`: file path of the workspace (e.g. /Users/Development/myWorkspace)."),
nls.localize('appName', "`\${appName}`: e.g. VS Code."), nls.localize('appName', "`\${appName}`: e.g. VS Code."),
nls.localize('remoteName', "`\${remoteName}`: e.g. SSH"),
nls.localize('dirty', "`\${dirty}`: a dirty indicator if the active editor is dirty."), nls.localize('dirty', "`\${dirty}`: a dirty indicator if the active editor is dirty."),
nls.localize('separator', "`\${separator}`: a conditional separator (\" - \") that only shows when surrounded by variables with values or static text.") nls.localize('separator', "`\${separator}`: a conditional separator (\" - \") that only shows when surrounded by variables with values or static text.")
].join('\n- '); // intentionally concatenated to not produce a string that is too long for translations ].join('\n- '); // intentionally concatenated to not produce a string that is too long for translations
...@@ -275,7 +276,18 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform' ...@@ -275,7 +276,18 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform'
'properties': { 'properties': {
'window.title': { 'window.title': {
'type': 'string', 'type': 'string',
'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}', 'default': (() => {
if (isMacintosh && isNative) {
return '${activeEditorShort}${separator}${rootName}'; // macOS has native dirty indicator
}
const base = '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}';
if (isWeb) {
return base + '${separator}${remoteName}'; // Web: always show remote indicator
}
return base;
})(),
'markdownDescription': windowTitleDescription 'markdownDescription': windowTitleDescription
}, },
'window.menuBarVisibility': { 'window.menuBarVisibility': {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册