Skip to content
Snippets Groups Projects
Commit c4030470 authored by jots's avatar jots Committed by Marijn Haverbeke
Browse files

add begin and rescue, add electricChars

parent 10444abb
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) {
"require_relative", "extend", "autoload"
]);
var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then",
"unless", "catch", "loop", "proc"]);
"unless", "catch", "loop", "proc", "begin"]);
var dedentWords = wordObj(["end", "until"]);
var matching = {"[": "]", "{": "}", "(": ")"};
var curPunc;
......@@ -186,11 +186,14 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) {
var firstChar = textAfter && textAfter.charAt(0);
var ct = state.context;
var closing = ct.type == matching[firstChar] ||
ct.type == "keyword" && /^(?:end|until|else|elsif|when)\b/.test(textAfter);
ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
return ct.indented + (closing ? 0 : config.indentUnit) +
(state.continuedLine ? config.indentUnit : 0);
}
},
electricChars: "}de" // enD and rescuE
};
});
CodeMirror.defineMIME("text/x-ruby", "ruby");
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment