title - introduce remoteName as variable
This commit is contained in:
parent
95e877c12b
commit
cd0f833fe0
|
@ -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('${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('${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('${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 {
|
|||
* {folderName}: e.g. myFolder
|
||||
* {folderPath}: e.g. /Users/Development/myFolder
|
||||
* {appName}: e.g. VS Code
|
||||
* {remoteName}: e.g. SSH
|
||||
* {dirty}: indicator
|
||||
* {separator}: conditional separator
|
||||
*/
|
||||
|
@ -297,6 +298,7 @@ export class TitlebarPart extends Part implements ITitleService {
|
|||
const folderPath = folder ? this.labelService.getUriLabel(folder.uri) : '';
|
||||
const dirty = editor && editor.isDirty() ? TitlebarPart.TITLE_DIRTY : '';
|
||||
const appName = this.environmentService.appNameLong;
|
||||
const remoteName = this.environmentService.configuration.remoteAuthority;
|
||||
const separator = TitlebarPart.TITLE_SEPARATOR;
|
||||
const titleTemplate = this.configurationService.getValue<string>('window.title');
|
||||
|
||||
|
@ -313,6 +315,7 @@ export class TitlebarPart extends Part implements ITitleService {
|
|||
folderPath,
|
||||
dirty,
|
||||
appName,
|
||||
remoteName,
|
||||
separator: { label: separator }
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import * as nls from 'vs/nls';
|
||||
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
|
||||
(function registerConfiguration(): void {
|
||||
|
@ -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('rootPath', "`\${rootPath}`: file path of the workspace (e.g. /Users/Development/myWorkspace)."),
|
||||
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('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
|
||||
|
@ -275,7 +276,18 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform'
|
|||
'properties': {
|
||||
'window.title': {
|
||||
'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
|
||||
},
|
||||
'window.menuBarVisibility': {
|
||||
|
|
Loading…
Reference in a new issue