feat(settings): Keymap category — preset select (T-451)
The keybindings-ui extension contributes a Keymap SettingsCategory: a preset select (Default / Vim / VS Code / JetBrains) reading the active preset from kKeymapPresetSetting. Picking one routes through a new schema affordance — SettingsField.applyCommandPrefix — running `keymap.preset.<value>`, which calls KeymapService.setPreset to persist and reload the layered keymap live. The prefix path keeps the engine generic: settings a subsystem applies via a command (rather than a bare key write) declare the prefix; the scope tag and current-value read still use the key. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
library;
|
||||
|
||||
import 'package:clide/builtin/keybindings_ui/keybindings_ui.dart';
|
||||
import 'package:clide/extension/extension.dart';
|
||||
import 'package:clide/kernel/kernel.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@@ -46,4 +47,16 @@ void main() {
|
||||
await f.services.commands.execute('keymap.preset.default');
|
||||
expect(f.services.settings.get<String>(kKeymapPresetSetting), 'default');
|
||||
});
|
||||
|
||||
test('contributes a Keymap settings category routed through the preset commands (T-451)', () {
|
||||
final category = KeybindingsUiExtension().contributions
|
||||
.whereType<SettingsCategoryContribution>()
|
||||
.firstWhere((c) => c.id == 'keymap')
|
||||
.category;
|
||||
expect(category.title, 'Keymap');
|
||||
final field = category.sections.expand((s) => s.fields).firstWhere((f) => f.key == kKeymapPresetSetting);
|
||||
expect(field.kind, SettingsFieldKind.select);
|
||||
expect(field.applyCommandPrefix, 'keymap.preset.');
|
||||
expect(field.options.map((o) => o.value), containsAll(['default', 'vim', 'vscode', 'jetbrains']));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user