summaryrefslogtreecommitdiff
path: root/addons/web/static/lib/ace/javascript_highlight_rules.js
diff options
context:
space:
mode:
authorAndrea Ulliana <aul@odoo.com>2019-01-17 12:12:54 +0000
committerqsm-odoo <qsm@odoo.com>2019-02-05 14:12:16 +0000
commit7f2ce89554e3675f553d2658fc0a04cd5facf088 (patch)
tree154660068bfe5c1c98107335cc3e87d29dca5059 /addons/web/static/lib/ace/javascript_highlight_rules.js
parent8f3eff13fb76e71c881c8aae8e21b79cfad0cce2 (diff)
[IMP] web: add JS-related lib files for ace editor
In task handled in https://github.com/odoo/odoo/pull/29999, we will need support for javascript files in ace editor. This commit adds the related lib files. See https://ace.c9.io/#extending-highlighters: https://github.com/ajaxorg/ace/tree/master/lib/ace/mode 1. https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/doc_comment_highlight_rules.js 2. https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/javascript_highlight_rules.js 3. https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/javascript.js task-1919350
Diffstat (limited to 'addons/web/static/lib/ace/javascript_highlight_rules.js')
-rw-r--r--addons/web/static/lib/ace/javascript_highlight_rules.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/addons/web/static/lib/ace/javascript_highlight_rules.js b/addons/web/static/lib/ace/javascript_highlight_rules.js
new file mode 100644
index 00000000000..8a8675b5d85
--- /dev/null
+++ b/addons/web/static/lib/ace/javascript_highlight_rules.js
@@ -0,0 +1,48 @@
+define("ace/mode/doc_comment_highlight_rules",["require","exports","module"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var DocCommentHighlightRules = function() {
+ this.$rules = {
+ "start" : [ {
+ token : "comment.doc.tag",
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
+ },
+ DocCommentHighlightRules.getTagRule(),
+ {
+ defaultToken : "comment.doc",
+ caseInsensitive: true
+ }]
+ };
+};
+
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
+
+DocCommentHighlightRules.getTagRule = function(start) {
+ return {
+ token : "comment.doc.tag.storage.type",
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
+ };
+};
+
+DocCommentHighlightRules.getStartRule = function(start) {
+ return {
+ token : "comment.doc", // doc comment
+ regex : "\\/\\*(?=\\*)",
+ next : start
+ };
+};
+
+DocCommentHighlightRules.getEndRule = function (start) {
+ return {
+ token : "comment.doc", // closing comment
+ regex : "\\*\\/",
+ next : start
+ };
+};
+
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
+
+});