mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 09:08:53 +01:00
introduce application config model (#152889)
* introduce application config model - application configuration is active and used only in non default profiles - read/write application scoped settings only from application layer and not from user layer - extensions get application scoped values as global values - settings editor does not show application scoped settings in non default profle - added unit tests * fix tests
This commit is contained in:
committed by
GitHub
parent
a1b53fde82
commit
a1e1e307e3
@@ -44,6 +44,7 @@ suite('ExtHostConfiguration', function () {
|
||||
return {
|
||||
defaults: new ConfigurationModel(contents),
|
||||
policy: new ConfigurationModel(),
|
||||
application: new ConfigurationModel(),
|
||||
user: new ConfigurationModel(contents),
|
||||
workspace: new ConfigurationModel(),
|
||||
folders: [],
|
||||
@@ -281,6 +282,7 @@ suite('ExtHostConfiguration', function () {
|
||||
}
|
||||
}, ['editor.wordWrap']),
|
||||
policy: new ConfigurationModel(),
|
||||
application: new ConfigurationModel(),
|
||||
user: new ConfigurationModel({
|
||||
'editor': {
|
||||
'wordWrap': 'on'
|
||||
@@ -331,6 +333,7 @@ suite('ExtHostConfiguration', function () {
|
||||
}
|
||||
}, ['editor.wordWrap']),
|
||||
policy: new ConfigurationModel(),
|
||||
application: new ConfigurationModel(),
|
||||
user: new ConfigurationModel({
|
||||
'editor': {
|
||||
'wordWrap': 'on'
|
||||
@@ -409,6 +412,7 @@ suite('ExtHostConfiguration', function () {
|
||||
}
|
||||
}, ['editor.wordWrap']),
|
||||
policy: new ConfigurationModel(),
|
||||
application: new ConfigurationModel(),
|
||||
user: new ConfigurationModel({
|
||||
'editor': {
|
||||
'wordWrap': 'on'
|
||||
@@ -513,6 +517,7 @@ suite('ExtHostConfiguration', function () {
|
||||
}
|
||||
}),
|
||||
policy: new ConfigurationModel(),
|
||||
application: new ConfigurationModel(),
|
||||
user: toConfigurationModel({
|
||||
'editor.wordWrap': 'bounded',
|
||||
'[typescript]': {
|
||||
@@ -554,6 +559,59 @@ suite('ExtHostConfiguration', function () {
|
||||
assert.deepStrictEqual(actual.languageIds, ['markdown', 'typescript']);
|
||||
});
|
||||
|
||||
test('application is not set in inspect', () => {
|
||||
|
||||
const testObject = new ExtHostConfigProvider(
|
||||
new class extends mock<MainThreadConfigurationShape>() { },
|
||||
createExtHostWorkspace(),
|
||||
{
|
||||
defaults: new ConfigurationModel({
|
||||
'editor': {
|
||||
'wordWrap': 'off',
|
||||
'lineNumbers': 'on',
|
||||
'fontSize': '12px'
|
||||
}
|
||||
}, ['editor.wordWrap']),
|
||||
policy: new ConfigurationModel(),
|
||||
application: new ConfigurationModel({
|
||||
'editor': {
|
||||
'wordWrap': 'on'
|
||||
}
|
||||
}, ['editor.wordWrap']),
|
||||
user: new ConfigurationModel({
|
||||
'editor': {
|
||||
'wordWrap': 'auto',
|
||||
'lineNumbers': 'off'
|
||||
}
|
||||
}, ['editor.wordWrap']),
|
||||
workspace: new ConfigurationModel({}, []),
|
||||
folders: [],
|
||||
configurationScopes: []
|
||||
},
|
||||
new NullLogService()
|
||||
);
|
||||
|
||||
let actual = testObject.getConfiguration().inspect('editor.wordWrap')!;
|
||||
assert.strictEqual(actual.defaultValue, 'off');
|
||||
assert.strictEqual(actual.globalValue, 'auto');
|
||||
assert.strictEqual(actual.workspaceValue, undefined);
|
||||
assert.strictEqual(actual.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(testObject.getConfiguration().get('editor.wordWrap'), 'auto');
|
||||
|
||||
actual = testObject.getConfiguration().inspect('editor.lineNumbers')!;
|
||||
assert.strictEqual(actual.defaultValue, 'on');
|
||||
assert.strictEqual(actual.globalValue, 'off');
|
||||
assert.strictEqual(actual.workspaceValue, undefined);
|
||||
assert.strictEqual(actual.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(testObject.getConfiguration().get('editor.lineNumbers'), 'off');
|
||||
|
||||
actual = testObject.getConfiguration().inspect('editor.fontSize')!;
|
||||
assert.strictEqual(actual.defaultValue, '12px');
|
||||
assert.strictEqual(actual.globalValue, undefined);
|
||||
assert.strictEqual(actual.workspaceValue, undefined);
|
||||
assert.strictEqual(actual.workspaceFolderValue, undefined);
|
||||
assert.strictEqual(testObject.getConfiguration().get('editor.fontSize'), '12px');
|
||||
});
|
||||
|
||||
test('getConfiguration vs get', function () {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user