Skip to content

Commit 84e2708

Browse files
Adds source filtering logic directly from keybindingItems
1 parent ae5ec7e commit 84e2708

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

src/vs/workbench/parts/preferences/common/keybindingsEditorModel.ts

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,27 +121,20 @@ export class KeybindingsEditorModel extends EditorModel {
121121
return searchValue.split('@source:')[1].trim() || '';
122122
}
123123

124+
private matchSource(itemSource: string, searchValue: string): boolean {
125+
return itemSource.toLowerCase() === searchValue.toLowerCase();
126+
}
127+
124128
private filterBySource(keybindingItems: IKeybindingItem[], searchValue: string, completeMatch: boolean): IKeybindingItemEntry[] {
125-
const result: IKeybindingItemEntry[] = [];
126-
const words = searchValue.split(' ');
127-
const keybindingWords = this.splitKeybindingWords(words);
128-
for (const keybindingItem of keybindingItems) {
129-
let keybindingMatches = new KeybindingItemMatches(this.modifierLabels, keybindingItem, searchValue, words, keybindingWords, completeMatch);
130-
if (keybindingMatches.sourceMatches) {
131-
result.push({
129+
return <IKeybindingItemEntry[]>keybindingItems
130+
.filter((keybindingItem: IKeybindingItem) => this.matchSource(keybindingItem.source, searchValue))
131+
.map((keybindingItem: IKeybindingItem) => (
132+
{
132133
id: KeybindingsEditorModel.getId(keybindingItem),
133134
templateId: KEYBINDING_ENTRY_TEMPLATE_ID,
134-
commandLabelMatches: keybindingMatches.commandLabelMatches,
135-
commandDefaultLabelMatches: keybindingMatches.commandDefaultLabelMatches,
136135
keybindingItem,
137-
keybindingMatches: keybindingMatches.keybindingMatches,
138-
commandIdMatches: keybindingMatches.commandIdMatches,
139-
sourceMatches: keybindingMatches.sourceMatches,
140-
whenMatches: keybindingMatches.whenMatches
141-
});
142-
}
143-
}
144-
return result;
136+
}
137+
));
145138
}
146139

147140
private filterByText(keybindingItems: IKeybindingItem[], searchValue: string, completeMatch: boolean): IKeybindingItemEntry[] {

0 commit comments

Comments
 (0)