Minor cleanup on handleKey config options to ensure clean list of bound keys

This commit is contained in:
xconverge 2017-03-25 09:20:12 -07:00
parent 272f7826e2
commit 09f623477f
2 changed files with 6 additions and 2 deletions

View File

@ -245,6 +245,10 @@ export async function activate(context: vscode.ExtensionContext) {
showCmdLine("", modeHandlerToEditorIdentity[new EditorIdentity(vscode.window.activeTextEditor).toString()]);
});
// Clear boundKeyCombinations array incase there are any entries in it so
// that we have a clean list of keys with no duplicates
Configuration.boundKeyCombinations = [];
for (let keybinding of packagejson.contributes.keybindings) {
let keyToBeBound = "";
@ -259,7 +263,7 @@ export async function activate(context: vscode.ExtensionContext) {
keyToBeBound = keybinding.key;
}
let bracketedKey = AngleBracketNotation.Normalize(keyToBeBound);
const bracketedKey = AngleBracketNotation.Normalize(keyToBeBound);
// Store registered key bindings in bracket notation form
Configuration.boundKeyCombinations.push(bracketedKey);

View File

@ -67,7 +67,7 @@ class ConfigurationClass {
const handleKeys = vscode.workspace.getConfiguration('vim')
.get<IHandleKeys[]>("handleKeys", []);
for (let bracketedKey of this.boundKeyCombinations) {
for (const bracketedKey of this.boundKeyCombinations) {
// Set context for key that is not used
// This either happens when user sets useCtrlKeys to false (ctrl keys are not used then)
// Or if user usese vim.handleKeys configuration option to set certain combinations to false