Skip to content
Snippets Groups Projects
Commit 3090d4b5 authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[ruby mode] Fix handling of 'unless'

parent c4030470
No related branches found
No related tags found
Loading
......@@ -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", "begin"]);
"catch", "loop", "proc", "begin"]);
var dedentWords = wordObj(["end", "until"]);
var matching = {"[": "]", "{": "}", "(": ")"};
var curPunc;
......@@ -166,7 +166,8 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) {
: "variable";
if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
else if (word == "if" && stream.column() == stream.indentation()) kwtype = "indent";
else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
kwtype = "indent";
}
if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style;
if (curPunc == "|") state.varList = !state.varList;
......
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