Update ACE Editor to version 1.2.9
The new ACE editor introduces full support for emojis (and, thereby, UTF-16 characters with high- and low-surrogates). Hence, we can remove our custom fix. Further, this update will allow emojis to be used in pair programming sessions.
This commit is contained in:
34
vendor/assets/javascripts/ace/mode-gherkin.js
vendored
34
vendor/assets/javascripts/ace/mode-gherkin.js
vendored
@@ -5,16 +5,31 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
|
||||
|
||||
var GherkinHighlightRules = function() {
|
||||
var languages = [{
|
||||
name: "en",
|
||||
labels: "Feature|Background|Scenario(?: Outline)?|Examples",
|
||||
keywords: "Given|When|Then|And|But"
|
||||
}];
|
||||
|
||||
var labels = languages.map(function(l) {
|
||||
return l.labels;
|
||||
}).join("|");
|
||||
var keywords = languages.map(function(l) {
|
||||
return l.keywords;
|
||||
}).join("|");
|
||||
this.$rules = {
|
||||
start : [{
|
||||
token: 'constant.numeric',
|
||||
token: "constant.numeric",
|
||||
regex: "(?:(?:[1-9]\\d*)|(?:0))"
|
||||
}, {
|
||||
token : "comment",
|
||||
regex : "#.*$"
|
||||
}, {
|
||||
token : "keyword",
|
||||
regex : "Feature:|Background:|Scenario:|Scenario\ Outline:|Examples:|Given|When|Then|And|But|\\*",
|
||||
regex : "(?:" + labels + "):|(?:" + keywords + ")\\b"
|
||||
}, {
|
||||
token : "keyword",
|
||||
regex : "\\*"
|
||||
}, {
|
||||
token : "string", // multi line """ string start
|
||||
regex : '"{3}',
|
||||
@@ -28,7 +43,7 @@ var GherkinHighlightRules = function() {
|
||||
regex : "^\\s*(?=@[\\w])",
|
||||
next : [{
|
||||
token : "text",
|
||||
regex : "\\s+",
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : "variable.parameter",
|
||||
regex : "@[\\w]+"
|
||||
@@ -39,7 +54,7 @@ var GherkinHighlightRules = function() {
|
||||
}]
|
||||
}, {
|
||||
token : "comment",
|
||||
regex : "<.+>"
|
||||
regex : "<[^>]+>"
|
||||
}, {
|
||||
token : "comment",
|
||||
regex : "\\|(?=.)",
|
||||
@@ -88,7 +103,7 @@ var GherkinHighlightRules = function() {
|
||||
}]
|
||||
};
|
||||
this.normalizeRules();
|
||||
}
|
||||
};
|
||||
|
||||
oop.inherits(GherkinHighlightRules, TextHighlightRules);
|
||||
|
||||
@@ -103,6 +118,7 @@ var GherkinHighlightRules = require("./gherkin_highlight_rules").GherkinHighligh
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = GherkinHighlightRules;
|
||||
this.$behaviour = this.$defaultBehaviour;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
@@ -117,7 +133,7 @@ oop.inherits(Mode, TextMode);
|
||||
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
|
||||
console.log(state)
|
||||
console.log(state);
|
||||
|
||||
if(line.match("[ ]*\\|")) {
|
||||
indent += "| ";
|
||||
@@ -129,12 +145,12 @@ oop.inherits(Mode, TextMode);
|
||||
|
||||
|
||||
if (state == "start") {
|
||||
if (line.match("Scenario:|Feature:|Scenario\ Outline:|Background:")) {
|
||||
if (line.match("Scenario:|Feature:|Scenario Outline:|Background:")) {
|
||||
indent += space2;
|
||||
} else if(line.match("(Given|Then).+(:)$|Examples:")) {
|
||||
indent += space2;
|
||||
indent += space2;
|
||||
} else if(line.match("\\*.+")) {
|
||||
indent += "* ";
|
||||
indent += "* ";
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user