add Gherkin highlighting
This commit is contained in:
parent
c5f58503fe
commit
2428de10ed
2 changed files with 7 additions and 14 deletions
|
|
@ -16,14 +16,14 @@ oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
var space2 = " ";
|
||||||
|
|
||||||
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
console.log(state)
|
console.log(state)
|
||||||
|
|
||||||
if(line.match("[ ]*\\|")) {
|
if(line.match("[ ]*\\|")) {
|
||||||
console.log(line.match("\|"));
|
|
||||||
indent += "| ";
|
indent += "| ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,10 +33,10 @@ oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
|
||||||
if (state == "start") {
|
if (state == "start") {
|
||||||
if (line.match("Scenario:|Feature:")) {
|
if (line.match("Scenario:|Feature:|Scenario\ Outline:")) {
|
||||||
indent = tab;
|
indent += space2;
|
||||||
} else if(line.match("Given.+(:)$|Examples:")) {
|
} else if(line.match("(Given|Then).+(:)$|Examples:")) {
|
||||||
indent += tab;
|
indent += space2;
|
||||||
} else if(line.match("\\*.+")) {
|
} else if(line.match("\\*.+")) {
|
||||||
indent += "* ";
|
indent += "* ";
|
||||||
}
|
}
|
||||||
|
|
@ -45,13 +45,6 @@ oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
return indent;
|
return indent;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.checkOutdent = function(state, line, input) {
|
|
||||||
if(line.match("Feature:")) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Extra logic goes here. (see below)
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ var GherkinHighlightRules = function() {
|
||||||
regex : "#.*$"
|
regex : "#.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "Feature:|Background:|Scenario:|Scenario Outline:|Examples:|Given|When|Then|And|But|\\*|Scenario\ Outline",
|
regex : "Feature:|Background:|Scenario:|Scenario\ Outline:|Examples:|Given|When|Then|And|But|\\*",
|
||||||
}, {
|
}, {
|
||||||
token : "string", // multi line """ string start
|
token : "string", // multi line """ string start
|
||||||
regex : '"{3}',
|
regex : '"{3}',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue