terminal: don't wrap $() icons of contributed profiles again
Extensions may contribute a terminal profile icon as "$(debug)", which is the documented syntax and what the profile quick pick already parses. The settings enum description wrapped that string in $() once more, so the default profile setting showed $($(debug)). Parse string icons with ThemeIcon.fromString first and fall back to the plain id.
This commit is contained in:
1 parent
6c80ee4884
commit
fd90b7606a
2 files changed
+28
-2
No files matched your search
@@ -60,7 +60,8 @@ function createProfileDescription(profile: ITerminalProfile): string {
|
||||
}
|
||||
|
||||
function createExtensionProfileDescription(profile: IExtensionTerminalProfile): string {
|
||||
const description = `$(${ThemeIcon.isThemeIcon(profile.icon) ? profile.icon.id : profile.icon ? profile.icon : Codicon.terminal.id}) ${profile.title}\n- extensionIdentifier: ${profile.extensionIdentifier}`;
|
||||
const icon = isString(profile.icon) ? ThemeIcon.fromString(profile.icon) ?? profile.icon : profile.icon;
|
||||
const description = `$(${ThemeIcon.isThemeIcon(icon) ? icon.id : icon ? icon : Codicon.terminal.id}) ${profile.title}\n- extensionIdentifier: ${profile.extensionIdentifier}`;
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { deepStrictEqual } from 'assert';
|
||||
import { Codicon } from '../../../../base/common/codicons.js';
|
||||
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';
|
||||
import { ITerminalProfile } from '../../common/terminal.js';
|
||||
import { IExtensionTerminalProfile, ITerminalProfile } from '../../common/terminal.js';
|
||||
import { createProfileSchemaEnums } from '../../common/terminalProfiles.js';
|
||||
|
||||
suite('terminalProfiles', () => {
|
||||
@@ -89,5 +89,30 @@ suite('terminalProfiles', () => {
|
||||
]
|
||||
});
|
||||
});
|
||||
test('should not wrap an extension profile icon that already uses the $() syntax', () => {
|
||||
const extensionProfiles: IExtensionTerminalProfile[] = [{
|
||||
extensionIdentifier: 'ms-vscode.js-debug',
|
||||
id: 'extension.js-debug.debugTerminal',
|
||||
title: 'JavaScript Debug Terminal',
|
||||
icon: '$(debug)'
|
||||
}, {
|
||||
extensionIdentifier: 'publisher.extension',
|
||||
id: 'extension.terminal',
|
||||
title: 'Extension Terminal',
|
||||
icon: 'zap'
|
||||
}];
|
||||
deepStrictEqual(createProfileSchemaEnums([], extensionProfiles), {
|
||||
values: [
|
||||
null,
|
||||
'JavaScript Debug Terminal',
|
||||
'Extension Terminal'
|
||||
],
|
||||
markdownDescriptions: [
|
||||
'Automatically detect the default',
|
||||
'$(debug) JavaScript Debug Terminal\n- extensionIdentifier: ms-vscode.js-debug',
|
||||
'$(zap) Extension Terminal\n- extensionIdentifier: publisher.extension'
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user