Keymaps are now updated without restarting (#2455)

* Reload keymaps without restarting

* Reattach key listeners when config have changed
This commit is contained in:
CHaBou 2017-11-15 00:55:21 +01:00 committed by GitHub
parent 319ff3bcd7
commit 81709073cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 25 deletions

View file

@ -43,6 +43,15 @@ config.subscribe(() => {
}
});
function checkDeprecatedExtendKeymaps() {
modules.forEach(plugin => {
if (plugin.extendKeymaps) {
notify('Plugin warning!', `"${plugin._name}" use deprecated "extendKeymaps" handler`);
return;
}
});
}
let updating = false;
function updatePlugins({force = false} = {}) {
@ -84,6 +93,7 @@ function updatePlugins({force = false} = {}) {
} else {
notify('Plugins Updated', 'No changes!');
}
checkDeprecatedExtendKeymaps();
watchers.forEach(fn => fn(err, {force}));
}
}
@ -347,15 +357,6 @@ exports.getDecoratedConfig = () => {
return translatedConfig;
};
exports.checkDeprecatedExtendKeymaps = () => {
modules.forEach(plugin => {
if (plugin.extendKeymaps) {
notify('Plugin warning!', `"${plugin._name}" use deprecated "extendKeymaps" handler`);
return;
}
});
};
exports.getDecoratedKeymaps = () => {
const baseKeymaps = config.getKeymaps();
// Ensure that all keys are in an array and don't use deprecated key combination`