Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedgreen committed Mar 9, 2023
1 parent decf8c1 commit eaeaeaf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/vs/platform/keybinding/common/keybindingResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,18 @@ export class KeybindingResolver {
continue;
}

let diverges = false;
// Test if the shorter chord is a prefix of the onger one. If the shorter chord
// is a prefix it effectively will shadow the longer chord and is considered a
// conflict.
let shorterChordIsPrefix = true;
for (let i = 1; i < conflict.chords.length && i < item.chords.length; i++) {
if (conflict.chords[i] !== item.chords[i]) {
// The conflict diverges at the ith step
diverges = true;
continue;
// The ith step does not conflict
shorterChordIsPrefix = false;
break;
}
}
if (diverges) {
if (!shorterChordIsPrefix) {
continue;
}

Expand Down

0 comments on commit eaeaeaf

Please sign in to comment.