Skip to content

Commit 1f2cecf

Browse files
committed
Merge branch 'main' into dev/mjbvz/delicious-snail
2 parents a0f95f9 + d62af7e commit 1f2cecf

File tree

127 files changed

+9872
-2104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+9872
-2104
lines changed

.github/CODENOTIFY

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ src/vs/workbench/contrib/files/** @bpasero
102102
src/vs/workbench/contrib/chat/browser/chatListRenderer.ts @roblourens
103103
src/vs/workbench/contrib/chat/browser/chatSetup.ts @bpasero
104104
src/vs/workbench/contrib/chat/browser/chatStatus.ts @bpasero
105+
src/vs/workbench/contrib/chat/browser/agentSessions/** @bpasero
105106
src/vs/workbench/contrib/localization/** @TylerLeonhardt
106107
src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts @TylerLeonhardt
107108
src/vs/workbench/contrib/update/browser/releaseNotesEditor.ts @alexr00 @joaomoreno

build/lib/policies/basePolicy.js

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/lib/policies/basePolicy.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*---------------------------------------------------------------------------------------------
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 { renderADMLString } from './render';
7+
import { Category, LanguageTranslations, NlsString, Policy, PolicyType } from './types';
8+
9+
export abstract class BasePolicy implements Policy {
10+
constructor(
11+
readonly type: PolicyType,
12+
readonly name: string,
13+
readonly category: Category,
14+
readonly minimumVersion: string,
15+
protected description: NlsString,
16+
protected moduleName: string,
17+
) { }
18+
19+
protected renderADMLString(nlsString: NlsString, translations?: LanguageTranslations): string {
20+
return renderADMLString(this.name, this.moduleName, nlsString, translations);
21+
}
22+
23+
renderADMX(regKey: string) {
24+
return [
25+
`<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey.replace(/\./g, '_')})" key="Software\\Policies\\Microsoft\\${regKey}" presentation="$(presentation.${this.name})">`,
26+
` <parentCategory ref="${this.category.name.nlsKey}" />`,
27+
` <supportedOn ref="Supported_${this.minimumVersion.replace(/\./g, '_')}" />`,
28+
` <elements>`,
29+
...this.renderADMXElements(),
30+
` </elements>`,
31+
`</policy>`
32+
];
33+
}
34+
35+
protected abstract renderADMXElements(): string[];
36+
37+
renderADMLStrings(translations?: LanguageTranslations) {
38+
return [
39+
`<string id="${this.name}">${this.name}</string>`,
40+
this.renderADMLString(this.description, translations)
41+
];
42+
}
43+
44+
renderADMLPresentation(): string {
45+
return `<presentation id="${this.name}">${this.renderADMLPresentationContents()}</presentation>`;
46+
}
47+
48+
protected abstract renderADMLPresentationContents(): string;
49+
50+
renderProfile() {
51+
return [`<key>${this.name}</key>`, this.renderProfileValue()];
52+
}
53+
54+
renderProfileManifest(translations?: LanguageTranslations): string {
55+
return `<dict>
56+
${this.renderProfileManifestValue(translations)}
57+
</dict>`;
58+
}
59+
60+
abstract renderProfileValue(): string;
61+
abstract renderProfileManifestValue(translations?: LanguageTranslations): string;
62+
}

build/lib/policies/booleanPolicy.js

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*---------------------------------------------------------------------------------------------
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 { BasePolicy } from './basePolicy';
7+
import { CategoryDto, PolicyDto } from './policyDto';
8+
import { renderProfileString } from './render';
9+
import { Category, NlsString, PolicyType, LanguageTranslations } from './types';
10+
11+
export class BooleanPolicy extends BasePolicy {
12+
13+
static from(category: CategoryDto, policy: PolicyDto): BooleanPolicy | undefined {
14+
const { name, minimumVersion, localization, type } = policy;
15+
16+
if (type !== 'boolean') {
17+
return undefined;
18+
}
19+
20+
return new BooleanPolicy(name, { moduleName: '', name: { nlsKey: category.name.key, value: category.name.value } }, minimumVersion, { nlsKey: localization.description.key, value: localization.description.value }, '');
21+
}
22+
23+
private constructor(
24+
name: string,
25+
category: Category,
26+
minimumVersion: string,
27+
description: NlsString,
28+
moduleName: string,
29+
) {
30+
super(PolicyType.Boolean, name, category, minimumVersion, description, moduleName);
31+
}
32+
33+
protected renderADMXElements(): string[] {
34+
return [
35+
`<boolean id="${this.name}" valueName="${this.name}">`,
36+
` <trueValue><decimal value="1" /></trueValue><falseValue><decimal value="0" /></falseValue>`,
37+
`</boolean>`
38+
];
39+
}
40+
41+
renderADMLPresentationContents() {
42+
return `<checkBox refId="${this.name}">${this.name}</checkBox>`;
43+
}
44+
45+
renderProfileValue(): string {
46+
return `<false/>`;
47+
}
48+
49+
renderProfileManifestValue(translations?: LanguageTranslations): string {
50+
return `<key>pfm_default</key>
51+
<false/>
52+
<key>pfm_description</key>
53+
<string>${renderProfileString(this.name, this.moduleName, this.description, translations)}</string>
54+
<key>pfm_name</key>
55+
<string>${this.name}</string>
56+
<key>pfm_title</key>
57+
<string>${this.name}</string>
58+
<key>pfm_type</key>
59+
<string>boolean</string>`;
60+
}
61+
}

build/lib/policies/numberPolicy.js

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/lib/policies/numberPolicy.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*---------------------------------------------------------------------------------------------
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 { BasePolicy } from './basePolicy';
7+
import { CategoryDto, PolicyDto } from './policyDto';
8+
import { renderProfileString } from './render';
9+
import { Category, NlsString, PolicyType, LanguageTranslations } from './types';
10+
11+
export class NumberPolicy extends BasePolicy {
12+
13+
static from(category: CategoryDto, policy: PolicyDto): NumberPolicy | undefined {
14+
const { type, default: defaultValue, name, minimumVersion, localization } = policy;
15+
16+
if (type !== 'number') {
17+
return undefined;
18+
}
19+
20+
if (typeof defaultValue !== 'number') {
21+
throw new Error(`Missing required 'default' property.`);
22+
}
23+
24+
return new NumberPolicy(name, { moduleName: '', name: { nlsKey: category.name.key, value: category.name.value } }, minimumVersion, { nlsKey: localization.description.key, value: localization.description.value }, '', defaultValue);
25+
}
26+
27+
private constructor(
28+
name: string,
29+
category: Category,
30+
minimumVersion: string,
31+
description: NlsString,
32+
moduleName: string,
33+
protected readonly defaultValue: number,
34+
) {
35+
super(PolicyType.Number, name, category, minimumVersion, description, moduleName);
36+
}
37+
38+
protected renderADMXElements(): string[] {
39+
return [
40+
`<decimal id="${this.name}" valueName="${this.name}" />`
41+
// `<decimal id="Quarantine_PurgeItemsAfterDelay" valueName="PurgeItemsAfterDelay" minValue="0" maxValue="10000000" />`
42+
];
43+
}
44+
45+
renderADMLPresentationContents() {
46+
return `<decimalTextBox refId="${this.name}" defaultValue="${this.defaultValue}">${this.name}</decimalTextBox>`;
47+
}
48+
49+
renderProfileValue() {
50+
return `<integer>${this.defaultValue}</integer>`;
51+
}
52+
53+
renderProfileManifestValue(translations?: LanguageTranslations) {
54+
return `<key>pfm_default</key>
55+
<integer>${this.defaultValue}</integer>
56+
<key>pfm_description</key>
57+
<string>${renderProfileString(this.name, this.moduleName, this.description, translations)}</string>
58+
<key>pfm_name</key>
59+
<string>${this.name}</string>
60+
<key>pfm_title</key>
61+
<string>${this.name}</string>
62+
<key>pfm_type</key>
63+
<string>integer</string>`;
64+
}
65+
}

0 commit comments

Comments
 (0)