src/vs/platform/terminal/common/terminalProfiles.ts

115 LOC · 58 covered · 57 uncovered · 19 ranges · 5 concepts · 4 introducers · 5 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the fileptyHostService.ts ×54 · 735 introduced LOCptyHostService.ts ×54terminalProfiles.ts ×5 · 11 introduced LOCterminalProfiles.ts ×5terminalProfiles.ts ×6 · 12 introduced LOCterminalProfiles.ts ×6terminalProfiles.ts ×3 · 15 introduced LOCterminalProfiles.ts ×3terminalProfiles.ts ×5 · 20 introduced LOCterminalProfiles.ts ×5terminalProfiles.test|title=terminalProfiles createProfileSchemaEnums should return a multiple entries when there are multiple profiles|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/terminal/test/common/terminalProfiles.test|title=terminalProfiles createProfileSchemaEnums should return a multiple entries when there are multiple profiles|occurrence=1terminalProfiles.test|ti…terminalProfiles.test|title=terminalProfiles createProfileSchemaEnums should return a single entry when there is one profile|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/terminal/test/common/terminalProfiles.test|title=terminalProfiles createProfileSchemaEnums should return a single entry when there is one profile|occurrence=1terminalProfiles.test|ti…terminalProfiles.test|title=terminalProfiles createProfileSchemaEnums should return an empty array when there are no profiles|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/terminal/test/common/terminalProfiles.test|title=terminalProfiles createProfileSchemaEnums should return an empty array when there are no profiles|occurrence=1terminalProfiles.test|ti…terminalProfiles.test|title=terminalProfiles createProfileSchemaEnums should show all profile information|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/terminal/test/common/terminalProfiles.test|title=terminalProfiles createProfileSchemaEnums should show all profile information|occurrence=1terminalProfiles.test|ti…ptyHostService.test|title=PtyHostService restartPtyHost disposes listeners registered during pty host startup|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/terminal/test/node/ptyHostService.test|title=PtyHostService restartPtyHost disposes listeners registered during pty host startup|occurrence=1ptyHostService.test|titl…Focused file · src/vs/platform/terminal/common/terminalProfiles.ts · 115 LOCcommon/terminalProfiles.…

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- terminalProfiles.ts ×5
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { Codicon } from '../../../base/common/codicons.js';
7 > import { isUriComponents, URI } from '../../../base/common/uri.js';
8 > import { localize } from '../../../nls.js';
9 > import { IExtensionTerminalProfile, ITerminalProfile, TerminalIcon } from './terminal.js';
10 > import { ThemeIcon } from '../../../base/common/themables.js';
11 > import { isObject, isString, type SingleOrMany } from '../../../base/common/types.js';
12 >
13 > export function createProfileSchemaEnums(detectedProfiles: ITerminalProfile[], extensionProfiles?: readonly IExtensionTerminalProfile[]): {
14 > values: (string | null)[] | undefined; terminalProfiles.ts ×3
15 > markdownDescriptions: string[] | undefined;
16 > } {
17 > const result: { name: string | null; description: string }[] = [{
18 > name: null,
19 > description: localize('terminalAutomaticProfile', 'Automatically detect the default')
20 > }];
21 > result.push(...detectedProfiles.map(e => {
22 > return { terminalProfiles.ts ×6
23 > name: e.profileName,
24 > description: createProfileDescription(e)
25 > };
27 > if (extensionProfiles) {
28 result.push(...extensionProfiles.map(extensionProfile => {
29 return {
30 name: extensionProfile.title,
31 description: createExtensionProfileDescription(extensionProfile)
32 };
33 }));
34 }
35 > return { terminalProfiles.ts ×3
36 > values: result.map(e => e.name),
37 > markdownDescriptions: result.map(e => e.description)
38 > };
39 > }
41 > function createProfileDescription(profile: ITerminalProfile): string { terminalProfiles.ts ×6
42 > let description = `$(${ThemeIcon.isThemeIcon(profile.icon) ? profile.icon.id : profile.icon ? profile.icon : Codicon.terminal.id}) ${profile.profileName}\n- path: ${profile.path}`;
43 > if (profile.args) {
44 > if (isString(profile.args)) { terminalProfiles.ts ×5
45 description += `\n- args: "${profile.args}"`;
46 > } else { terminalProfiles.ts ×5
47 > description += `\n- args: [${profile.args.length === 0 ? '' : `'${profile.args.join(`','`)}'`}]`;
48 > }
49 > }
50 > if (profile.overrideName !== undefined) { terminalProfiles.ts ×6
51 > description += `\n- overrideName: ${profile.overrideName}`; terminalProfiles.ts ×5
52 > }
53 > if (profile.color) { terminalProfiles.ts ×6
54 > description += `\n- color: ${profile.color}`; terminalProfiles.ts ×5
55 > }
56 > if (profile.env) { terminalProfiles.ts ×6
57 > description += `\n- env: ${JSON.stringify(profile.env)}`; terminalProfiles.ts ×5
58 > }
59 > return description; terminalProfiles.ts ×6
60 > }
62 function createExtensionProfileDescription(profile: IExtensionTerminalProfile): string {
63 const description = `$(${ThemeIcon.isThemeIcon(profile.icon) ? profile.icon.id : profile.icon ? profile.icon : Codicon.terminal.id}) ${profile.title}\n- extensionIdentifier: ${profile.extensionIdentifier}`;
64 return description;
65 }
67 >
68 > export function terminalProfileArgsMatch(args1: SingleOrMany<string> | undefined, args2: SingleOrMany<string> | undefined): boolean {
69 if (!args1 && !args2) {
70 return true;
71 } else if (isString(args1) && isString(args2)) {
72 return args1 === args2;
73 } else if (Array.isArray(args1) && Array.isArray(args2)) {
74 if (args1.length !== args2.length) {
75 return false;
76 }
77 for (let i = 0; i < args1.length; i++) {
78 if (args1[i] !== args2[i]) {
79 return false;
80 }
81 }
82 return true;
83 }
84 return false;
85 }
87 > export function terminalIconsEqual(a?: TerminalIcon, b?: TerminalIcon): boolean {
88 if (!a && !b) {
89 return true;
90 } else if (!a || !b) {
91 return false;
92 }
93
94 if (ThemeIcon.isThemeIcon(a) && ThemeIcon.isThemeIcon(b)) {
95 return a.id === b.id && a.color === b.color;
96 }
97 if (
98 isObject(a) && !URI.isUri(a) && !ThemeIcon.isThemeIcon(a) &&
99 isObject(b) && !URI.isUri(b) && !ThemeIcon.isThemeIcon(b)
100 ) {
101 const castedA = (a as { light: unknown; dark: unknown });
102 const castedB = (b as { light: unknown; dark: unknown });
103 if ((URI.isUri(castedA.light) || isUriComponents(castedA.light)) && (URI.isUri(castedA.dark) || isUriComponents(castedA.dark))
104 && (URI.isUri(castedB.light) || isUriComponents(castedB.light)) && (URI.isUri(castedB.dark) || isUriComponents(castedB.dark))) {
105 return castedA.light.path === castedB.light.path && castedA.dark.path === castedB.dark.path;
106 }
107 }
108 if ((URI.isUri(a) && URI.isUri(b)) || (isUriComponents(a) || isUriComponents(b))) {
109 const castedA = (a as { scheme: unknown; path: unknown });
110 const castedB = (b as { scheme: unknown; path: unknown });
111 return castedA.path === castedB.path && castedA.scheme === castedB.scheme;
112 }
113
114 return false;
115 }