Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function runAction(action, df) {
if (!isEnabled) {
return df.reject().promise();
}
// do not handle Tab key for unknown syntaxes
if (action == 'expand_abbreviation_with_tab') {
var syntax = editor.getSyntax();
var activeEditor = editor.editor;
// do not allow tab expander in JS/JSX since it breakes native
// snippets and indentation. Hardcode this exception for now
if (syntax === 'jsx' || !preferences.getPreference('tab') || !resources.hasSyntax(syntax)) {
return df.reject();
}
// do not expand abbreviation if there’s a selection
if (activeEditor.hasSelection()) {
if (activeEditor._handleTabKey) {
activeEditor._handleTabKey();
}
return df.resolve();
}
}
if (action == 'insert_formatted_line_break') {
var activeEditor = editor.editor;
var allowAction = !activeEditor.hasSelection() && ~lineBreakSyntaxes.indexOf(editor.getSyntax());
if (!allowAction) {