Merge branch 'master' into v-1.2
Conflicts: lib/ace/commands/command_manager.js
This commit is contained in:
commit
bb827051a6
60 changed files with 3013 additions and 484 deletions
|
|
@ -1,3 +1,8 @@
|
||||||
|
|
||||||
|
* API Changes
|
||||||
|
- `editor.commands.commandKeyBinding` now contains direct map from keys to commands instead of grouping them by hashid
|
||||||
|
-
|
||||||
|
|
||||||
2014.09.21 Version 1.1.7
|
2014.09.21 Version 1.1.7
|
||||||
|
|
||||||
* Bugfixes
|
* Bugfixes
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ function jsFileList(path, filter) {
|
||||||
filter = /_test/;
|
filter = /_test/;
|
||||||
|
|
||||||
return fs.readdirSync(path).map(function(x) {
|
return fs.readdirSync(path).map(function(x) {
|
||||||
if (x.slice(-3) == ".js" && !filter.test(x) && !/\s/.test(x))
|
if (x.slice(-3) == ".js" && !filter.test(x) && !/\s|BASE|(\b|_)dummy(\b|_)/.test(x))
|
||||||
return x.slice(0, -3);
|
return x.slice(0, -3);
|
||||||
}).filter(Boolean);
|
}).filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
demo/kitchen-sink/docs/elm.elm
Normal file
12
demo/kitchen-sink/docs/elm.elm
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{- Ace {- 4 -} Elm -}
|
||||||
|
main = lift clock (every second)
|
||||||
|
|
||||||
|
clock t = collage 400 400 [ filled lightGrey (ngon 12 110)
|
||||||
|
, outlined (solid grey) (ngon 12 110)
|
||||||
|
, hand orange 100 t
|
||||||
|
, hand charcoal 100 (t/60)
|
||||||
|
, hand charcoal 60 (t/720) ]
|
||||||
|
|
||||||
|
hand clr len time =
|
||||||
|
let angle = degrees (90 - 6 * inSeconds time)
|
||||||
|
in traced (solid clr) <| segment (0,0) (len * cos angle, len * sin angle)
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
# Script to open a browser to current branch
|
# Script to open a browser to current branch
|
||||||
# Repo formats:
|
# Repo formats:
|
||||||
# ssh git@github.com:richoH/gh_pr.git
|
# ssh git@github.com:richo/gh_pr.git
|
||||||
# http https://richoH@github.com/richoH/gh_pr.git
|
# http https://richoH@github.com/richo/gh_pr.git
|
||||||
# git git://github.com/richoH/gh_pr.git
|
# git git://github.com/richo/gh_pr.git
|
||||||
|
|
||||||
username=`git config --get github.user`
|
username=`git config --get github.user`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,6 @@ require("ace/commands/default_commands").commands.push({
|
||||||
|
|
||||||
editor.keyBinding.addKeyboardHandler(kb);
|
editor.keyBinding.addKeyboardHandler(kb);
|
||||||
inlineEditor.keyBinding.addKeyboardHandler(kb);
|
inlineEditor.keyBinding.addKeyboardHandler(kb);
|
||||||
editor.on("changeSession", function(e) {
|
|
||||||
w.el.parentNode && w.el.parentNode.removeChild(w.el);
|
|
||||||
});
|
|
||||||
inlineEditor.setTheme("ace/theme/solarized_light");
|
inlineEditor.setTheme("ace/theme/solarized_light");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,6 @@ exports.singleLineEditor = function(el) {
|
||||||
|
|
||||||
renderer.setStyle("ace_one-line");
|
renderer.setStyle("ace_one-line");
|
||||||
var editor = new Editor(renderer);
|
var editor = new Editor(renderer);
|
||||||
new MultiSelect(editor);
|
|
||||||
editor.session.setUndoManager(new UndoManager());
|
editor.session.setUndoManager(new UndoManager());
|
||||||
|
|
||||||
editor.setShowPrintMargin(false);
|
editor.setShowPrintMargin(false);
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
|
* Defines a floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the anchor is updated.
|
||||||
*
|
*
|
||||||
* @class Anchor
|
* @class Anchor
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ var AcePopup = require("./autocomplete/popup").AcePopup;
|
||||||
var util = require("./autocomplete/util");
|
var util = require("./autocomplete/util");
|
||||||
var event = require("./lib/event");
|
var event = require("./lib/event");
|
||||||
var lang = require("./lib/lang");
|
var lang = require("./lib/lang");
|
||||||
|
var dom = require("./lib/dom");
|
||||||
var snippetManager = require("./snippets").snippetManager;
|
var snippetManager = require("./snippets").snippetManager;
|
||||||
|
|
||||||
var Autocomplete = function() {
|
var Autocomplete = function() {
|
||||||
|
|
@ -52,6 +53,8 @@ var Autocomplete = function() {
|
||||||
this.changeTimer = lang.delayedCall(function() {
|
this.changeTimer = lang.delayedCall(function() {
|
||||||
this.updateCompletions(true);
|
this.updateCompletions(true);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
@ -64,6 +67,13 @@ var Autocomplete = function() {
|
||||||
e.stop();
|
e.stop();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
this.popup.focus = this.editor.focus.bind(this.editor);
|
this.popup.focus = this.editor.focus.bind(this.editor);
|
||||||
|
this.popup.on("select", this.tooltipTimer.bind(null, null));
|
||||||
|
this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
|
||||||
|
return this.popup;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getPopup = function() {
|
||||||
|
return this.popup || this.$init();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.openPopup = function(editor, prefix, keepPopupPosition) {
|
this.openPopup = function(editor, prefix, keepPopupPosition) {
|
||||||
|
|
@ -101,6 +111,7 @@ var Autocomplete = function() {
|
||||||
this.editor.off("mousedown", this.mousedownListener);
|
this.editor.off("mousedown", this.mousedownListener);
|
||||||
this.editor.off("mousewheel", this.mousewheelListener);
|
this.editor.off("mousewheel", this.mousewheelListener);
|
||||||
this.changeTimer.cancel();
|
this.changeTimer.cancel();
|
||||||
|
this.hideDocTooltip();
|
||||||
|
|
||||||
if (this.popup && this.popup.isOpen) {
|
if (this.popup && this.popup.isOpen) {
|
||||||
this.gatherCompletionsId += 1;
|
this.gatherCompletionsId += 1;
|
||||||
|
|
@ -124,12 +135,17 @@ var Autocomplete = function() {
|
||||||
this.detach();
|
this.detach();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.blurListener = function() {
|
this.blurListener = function(e) {
|
||||||
// we have to check if activeElement is a child of popup because
|
// we have to check if activeElement is a child of popup because
|
||||||
// on IE preventDefault doesn't stop scrollbar from being focussed
|
// on IE preventDefault doesn't stop scrollbar from being focussed
|
||||||
var el = document.activeElement;
|
var el = document.activeElement;
|
||||||
if (el != this.editor.textInput.getElement() && el.parentNode != this.popup.container)
|
var text = this.editor.textInput.getElement()
|
||||||
|
if (el != text && el.parentNode != this.popup.container
|
||||||
|
&& el != this.tooltipNode && e.relatedTarget != this.tooltipNode
|
||||||
|
&& e.relatedTarget != text
|
||||||
|
) {
|
||||||
this.detach();
|
this.detach();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.mousedownListener = function(e) {
|
this.mousedownListener = function(e) {
|
||||||
|
|
@ -178,6 +194,7 @@ var Autocomplete = function() {
|
||||||
this.detach();
|
this.detach();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.commands = {
|
this.commands = {
|
||||||
"Up": function(editor) { editor.completer.goTo("up"); },
|
"Up": function(editor) { editor.completer.goTo("up"); },
|
||||||
"Down": function(editor) { editor.completer.goTo("down"); },
|
"Down": function(editor) { editor.completer.goTo("down"); },
|
||||||
|
|
@ -311,6 +328,74 @@ var Autocomplete = function() {
|
||||||
this.editor.$mouseHandler.cancelContextMenu();
|
this.editor.$mouseHandler.cancelContextMenu();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.updateDocTooltip = function() {
|
||||||
|
var popup = this.popup;
|
||||||
|
var all = popup.data;
|
||||||
|
var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
|
||||||
|
var doc = null;
|
||||||
|
if (!selected || !this.editor || !this.popup.isOpen)
|
||||||
|
return this.hideDocTooltip();
|
||||||
|
this.editor.completers.some(function(completer) {
|
||||||
|
if (completer.getDocTooltip)
|
||||||
|
doc = completer.getDocTooltip(selected);
|
||||||
|
return doc;
|
||||||
|
});
|
||||||
|
if (!doc)
|
||||||
|
doc = selected;
|
||||||
|
|
||||||
|
if (typeof doc == "string")
|
||||||
|
doc = {tooltipText: doc}
|
||||||
|
if (!doc || !(doc.docHTML || doc.docText))
|
||||||
|
return this.hideDocTooltip();
|
||||||
|
this.showDocTooltip(doc);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.showDocTooltip = function(item) {
|
||||||
|
if (!this.tooltipNode) {
|
||||||
|
this.tooltipNode = dom.createElement("pre");
|
||||||
|
this.tooltipNode.className = "ace_tooltip ace_doc-tooltip";
|
||||||
|
this.tooltipNode.style.margin = 0;
|
||||||
|
this.tooltipNode.style.pointerEvents = "auto";
|
||||||
|
this.tooltipNode.tabIndex = -1;
|
||||||
|
this.tooltipNode.onblur = this.blurListener.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var tooltipNode = this.tooltipNode;
|
||||||
|
if (item.docHTML) {
|
||||||
|
tooltipNode.innerHTML = item.docHTML;
|
||||||
|
} else if (item.docText) {
|
||||||
|
tooltipNode.textContent = item.docText;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tooltipNode.parentNode)
|
||||||
|
document.body.appendChild(tooltipNode);
|
||||||
|
var popup = this.popup;
|
||||||
|
var rect = popup.container.getBoundingClientRect();
|
||||||
|
tooltipNode.style.top = popup.container.style.top;
|
||||||
|
tooltipNode.style.bottom = popup.container.style.bottom;
|
||||||
|
|
||||||
|
if (window.innerWidth - rect.right < 320) {
|
||||||
|
tooltipNode.style.right = window.innerWidth - rect.left + "px";
|
||||||
|
tooltipNode.style.left = "";
|
||||||
|
} else {
|
||||||
|
tooltipNode.style.left = (rect.right + 1) + "px";
|
||||||
|
tooltipNode.style.right = "";
|
||||||
|
}
|
||||||
|
// tooltipNode.style.height = rect.height + "px";
|
||||||
|
tooltipNode.style.display = "block";
|
||||||
|
};
|
||||||
|
|
||||||
|
this.hideDocTooltip = function() {
|
||||||
|
this.tooltipTimer.cancel();
|
||||||
|
if (!this.tooltipNode) return;
|
||||||
|
var el = this.tooltipNode;
|
||||||
|
if (!this.editor.isFocused() && document.activeElement == el)
|
||||||
|
this.editor.focus();
|
||||||
|
this.tooltipNode = null;
|
||||||
|
if (el.parentNode)
|
||||||
|
el.parentNode.removeChild(el);
|
||||||
|
};
|
||||||
|
|
||||||
}).call(Autocomplete.prototype);
|
}).call(Autocomplete.prototype);
|
||||||
|
|
||||||
Autocomplete.startCommand = {
|
Autocomplete.startCommand = {
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,12 @@ define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
var MultiHashHandler = require("../keyboard/hash_handler").MultiHashHandler;
|
||||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class CommandManager
|
* @class CommandManager
|
||||||
*
|
*
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -19,20 +18,27 @@ var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||||
**/
|
**/
|
||||||
|
|
||||||
var CommandManager = function(platform, commands) {
|
var CommandManager = function(platform, commands) {
|
||||||
HashHandler.call(this, commands, platform);
|
MultiHashHandler.call(this, commands, platform);
|
||||||
this.byName = this.commands;
|
this.byName = this.commands;
|
||||||
this.setDefaultHandler("exec", function(e) {
|
this.setDefaultHandler("exec", function(e) {
|
||||||
return e.command.exec(e.editor, e.args || {});
|
return e.command.exec(e.editor, e.args || {});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
oop.inherits(CommandManager, HashHandler);
|
oop.inherits(CommandManager, MultiHashHandler);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
oop.implement(this, EventEmitter);
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
this.exec = function(command, editor, args) {
|
this.exec = function(command, editor, args) {
|
||||||
|
if (Array.isArray(command)) {
|
||||||
|
for (var i = command.length; i--; ) {
|
||||||
|
if (this.exec(command[i], editor, args)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof command === "string")
|
if (typeof command === "string")
|
||||||
command = this.commands[command];
|
command = this.commands[command];
|
||||||
|
|
||||||
|
|
@ -43,10 +49,10 @@ oop.inherits(CommandManager, HashHandler);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var e = {editor: editor, command: command, args: args};
|
var e = {editor: editor, command: command, args: args};
|
||||||
var retvalue = this._emit("exec", e);
|
e.returnValue = this._emit("exec", e);
|
||||||
this._signal("afterExec", e);
|
this._signal("afterExec", e);
|
||||||
|
|
||||||
return retvalue === false ? false : true;
|
return e.returnValue === false ? false : true;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toggleRecording = function(editor) {
|
this.toggleRecording = function(editor) {
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ module.exports = {
|
||||||
assert.equal(command, "cm2");
|
assert.equal(command, "cm2");
|
||||||
|
|
||||||
var command = this.cm.findKeyCommand(0, "return");
|
var command = this.cm.findKeyCommand(0, "return");
|
||||||
assert.equal(command, "cm3");
|
assert.equal(command + "", ["cm4", "cm3"] + "");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -289,12 +289,11 @@ function Folding() {
|
||||||
if (startFold && endFold == startFold)
|
if (startFold && endFold == startFold)
|
||||||
return startFold.addSubFold(fold);
|
return startFold.addSubFold(fold);
|
||||||
|
|
||||||
if (
|
if (startFold && !startFold.range.isStart(startRow, startColumn))
|
||||||
(startFold && !startFold.range.isStart(startRow, startColumn))
|
this.removeFold(startFold);
|
||||||
|| (endFold && !endFold.range.isEnd(endRow, endColumn))
|
|
||||||
) {
|
if (endFold && !endFold.range.isEnd(endRow, endColumn))
|
||||||
throw new Error("A fold can't intersect already existing fold" + fold.range + startFold.range);
|
this.removeFold(endFold);
|
||||||
}
|
|
||||||
|
|
||||||
// Check if there are folds in the range we create the new fold for.
|
// Check if there are folds in the range we create the new fold for.
|
||||||
var folds = this.getFoldsInRange(fold.range);
|
var folds = this.getFoldsInRange(fold.range);
|
||||||
|
|
|
||||||
|
|
@ -115,30 +115,8 @@ var Editor = function(renderer, session) {
|
||||||
function last(a) {return a[a.length - 1]}
|
function last(a) {return a[a.length - 1]}
|
||||||
|
|
||||||
this.selections = [];
|
this.selections = [];
|
||||||
this.commands.on("exec", function(e) {
|
this.commands.on("exec", this.startOperation.bind(this), true);
|
||||||
this.startOperation(e);
|
this.commands.on("afterExec", this.endOperation.bind(this), true);
|
||||||
|
|
||||||
var command = e.command;
|
|
||||||
if (command.aceCommandGroup == "fileJump") {
|
|
||||||
var prev = this.prevOp;
|
|
||||||
if (!prev || prev.command.aceCommandGroup != "fileJump") {
|
|
||||||
this.lastFileJumpPos = last(this.selections);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.lastFileJumpPos = null;
|
|
||||||
}
|
|
||||||
}.bind(this), true);
|
|
||||||
|
|
||||||
this.commands.on("afterExec", function(e) {
|
|
||||||
var command = e.command;
|
|
||||||
|
|
||||||
if (command.aceCommandGroup == "fileJump") {
|
|
||||||
if (this.lastFileJumpPos && !this.curOp.selectionChanged) {
|
|
||||||
this.selection.fromJSON(this.lastFileJumpPos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.endOperation(e);
|
|
||||||
}.bind(this), true);
|
|
||||||
|
|
||||||
this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
|
this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
|
||||||
|
|
||||||
|
|
@ -173,18 +151,16 @@ var Editor = function(renderer, session) {
|
||||||
scrollTop: this.renderer.scrollTop
|
scrollTop: this.renderer.scrollTop
|
||||||
};
|
};
|
||||||
|
|
||||||
var command = this.curOp.command;
|
// this.selections.push(this.selection.toJSON());
|
||||||
if (command && command.scrollIntoView)
|
|
||||||
this.$blockScrolling++;
|
|
||||||
|
|
||||||
this.selections.push(this.selection.toJSON());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.endOperation = function() {
|
this.endOperation = function(e) {
|
||||||
if (this.curOp) {
|
if (this.curOp) {
|
||||||
|
if (e && e.returnValue === false)
|
||||||
|
return this.curOp = null;
|
||||||
|
|
||||||
var command = this.curOp.command;
|
var command = this.curOp.command;
|
||||||
if (command && command.scrollIntoView) {
|
if (command && command.scrollIntoView) {
|
||||||
this.$blockScrolling--;
|
|
||||||
switch (command.scrollIntoView) {
|
switch (command.scrollIntoView) {
|
||||||
case "center":
|
case "center":
|
||||||
this.renderer.scrollCursorIntoView(null, 0.5);
|
this.renderer.scrollCursorIntoView(null, 0.5);
|
||||||
|
|
@ -255,19 +231,19 @@ var Editor = function(renderer, session) {
|
||||||
* @param {String} keyboardHandler The new key handler
|
* @param {String} keyboardHandler The new key handler
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setKeyboardHandler = function(keyboardHandler) {
|
this.setKeyboardHandler = function(keyboardHandler, cb) {
|
||||||
if (!keyboardHandler) {
|
if (keyboardHandler && typeof keyboardHandler === "string") {
|
||||||
this.keyBinding.setKeyboardHandler(null);
|
|
||||||
} else if (typeof keyboardHandler === "string") {
|
|
||||||
this.$keybindingId = keyboardHandler;
|
this.$keybindingId = keyboardHandler;
|
||||||
var _self = this;
|
var _self = this;
|
||||||
config.loadModule(["keybinding", keyboardHandler], function(module) {
|
config.loadModule(["keybinding", keyboardHandler], function(module) {
|
||||||
if (_self.$keybindingId == keyboardHandler)
|
if (_self.$keybindingId == keyboardHandler)
|
||||||
_self.keyBinding.setKeyboardHandler(module && module.handler);
|
_self.keyBinding.setKeyboardHandler(module && module.handler);
|
||||||
|
cb && cb();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$keybindingId = null;
|
this.$keybindingId = null;
|
||||||
this.keyBinding.setKeyboardHandler(keyboardHandler);
|
this.keyBinding.setKeyboardHandler(keyboardHandler);
|
||||||
|
cb && cb();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -662,13 +638,13 @@ var Editor = function(renderer, session) {
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.onFocus = function() {
|
this.onFocus = function(e) {
|
||||||
if (this.$isFocused)
|
if (this.$isFocused)
|
||||||
return;
|
return;
|
||||||
this.$isFocused = true;
|
this.$isFocused = true;
|
||||||
this.renderer.showCursor();
|
this.renderer.showCursor();
|
||||||
this.renderer.visualizeFocus();
|
this.renderer.visualizeFocus();
|
||||||
this._emit("focus");
|
this._emit("focus", e);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -677,13 +653,13 @@ var Editor = function(renderer, session) {
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.onBlur = function() {
|
this.onBlur = function(e) {
|
||||||
if (!this.$isFocused)
|
if (!this.$isFocused)
|
||||||
return;
|
return;
|
||||||
this.$isFocused = false;
|
this.$isFocused = false;
|
||||||
this.renderer.hideCursor();
|
this.renderer.hideCursor();
|
||||||
this.renderer.visualizeBlur();
|
this.renderer.visualizeBlur();
|
||||||
this._emit("blur");
|
this._emit("blur", e);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$cursorChange = function() {
|
this.$cursorChange = function() {
|
||||||
|
|
@ -927,9 +903,8 @@ var Editor = function(renderer, session) {
|
||||||
this.insert(e.text, true);
|
this.insert(e.text, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.execCommand = function(command, args) {
|
this.execCommand = function(command, args) {
|
||||||
this.commands.exec(command, this, args);
|
return this.commands.exec(command, this, args);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2541,7 +2516,9 @@ var Editor = function(renderer, session) {
|
||||||
rect = self.renderer.container.getBoundingClientRect();
|
rect = self.renderer.container.getBoundingClientRect();
|
||||||
});
|
});
|
||||||
var onAfterRender = this.renderer.on("afterRender", function() {
|
var onAfterRender = this.renderer.on("afterRender", function() {
|
||||||
if (shouldScroll && rect && self.isFocused()) {
|
if (shouldScroll && rect && (self.isFocused()
|
||||||
|
|| self.searchBox && self.searchBox.isFocused())
|
||||||
|
) {
|
||||||
var renderer = self.renderer;
|
var renderer = self.renderer;
|
||||||
var pos = renderer.$cursorLayer.$pixelPos;
|
var pos = renderer.$cursorLayer.$pixelPos;
|
||||||
var config = renderer.layerConfig;
|
var config = renderer.layerConfig;
|
||||||
|
|
|
||||||
|
|
@ -34,15 +34,7 @@ var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
|
||||||
var Editor = require("ace/editor").Editor;
|
var Editor = require("ace/editor").Editor;
|
||||||
var snippetManager = require("ace/snippets").snippetManager;
|
var snippetManager = require("ace/snippets").snippetManager;
|
||||||
var Range = require("ace/range").Range;
|
var Range = require("ace/range").Range;
|
||||||
var emmet;
|
var emmet, emmetPath;
|
||||||
|
|
||||||
Editor.prototype.indexToPosition = function(index) {
|
|
||||||
return this.session.doc.indexToPosition(index);
|
|
||||||
};
|
|
||||||
|
|
||||||
Editor.prototype.positionToIndex = function(pos) {
|
|
||||||
return this.session.doc.positionToIndex(pos);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link IEmmetEditor} interface for Ace
|
* Implementation of {@link IEmmetEditor} interface for Ace
|
||||||
|
|
@ -72,9 +64,10 @@ AceEmmetEditor.prototype = {
|
||||||
getSelectionRange: function() {
|
getSelectionRange: function() {
|
||||||
// TODO should start be caret position instead?
|
// TODO should start be caret position instead?
|
||||||
var range = this.ace.getSelectionRange();
|
var range = this.ace.getSelectionRange();
|
||||||
|
var doc = this.ace.session.doc;
|
||||||
return {
|
return {
|
||||||
start: this.ace.positionToIndex(range.start),
|
start: doc.positionToIndex(range.start),
|
||||||
end: this.ace.positionToIndex(range.end)
|
end: doc.positionToIndex(range.end)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -91,9 +84,10 @@ AceEmmetEditor.prototype = {
|
||||||
* editor.createSelection(15);
|
* editor.createSelection(15);
|
||||||
*/
|
*/
|
||||||
createSelection: function(start, end) {
|
createSelection: function(start, end) {
|
||||||
|
var doc = this.ace.session.doc;
|
||||||
this.ace.selection.setRange({
|
this.ace.selection.setRange({
|
||||||
start: this.ace.indexToPosition(start),
|
start: doc.indexToPosition(start),
|
||||||
end: this.ace.indexToPosition(end)
|
end: doc.indexToPosition(end)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -106,9 +100,10 @@ AceEmmetEditor.prototype = {
|
||||||
* alert(range.start + ', ' + range.end);
|
* alert(range.start + ', ' + range.end);
|
||||||
*/
|
*/
|
||||||
getCurrentLineRange: function() {
|
getCurrentLineRange: function() {
|
||||||
var row = this.ace.getCursorPosition().row;
|
var ace = this.ace;
|
||||||
var lineLength = this.ace.session.getLine(row).length;
|
var row = ace.getCursorPosition().row;
|
||||||
var index = this.ace.positionToIndex({row: row, column: 0});
|
var lineLength = ace.session.getLine(row).length;
|
||||||
|
var index = ace.session.doc.positionToIndex({row: row, column: 0});
|
||||||
return {
|
return {
|
||||||
start: index,
|
start: index,
|
||||||
end: index + lineLength
|
end: index + lineLength
|
||||||
|
|
@ -121,7 +116,7 @@ AceEmmetEditor.prototype = {
|
||||||
*/
|
*/
|
||||||
getCaretPos: function(){
|
getCaretPos: function(){
|
||||||
var pos = this.ace.getCursorPosition();
|
var pos = this.ace.getCursorPosition();
|
||||||
return this.ace.positionToIndex(pos);
|
return this.ace.session.doc.positionToIndex(pos);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -129,7 +124,7 @@ AceEmmetEditor.prototype = {
|
||||||
* @param {Number} index Caret position
|
* @param {Number} index Caret position
|
||||||
*/
|
*/
|
||||||
setCaretPos: function(index){
|
setCaretPos: function(index){
|
||||||
var pos = this.ace.indexToPosition(index);
|
var pos = this.ace.session.doc.indexToPosition(index);
|
||||||
this.ace.selection.moveToPosition(pos);
|
this.ace.selection.moveToPosition(pos);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -169,14 +164,15 @@ AceEmmetEditor.prototype = {
|
||||||
start = 0;
|
start = 0;
|
||||||
|
|
||||||
var editor = this.ace;
|
var editor = this.ace;
|
||||||
var range = Range.fromPoints(editor.indexToPosition(start), editor.indexToPosition(end));
|
var doc = editor.session.doc;
|
||||||
|
var range = Range.fromPoints(doc.indexToPosition(start), doc.indexToPosition(end));
|
||||||
editor.session.remove(range);
|
editor.session.remove(range);
|
||||||
|
|
||||||
range.end = range.start;
|
range.end = range.start;
|
||||||
//editor.selection.setRange(range);
|
//editor.selection.setRange(range);
|
||||||
|
|
||||||
value = this.$updateTabstops(value);
|
value = this.$updateTabstops(value);
|
||||||
snippetManager.insertSnippet(editor, value)
|
snippetManager.insertSnippet(editor, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -292,7 +288,7 @@ AceEmmetEditor.prototype = {
|
||||||
lastZero = range.create(data.start, result);
|
lastZero = range.create(data.start, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result;
|
||||||
},
|
},
|
||||||
escape: function(ch) {
|
escape: function(ch) {
|
||||||
if (ch == '$') return '\\$';
|
if (ch == '$') return '\\$';
|
||||||
|
|
@ -363,12 +359,17 @@ exports.runEmmetCommand = function(editor) {
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pos = editor.selection.lead;
|
||||||
|
var token = editor.session.getTokenAt(pos.row, pos.column);
|
||||||
|
if (token && /\btag\b/.test(token.type))
|
||||||
|
return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var result = actions.run(this.action, editorProxy);
|
var result = actions.run(this.action, editorProxy);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
editor._signal("changeStatus", typeof e == "string" ? e : e.message);
|
editor._signal("changeStatus", typeof e == "string" ? e : e.message);
|
||||||
console.log(e);
|
console.log(e);
|
||||||
result = false
|
result = false;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
@ -383,20 +384,35 @@ for (var command in keymap) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.updateCommands = function(editor, enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
editor.keyBinding.addKeyboardHandler(exports.commands);
|
||||||
|
} else {
|
||||||
|
editor.keyBinding.removeKeyboardHandler(exports.commands);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.isSupportedMode = function(modeId) {
|
||||||
|
return modeId && /css|less|scss|sass|stylus|html|php|twig/.test(modeId);
|
||||||
|
};
|
||||||
|
|
||||||
var onChangeMode = function(e, target) {
|
var onChangeMode = function(e, target) {
|
||||||
var editor = target;
|
var editor = target;
|
||||||
if (!editor)
|
if (!editor)
|
||||||
return;
|
return;
|
||||||
var modeId = editor.session.$modeId;
|
var enabled = exports.isSupportedMode(editor.session.$modeId);
|
||||||
var enabled = modeId && /css|less|scss|sass|stylus|html|php/.test(modeId);
|
|
||||||
if (e.enableEmmet === false)
|
if (e.enableEmmet === false)
|
||||||
enabled = false;
|
enabled = false;
|
||||||
if (enabled)
|
if (enabled) {
|
||||||
editor.keyBinding.addKeyboardHandler(exports.commands);
|
if (typeof emmetPath == "string") {
|
||||||
else
|
require("ace/config").loadModule(emmetPath, function() {
|
||||||
editor.keyBinding.removeKeyboardHandler(exports.commands);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
});
|
||||||
|
emmetPath = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.updateCommands(editor, enabled);
|
||||||
|
};
|
||||||
|
|
||||||
exports.AceEmmetEditor = AceEmmetEditor;
|
exports.AceEmmetEditor = AceEmmetEditor;
|
||||||
require("ace/config").defineOptions(Editor.prototype, "editor", {
|
require("ace/config").defineOptions(Editor.prototype, "editor", {
|
||||||
|
|
@ -409,7 +425,11 @@ require("ace/config").defineOptions(Editor.prototype, "editor", {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exports.setCore = function(e) {
|
||||||
exports.setCore = function(e) {emmet = e;};
|
if (typeof e == "string")
|
||||||
|
emmetPath = e;
|
||||||
|
else
|
||||||
|
emmet = e;
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ define(function(require, exports, module) {
|
||||||
var snippetManager = require("../snippets").snippetManager;
|
var snippetManager = require("../snippets").snippetManager;
|
||||||
var Autocomplete = require("../autocomplete").Autocomplete;
|
var Autocomplete = require("../autocomplete").Autocomplete;
|
||||||
var config = require("../config");
|
var config = require("../config");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
var util = require("../autocomplete/util");
|
var util = require("../autocomplete/util");
|
||||||
|
|
||||||
var textCompleter = require("../autocomplete/text_completer");
|
var textCompleter = require("../autocomplete/text_completer");
|
||||||
|
|
@ -59,15 +60,29 @@ var snippetCompleter = {
|
||||||
completions.push({
|
completions.push({
|
||||||
caption: caption,
|
caption: caption,
|
||||||
snippet: s.content,
|
snippet: s.content,
|
||||||
meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet"
|
meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet",
|
||||||
|
type: "snippet"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
callback(null, completions);
|
callback(null, completions);
|
||||||
|
},
|
||||||
|
getDocTooltip: function(item) {
|
||||||
|
if (item.type == "snippet" && !item.docHTML) {
|
||||||
|
item.docHTML = [
|
||||||
|
"<b>", lang.escapeHTML(item.caption), "</b>", "<hr></hr>",
|
||||||
|
lang.escapeHTML(item.snippet)
|
||||||
|
].join("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var completers = [snippetCompleter, textCompleter, keyWordCompleter];
|
var completers = [snippetCompleter, textCompleter, keyWordCompleter];
|
||||||
|
// Allows default completers to be removed or replaced with a explict set of completers
|
||||||
|
// A null argument here will result in an empty completer array, not a null attribute
|
||||||
|
exports.setCompleters = function(val) {
|
||||||
|
completers = val || [];
|
||||||
|
};
|
||||||
exports.addCompleter = function(completer) {
|
exports.addCompleter = function(completer) {
|
||||||
completers.push(completer);
|
completers.push(completer);
|
||||||
};
|
};
|
||||||
|
|
@ -80,9 +95,7 @@ exports.snippetCompleter = snippetCompleter;
|
||||||
var expandSnippet = {
|
var expandSnippet = {
|
||||||
name: "expandSnippet",
|
name: "expandSnippet",
|
||||||
exec: function(editor) {
|
exec: function(editor) {
|
||||||
var success = snippetManager.expandWithTab(editor);
|
return snippetManager.expandWithTab(editor);
|
||||||
if (!success)
|
|
||||||
editor.execCommand("indent");
|
|
||||||
},
|
},
|
||||||
bindKey: "Tab"
|
bindKey: "Tab"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -69,29 +69,20 @@ module.exports.getEditorKeybordShortcuts = function(editor) {
|
||||||
editor.keyBinding.$handlers.forEach(function(handler) {
|
editor.keyBinding.$handlers.forEach(function(handler) {
|
||||||
var ckb = handler.commandKeyBinding;
|
var ckb = handler.commandKeyBinding;
|
||||||
for (var i in ckb) {
|
for (var i in ckb) {
|
||||||
var modifier = parseInt(i);
|
var key = i.replace(/(^|-)\w/g, function(x) { return x.toUpperCase(); });
|
||||||
if (modifier == -1) {
|
var commands = ckb[i];
|
||||||
modifier = "";
|
if (!Array.isArray(commands))
|
||||||
} else if(isNaN(modifier)) {
|
commands = [commands];
|
||||||
modifier = i;
|
commands.forEach(function(command) {
|
||||||
} else {
|
|
||||||
modifier = "" +
|
|
||||||
(modifier & KEY_MODS.command ? "Cmd-" : "") +
|
|
||||||
(modifier & KEY_MODS.ctrl ? "Ctrl-" : "") +
|
|
||||||
(modifier & KEY_MODS.alt ? "Alt-" : "") +
|
|
||||||
(modifier & KEY_MODS.shift ? "Shift-" : "");
|
|
||||||
}
|
|
||||||
for (var key in ckb[i]) {
|
|
||||||
var command = ckb[i][key]
|
|
||||||
if (typeof command != "string")
|
if (typeof command != "string")
|
||||||
command = command.name
|
command = command.name
|
||||||
if (commandMap[command]) {
|
if (commandMap[command]) {
|
||||||
commandMap[command].key += "|" + modifier + key;
|
commandMap[command].key += "|" + key;
|
||||||
} else {
|
} else {
|
||||||
commandMap[command] = {key: modifier+key, command: command};
|
commandMap[command] = {key: key, command: command};
|
||||||
keybindings.push(commandMap[command]);
|
keybindings.push(commandMap[command]);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return keybindings;
|
return keybindings;
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,11 @@ var supportedModes = {
|
||||||
Diff: ["diff|patch"],
|
Diff: ["diff|patch"],
|
||||||
Dockerfile: ["^Dockerfile"],
|
Dockerfile: ["^Dockerfile"],
|
||||||
Dot: ["dot"],
|
Dot: ["dot"],
|
||||||
|
Dummy: ["dummy"],
|
||||||
|
DummySyntax: ["dummy"],
|
||||||
Eiffel: ["e"],
|
Eiffel: ["e"],
|
||||||
EJS: ["ejs"],
|
EJS: ["ejs"],
|
||||||
|
Elm: ["elm"],
|
||||||
Erlang: ["erl|hrl"],
|
Erlang: ["erl|hrl"],
|
||||||
Forth: ["frt|fs|ldr"],
|
Forth: ["frt|fs|ldr"],
|
||||||
FTL: ["ftl"],
|
FTL: ["ftl"],
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,10 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
||||||
this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
|
this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.isFocused = function() {
|
||||||
|
var el = document.activeElement;
|
||||||
|
return el == this.searchInput || el == this.replaceInput;
|
||||||
|
}
|
||||||
}).call(SearchBox.prototype);
|
}).call(SearchBox.prototype);
|
||||||
|
|
||||||
exports.SearchBox = SearchBox;
|
exports.SearchBox = SearchBox;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ exports.handler.attach = function(editor) {
|
||||||
initialized = true;
|
initialized = true;
|
||||||
dom.importCssString('\
|
dom.importCssString('\
|
||||||
.emacs-mode .ace_cursor{\
|
.emacs-mode .ace_cursor{\
|
||||||
border: 2px rgba(50,250,50,0.8) solid!important;\
|
border: 1px rgba(50,250,50,0.8) solid!important;\
|
||||||
-moz-box-sizing: border-box!important;\
|
-moz-box-sizing: border-box!important;\
|
||||||
-webkit-box-sizing: border-box!important;\
|
-webkit-box-sizing: border-box!important;\
|
||||||
box-sizing: border-box!important;\
|
box-sizing: border-box!important;\
|
||||||
|
|
@ -195,6 +195,8 @@ exports.handler.onPaste = function(e, editor) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.handler.bindKey = function(key, command) {
|
exports.handler.bindKey = function(key, command) {
|
||||||
|
if (typeof key == "object")
|
||||||
|
key = key[this.platform];
|
||||||
if (!key)
|
if (!key)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,38 +33,26 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
var keyUtil = require("../lib/keys");
|
var keyUtil = require("../lib/keys");
|
||||||
var useragent = require("../lib/useragent");
|
var useragent = require("../lib/useragent");
|
||||||
|
var KEY_MODS = keyUtil.KEY_MODS;
|
||||||
|
|
||||||
function HashHandler(config, platform) {
|
function HashHandler(config, platform) {
|
||||||
this.platform = platform || (useragent.isMac ? "mac" : "win");
|
this.platform = platform || (useragent.isMac ? "mac" : "win");
|
||||||
this.commands = {};
|
this.commands = {};
|
||||||
this.commandKeyBinding = {};
|
this.commandKeyBinding = {};
|
||||||
|
|
||||||
// todo remove this after a while
|
|
||||||
if (this.__defineGetter__ && this.__defineSetter__ && typeof console != "undefined" && console.error) {
|
|
||||||
var warned = false;
|
|
||||||
var warn = function() {
|
|
||||||
if (!warned) {
|
|
||||||
warned = true;
|
|
||||||
console.error("commmandKeyBinding has too many m's. use commandKeyBinding");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.__defineGetter__("commmandKeyBinding", function() {
|
|
||||||
warn();
|
|
||||||
return this.commandKeyBinding;
|
|
||||||
});
|
|
||||||
this.__defineSetter__("commmandKeyBinding", function(val) {
|
|
||||||
warn();
|
|
||||||
return this.commandKeyBinding = val;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.commmandKeyBinding = this.commandKeyBinding;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.addCommands(config);
|
this.addCommands(config);
|
||||||
};
|
this.$singleCommand = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function MultiHashHandler(config, platform) {
|
||||||
|
HashHandler.call(this, config, platform);
|
||||||
|
this.$singleCommand = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiHashHandler.prototype = HashHandler.prototype;
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
||||||
this.addCommand = function(command) {
|
this.addCommand = function(command) {
|
||||||
if (this.commands[command.name])
|
if (this.commands[command.name])
|
||||||
this.removeCommand(command);
|
this.removeCommand(command);
|
||||||
|
|
@ -75,38 +63,77 @@ function HashHandler(config, platform) {
|
||||||
this._buildKeyHash(command);
|
this._buildKeyHash(command);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.removeCommand = function(command) {
|
this.removeCommand = function(command, keepCommand) {
|
||||||
var name = (typeof command === 'string' ? command : command.name);
|
var name = command && (typeof command === 'string' ? command : command.name);
|
||||||
command = this.commands[name];
|
command = this.commands[name];
|
||||||
delete this.commands[name];
|
if (!keepCommand)
|
||||||
|
delete this.commands[name];
|
||||||
|
|
||||||
// exhaustive search is brute force but since removeCommand is
|
// exhaustive search is brute force but since removeCommand is
|
||||||
// not a performance critical operation this should be OK
|
// not a performance critical operation this should be OK
|
||||||
var ckb = this.commandKeyBinding;
|
var ckb = this.commandKeyBinding;
|
||||||
for (var hashId in ckb) {
|
for (var keyId in ckb) {
|
||||||
for (var key in ckb[hashId]) {
|
var cmdGroup = ckb[keyId];
|
||||||
if (ckb[hashId][key] == command)
|
if (cmdGroup == command) {
|
||||||
delete ckb[hashId][key];
|
delete ckb[keyId];
|
||||||
|
} else if (Array.isArray(cmdGroup)) {
|
||||||
|
var i = cmdGroup.indexOf(command);
|
||||||
|
if (i != -1) {
|
||||||
|
cmdGroup.splice(i, 1);
|
||||||
|
if (cmdGroup.length == 1)
|
||||||
|
ckb[keyId] = cmdGroup[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.bindKey = function(key, command) {
|
this.bindKey = function(key, command, asDefault) {
|
||||||
if(!key)
|
if (typeof key == "object")
|
||||||
|
key = key[this.platform];
|
||||||
|
if (!key)
|
||||||
return;
|
return;
|
||||||
if (typeof command == "function") {
|
if (typeof command == "function")
|
||||||
this.addCommand({exec: command, bindKey: key, name: command.name || key});
|
return this.addCommand({exec: command, bindKey: key, name: command.name || key});
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ckb = this.commandKeyBinding;
|
|
||||||
key.split("|").forEach(function(keyPart) {
|
key.split("|").forEach(function(keyPart) {
|
||||||
var binding = this.parseKeys(keyPart, command);
|
var chain = "";
|
||||||
var hashId = binding.hashId;
|
if (keyPart.indexOf(" ") != -1) {
|
||||||
(ckb[hashId] || (ckb[hashId] = {}))[binding.key] = command;
|
var parts = keyPart.split(/\s+/);
|
||||||
|
keyPart = parts.pop();
|
||||||
|
parts.forEach(function(keyPart) {
|
||||||
|
var binding = this.parseKeys(keyPart);
|
||||||
|
var id = KEY_MODS[binding.hashId] + binding.key;
|
||||||
|
chain += (chain ? " " : "") + id;
|
||||||
|
this._addCommandToBinding(chain, "chainKeys");
|
||||||
|
}, this);
|
||||||
|
chain += " ";
|
||||||
|
}
|
||||||
|
var binding = this.parseKeys(keyPart);
|
||||||
|
var id = KEY_MODS[binding.hashId] + binding.key;
|
||||||
|
this._addCommandToBinding(chain + id, command, asDefault);
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this._addCommandToBinding = function(keyId, command, asDefault) {
|
||||||
|
var ckb = this.commandKeyBinding, i;
|
||||||
|
if (!command) {
|
||||||
|
delete ckb[keyId];
|
||||||
|
} else if (!ckb[keyId] || this.$singleCommand) {
|
||||||
|
ckb[keyId] = command;
|
||||||
|
} else {
|
||||||
|
if (!Array.isArray(ckb[keyId])) {
|
||||||
|
ckb[keyId] = [ckb[keyId]];
|
||||||
|
} else if ((i = ckb[keyId].indexOf(command)) != -1) {
|
||||||
|
ckb[keyId].splice(i, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asDefault || command.isDefault)
|
||||||
|
ckb[keyId].unshift(command);
|
||||||
|
else
|
||||||
|
ckb[keyId].push(command);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.addCommands = function(commands) {
|
this.addCommands = function(commands) {
|
||||||
commands && Object.keys(commands).forEach(function(name) {
|
commands && Object.keys(commands).forEach(function(name) {
|
||||||
var command = commands[name];
|
var command = commands[name];
|
||||||
|
|
@ -142,21 +169,12 @@ function HashHandler(config, platform) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this._buildKeyHash = function(command) {
|
this._buildKeyHash = function(command) {
|
||||||
var binding = command.bindKey;
|
this.bindKey(command.bindKey, command);
|
||||||
if (!binding)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var key = typeof binding == "string" ? binding: binding[this.platform];
|
|
||||||
this.bindKey(key, command);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// accepts keys in the form ctrl+Enter or ctrl-Enter
|
// accepts keys in the form ctrl+Enter or ctrl-Enter
|
||||||
// keys without modifiers or shift only
|
// keys without modifiers or shift only
|
||||||
this.parseKeys = function(keys) {
|
this.parseKeys = function(keys) {
|
||||||
// todo support keychains
|
|
||||||
if (keys.indexOf(" ") != -1)
|
|
||||||
keys = keys.split(/\s+/).pop();
|
|
||||||
|
|
||||||
var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x});
|
var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x});
|
||||||
var key = parts.pop();
|
var key = parts.pop();
|
||||||
|
|
||||||
|
|
@ -173,7 +191,7 @@ function HashHandler(config, platform) {
|
||||||
var modifier = keyUtil.KEY_MODS[parts[i]];
|
var modifier = keyUtil.KEY_MODS[parts[i]];
|
||||||
if (modifier == null) {
|
if (modifier == null) {
|
||||||
if (typeof console != "undefined")
|
if (typeof console != "undefined")
|
||||||
console.error("invalid modifier " + parts[i] + " in " + keys);
|
console.error("invalid modifier " + parts[i] + " in " + keys);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
hashId |= modifier;
|
hashId |= modifier;
|
||||||
|
|
@ -182,17 +200,32 @@ function HashHandler(config, platform) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.findKeyCommand = function findKeyCommand(hashId, keyString) {
|
this.findKeyCommand = function findKeyCommand(hashId, keyString) {
|
||||||
var ckbr = this.commandKeyBinding;
|
var key = KEY_MODS[hashId] + keyString;
|
||||||
return ckbr[hashId] && ckbr[hashId][keyString];
|
return this.commandKeyBinding[key];
|
||||||
};
|
};
|
||||||
|
|
||||||
this.handleKeyboard = function(data, hashId, keyString, keyCode) {
|
this.handleKeyboard = function(data, hashId, keyString, keyCode) {
|
||||||
return {
|
var key = KEY_MODS[hashId] + keyString;
|
||||||
command: this.findKeyCommand(hashId, keyString)
|
var command = this.commandKeyBinding[key];
|
||||||
};
|
if (data.$keyChain) {
|
||||||
|
data.$keyChain += " " + key;
|
||||||
|
command = this.commandKeyBinding[data.$keyChain] || command;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command) {
|
||||||
|
if (command == "chainKeys" || command[command.length - 1] == "chainKeys") {
|
||||||
|
data.$keyChain = data.$keyChain || key;
|
||||||
|
return {command: "null"};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.$keyChain && keyCode > 0)
|
||||||
|
data.$keyChain = "";
|
||||||
|
return {command: command};
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(HashHandler.prototype)
|
}).call(HashHandler.prototype);
|
||||||
|
|
||||||
exports.HashHandler = HashHandler;
|
exports.HashHandler = HashHandler;
|
||||||
|
exports.MultiHashHandler = MultiHashHandler;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -66,13 +66,13 @@ var TextInput = function(parentNode, host) {
|
||||||
// ie9 throws error if document.activeElement is accessed too soon
|
// ie9 throws error if document.activeElement is accessed too soon
|
||||||
try { var isFocused = document.activeElement === text; } catch(e) {}
|
try { var isFocused = document.activeElement === text; } catch(e) {}
|
||||||
|
|
||||||
event.addListener(text, "blur", function() {
|
event.addListener(text, "blur", function(e) {
|
||||||
host.onBlur();
|
host.onBlur(e);
|
||||||
isFocused = false;
|
isFocused = false;
|
||||||
});
|
});
|
||||||
event.addListener(text, "focus", function() {
|
event.addListener(text, "focus", function(e) {
|
||||||
isFocused = true;
|
isFocused = true;
|
||||||
host.onFocus();
|
host.onFocus(e);
|
||||||
resetSelection();
|
resetSelection();
|
||||||
});
|
});
|
||||||
this.focus = function() { text.focus(); };
|
this.focus = function() { text.focus(); };
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,9 @@ var Keys = (function() {
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
ret.KEY_MODS[0] = "";
|
||||||
|
ret.KEY_MODS[-1] = "input";
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
})();
|
})();
|
||||||
oop.mixin(exports, Keys);
|
oop.mixin(exports, Keys);
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,10 @@ function LineWidgets(session) {
|
||||||
this.renderWidgets = this.renderWidgets.bind(this);
|
this.renderWidgets = this.renderWidgets.bind(this);
|
||||||
this.measureWidgets = this.measureWidgets.bind(this);
|
this.measureWidgets = this.measureWidgets.bind(this);
|
||||||
this.session._changedWidgets = [];
|
this.session._changedWidgets = [];
|
||||||
this.detach = this.detach.bind(this);
|
this.$onChangeEditor = this.$onChangeEditor.bind(this);
|
||||||
|
|
||||||
this.session.on("change", this.updateOnChange);
|
this.session.on("change", this.updateOnChange);
|
||||||
|
this.session.on("changeEditor", this.$onChangeEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
@ -73,8 +74,12 @@ function LineWidgets(session) {
|
||||||
return screenRows;
|
return screenRows;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.$onChangeEditor = function(e) {
|
||||||
|
this.attach(e.editor);
|
||||||
|
};
|
||||||
|
|
||||||
this.attach = function(editor) {
|
this.attach = function(editor) {
|
||||||
if (editor.widgetManager && editor.widgetManager != this)
|
if (editor && editor.widgetManager && editor.widgetManager != this)
|
||||||
editor.widgetManager.detach();
|
editor.widgetManager.detach();
|
||||||
|
|
||||||
if (this.editor == editor)
|
if (this.editor == editor)
|
||||||
|
|
@ -83,22 +88,17 @@ function LineWidgets(session) {
|
||||||
this.detach();
|
this.detach();
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
|
|
||||||
this.editor.on("changeSession", this.detach);
|
if (editor) {
|
||||||
|
editor.widgetManager = this;
|
||||||
editor.widgetManager = this;
|
editor.renderer.on("beforeRender", this.measureWidgets);
|
||||||
|
editor.renderer.on("afterRender", this.renderWidgets);
|
||||||
editor.renderer.on("beforeRender", this.measureWidgets);
|
}
|
||||||
editor.renderer.on("afterRender", this.renderWidgets);
|
|
||||||
};
|
};
|
||||||
this.detach = function(e) {
|
this.detach = function(e) {
|
||||||
if (e && e.session == this.session)
|
|
||||||
return; // sometimes attach can be called before setSession
|
|
||||||
var editor = this.editor;
|
var editor = this.editor;
|
||||||
if (!editor)
|
if (!editor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
editor.off("changeSession", this.detach);
|
|
||||||
|
|
||||||
this.editor = null;
|
this.editor = null;
|
||||||
editor.widgetManager = null;
|
editor.widgetManager = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,66 @@
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
var path = require("path");
|
||||||
if (!fs.existsSync)
|
if (!fs.existsSync)
|
||||||
fs.existsSync = require("path").existsSync;
|
fs.existsSync = path.existsSync;
|
||||||
|
|
||||||
require("amd-loader");
|
require("amd-loader");
|
||||||
|
|
||||||
var cwd = __dirname + "/";
|
var cwd = __dirname + "/";
|
||||||
|
var root = path.normalize(cwd + Array(5).join("../"));
|
||||||
|
|
||||||
|
function jsFileList(path, filter) {
|
||||||
|
if (!filter) filter = /_test/;
|
||||||
|
return fs.readdirSync(path).map(function(x) {
|
||||||
|
if (x.slice(-3) == ".js" && !filter.test(x) && !/\s/.test(x))
|
||||||
|
return x.slice(0, -3);
|
||||||
|
}).filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
function modeList() {
|
||||||
|
return jsFileList(cwd + "../", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour|completions/);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkModes() {
|
||||||
|
modeList().forEach(function(modeName) {
|
||||||
|
try {
|
||||||
|
var Mode = require("../" + modeName).Mode;
|
||||||
|
} catch(e) {
|
||||||
|
console.warn("Can't load mode :" + modeName, e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var m = new Mode();
|
||||||
|
if (!m.lineCommentStart && !m.blockComment)
|
||||||
|
console.warn("missing comment in " + modeName);
|
||||||
|
if (!m.$id)
|
||||||
|
console.warn("missing id in " + modeName);
|
||||||
|
var tokenizer = (new Mode).getTokenizer();
|
||||||
|
if (m.lineCommentStart) {
|
||||||
|
if (Array.isArray(m.lineCommentStart)) {
|
||||||
|
m.lineCommentStart.forEach(function(x) {
|
||||||
|
testLineComment(tokenizer, x, modeName)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
testLineComment(tokenizer, m.lineCommentStart, modeName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if (m.blockComment) {
|
||||||
|
// var tokens = tok.getLineTokens(m.lineCommentStart, "start");
|
||||||
|
// if (!/comment/.test(tokens[0]))
|
||||||
|
// console.warn("broken lineCommentStart in " + modeName);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
|
||||||
|
function testLineComment(tokenizer, commentStart, modeName) {
|
||||||
|
var tokens = tokenizer.getLineTokens(commentStart + " ", "start").tokens;
|
||||||
|
if (!/comment/.test(tokens[0].type))
|
||||||
|
console.warn("broken lineCommentStart in " + modeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function generateTestData() {
|
function generateTestData() {
|
||||||
var root = Array(5).join("../") + "/demo/kitchen-sink/docs";
|
var docs = jsFileList(cwd + root);
|
||||||
var docs = fs.readdirSync(cwd + root);
|
|
||||||
var specialDocs = fs.readdirSync(cwd);
|
var specialDocs = fs.readdirSync(cwd);
|
||||||
var modes = fs.readdirSync(cwd + "../").filter(function(x){
|
var modes = modeList();
|
||||||
return !/(_highlight_rules|behaviour|worker)\.js$/.test(x) && /\.js$/.test(x);
|
|
||||||
}).map(function(x) {
|
|
||||||
return x.replace(/\.js$/, "");
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log("Docs:", docs);
|
console.log("Docs:", docs);
|
||||||
console.log("Modes:", modes);
|
console.log("Modes:", modes);
|
||||||
|
|
@ -61,7 +107,7 @@ function generateTestData() {
|
||||||
return tmp.join(",\n ");
|
return tmp.join(",\n ");
|
||||||
});
|
});
|
||||||
|
|
||||||
jsonStr = "[[\n " + data.join("\n],[\n ") + "\n]]";
|
var jsonStr = "[[\n " + data.join("\n],[\n ") + "\n]]";
|
||||||
fs.writeFileSync(cwd + "tokens_" + modeName + ".json", jsonStr, "utf8");
|
fs.writeFileSync(cwd + "tokens_" + modeName + ".json", jsonStr, "utf8");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +137,7 @@ function testMode(modeName, i) {
|
||||||
lineData.state = lineData.shift();
|
lineData.state = lineData.shift();
|
||||||
var line = null;
|
var line = null;
|
||||||
if (typeof lineData[lineData.length - 1] == "string")
|
if (typeof lineData[lineData.length - 1] == "string")
|
||||||
line = lineData.pop()
|
line = lineData.pop();
|
||||||
lineData.forEach(function(x) {
|
lineData.forEach(function(x) {
|
||||||
lineData.types.push(x[0]);
|
lineData.types.push(x[0]);
|
||||||
lineData.values.push(x[1]);
|
lineData.values.push(x[1]);
|
||||||
|
|
@ -103,14 +149,13 @@ function testMode(modeName, i) {
|
||||||
var values = tokens.tokens.map(function(x) {return x.value;});
|
var values = tokens.tokens.map(function(x) {return x.value;});
|
||||||
var types = tokens.tokens.map(function(x) {return x.type;});
|
var types = tokens.tokens.map(function(x) {return x.type;});
|
||||||
|
|
||||||
var success = true;
|
|
||||||
var err = testEqual([
|
var err = testEqual([
|
||||||
JSON.stringify(lineData.state), JSON.stringify(tokens.state),
|
JSON.stringify(lineData.state), JSON.stringify(tokens.state),
|
||||||
lineData.types, types,
|
lineData.types, types,
|
||||||
lineData.values, values]);
|
lineData.values, values]);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(line)
|
console.log(line);
|
||||||
throw "error";
|
throw "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,10 +195,12 @@ function padNumber(num, digits) {
|
||||||
// cli
|
// cli
|
||||||
var arg = process.argv[2];
|
var arg = process.argv[2];
|
||||||
if (!arg)
|
if (!arg)
|
||||||
test()
|
test();
|
||||||
else if (/--?g(en)?/.test(arg))
|
else if (/--?g(en)?/.test(arg))
|
||||||
generateTestData(process.argv.splice(3));
|
generateTestData(process.argv.splice(3));
|
||||||
|
else if (/--?c(heck)?/.test(arg))
|
||||||
|
checkModes(process.argv.splice(3));
|
||||||
else if (/\d+/.test(arg))
|
else if (/\d+/.test(arg))
|
||||||
test(parseInt(process.argv[2],10) || 0);
|
test(parseInt(process.argv[2],10) || 0);
|
||||||
else
|
else
|
||||||
testMode(arg, -1)
|
testMode(arg, -1);
|
||||||
|
|
@ -11,13 +11,13 @@
|
||||||
["comment","# Repo formats:"]
|
["comment","# Repo formats:"]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["comment","# ssh git@github.com:richoH/gh_pr.git"]
|
["comment","# ssh git@github.com:richo/gh_pr.git"]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["comment","# http https://richoH@github.com/richoH/gh_pr.git"]
|
["comment","# http https://richoH@github.com/richo/gh_pr.git"]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["comment","# git git://github.com/richoH/gh_pr.git"]
|
["comment","# git git://github.com/richo/gh_pr.git"]
|
||||||
],[
|
],[
|
||||||
"start"
|
"start"
|
||||||
],[
|
],[
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,6 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,6 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -53,7 +48,7 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.lineCommentStart = "/\\*";
|
this.lineCommentStart = ";";
|
||||||
this.blockComment = {start: "/*", end: "*/"};
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
this.$id = "ace/mode/autohotkey";
|
this.$id = "ace/mode/autohotkey";
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,8 @@ var c_cppHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : "//",
|
||||||
|
next : "singleLineComment"
|
||||||
},
|
},
|
||||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
|
|
@ -121,14 +122,26 @@ var c_cppHighlightRules = function() {
|
||||||
regex : ".+"
|
regex : ".+"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"singleLineComment" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : /\\$/,
|
||||||
|
next : "singleLineComment"
|
||||||
|
}, {
|
||||||
|
token : "comment",
|
||||||
|
regex : /$/,
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken: "comment"
|
||||||
|
}
|
||||||
|
],
|
||||||
"qqstring" : [
|
"qqstring" : [
|
||||||
{
|
{
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
defaultToken : "string"
|
||||||
regex : '.+'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"qstring" : [
|
"qstring" : [
|
||||||
|
|
@ -137,8 +150,7 @@ var c_cppHighlightRules = function() {
|
||||||
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
defaultToken : "string"
|
||||||
regex : '.+'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"directive" : [
|
"directive" : [
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
if (val == "}" && stack.length) {
|
if (val == "}" && stack.length) {
|
||||||
stack.shift();
|
stack.shift();
|
||||||
this.next = stack.shift();
|
this.next = stack.shift() || "";
|
||||||
if (this.next.indexOf("string") != -1)
|
if (this.next.indexOf("string") != -1)
|
||||||
return "paren.string";
|
return "paren.string";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.lineCommentStart = "/\\+";
|
this.lineCommentStart = "//";
|
||||||
this.blockComment = {start: "/*", end: "*/"};
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
this.$id = "ace/mode/d";
|
this.$id = "ace/mode/d";
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
|
||||||
|
|
@ -35,22 +35,28 @@ var oop = require("../lib/oop");
|
||||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
var DocCommentHighlightRules = function() {
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
"start" : [ {
|
"start" : [ {
|
||||||
token : "comment.doc.tag",
|
token : "comment.doc.tag",
|
||||||
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||||
}, {
|
},
|
||||||
token : "comment.doc.tag",
|
DocCommentHighlightRules.getTagRule(),
|
||||||
regex : "\\bTODO\\b"
|
{
|
||||||
}, {
|
defaultToken : "comment.doc",
|
||||||
defaultToken : "comment.doc"
|
caseInsensitive: true
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
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) {
|
DocCommentHighlightRules.getStartRule = function(start) {
|
||||||
return {
|
return {
|
||||||
token : "comment.doc", // doc comment
|
token : "comment.doc", // doc comment
|
||||||
|
|
|
||||||
58
lib/ace/mode/elm.js
Normal file
58
lib/ace/mode/elm.js
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
/*
|
||||||
|
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var HighlightRules = require("./elm_highlight_rules").ElmHighlightRules;
|
||||||
|
// TODO: pick appropriate fold mode
|
||||||
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = HighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = "--";
|
||||||
|
this.blockComment = {start: "{-", end: "-}"};
|
||||||
|
// Extra logic goes here.
|
||||||
|
this.$id = "ace/mode/elm";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
162
lib/ace/mode/elm_highlight_rules.js
Normal file
162
lib/ace/mode/elm_highlight_rules.js
Normal file
|
|
@ -0,0 +1,162 @@
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Ajax.org B.V.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
// TODO check with https://github.com/deadfoxygrandpa/Elm.tmLanguage
|
||||||
|
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var ElmHighlightRules = function() {
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword": "as|case|class|data|default|deriving|do|else|export|foreign|" +
|
||||||
|
"hiding|jsevent|if|import|in|infix|infixl|infixr|instance|let|" +
|
||||||
|
"module|newtype|of|open|then|type|where|_|port|\u03BB"
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
var escapeRe = /\\(\d+|['"\\&trnbvf])/;
|
||||||
|
|
||||||
|
var smallRe = /[a-z_]/.source;
|
||||||
|
var largeRe = /[A-Z]/.source;
|
||||||
|
var idRe = /[a-z_A-Z0-9\']/.source;
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
start: [{
|
||||||
|
token: "string.start",
|
||||||
|
regex: '"',
|
||||||
|
next: "string"
|
||||||
|
}, {
|
||||||
|
token: "string.character",
|
||||||
|
regex: "'(?:" + escapeRe.source + "|.)'?"
|
||||||
|
}, {
|
||||||
|
regex: /0(?:[xX][0-9A-Fa-f]+|[oO][0-7]+)|\d+(\.\d+)?([eE][-+]?\d*)?/,
|
||||||
|
token: "constant.numeric"
|
||||||
|
}, {
|
||||||
|
token : "keyword",
|
||||||
|
regex : /\.\.|\||:|=|\\|\"|->|<-|\u2192/
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]+/
|
||||||
|
}, {
|
||||||
|
token : "operator.punctuation",
|
||||||
|
regex : /[,;`]/
|
||||||
|
}, {
|
||||||
|
regex : largeRe + idRe + "+\\.?",
|
||||||
|
token : function(value) {
|
||||||
|
if (value[value.length - 1] == ".")
|
||||||
|
return "entity.name.function";
|
||||||
|
return "constant.language";
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
regex : "^" + smallRe + idRe + "+",
|
||||||
|
token : function(value) {
|
||||||
|
return "constant.language";
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
regex : "[\\w\\xff-\\u218e\\u2455-\\uffff]+\\b"
|
||||||
|
}, {
|
||||||
|
regex: "{-#?",
|
||||||
|
token: "comment.start",
|
||||||
|
onMatch: function(value, currentState, stack) {
|
||||||
|
this.next = value.length == 2 ? "blockComment" : "docComment";
|
||||||
|
return this.token;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: /\[markdown\|/,
|
||||||
|
next: "markdown"
|
||||||
|
}, {
|
||||||
|
token: "paren.lparen",
|
||||||
|
regex: /[\[({]/
|
||||||
|
}, {
|
||||||
|
token: "paren.rparen",
|
||||||
|
regex: /[\])}]/
|
||||||
|
}, ],
|
||||||
|
markdown: [{
|
||||||
|
regex: /\|\]/,
|
||||||
|
next: "start"
|
||||||
|
}, {
|
||||||
|
defaultToken : "string"
|
||||||
|
}],
|
||||||
|
blockComment: [{
|
||||||
|
regex: "{-",
|
||||||
|
token: "comment.start",
|
||||||
|
push: "blockComment"
|
||||||
|
}, {
|
||||||
|
regex: "-}",
|
||||||
|
token: "comment.end",
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
defaultToken: "comment"
|
||||||
|
}],
|
||||||
|
docComment: [{
|
||||||
|
regex: "{-",
|
||||||
|
token: "comment.start",
|
||||||
|
push: "docComment"
|
||||||
|
}, {
|
||||||
|
regex: "-}",
|
||||||
|
token: "comment.end",
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
defaultToken: "doc.comment"
|
||||||
|
}],
|
||||||
|
string: [{
|
||||||
|
token: "constant.language.escape",
|
||||||
|
regex: escapeRe,
|
||||||
|
}, {
|
||||||
|
token: "text",
|
||||||
|
regex: /\\(\s|$)/,
|
||||||
|
next: "stringGap"
|
||||||
|
}, {
|
||||||
|
token: "string.end",
|
||||||
|
regex: '"',
|
||||||
|
next: "start"
|
||||||
|
}],
|
||||||
|
stringGap: [{
|
||||||
|
token: "text",
|
||||||
|
regex: /\\/,
|
||||||
|
next: "string"
|
||||||
|
}, {
|
||||||
|
token: "error",
|
||||||
|
regex: "",
|
||||||
|
next: "start"
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(ElmHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.ElmHighlightRules = ElmHighlightRules;
|
||||||
|
});
|
||||||
|
|
@ -27,10 +27,6 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -53,7 +49,7 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.lineCommentStart = "(?<=^|\\s)\\.?\\( [^)]*\\)";
|
this.lineCommentStart = "--";
|
||||||
this.blockComment = {start: "/*", end: "*/"};
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
this.$id = "ace/mode/forth";
|
this.$id = "ace/mode/forth";
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
this.lineCommentStart = "#";
|
||||||
this.$id = "ace/mode/gitignore";
|
this.$id = "ace/mode/gitignore";
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -302,20 +302,24 @@ var JavaScriptHighlightRules = function(options) {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"comment_regex_allowed" : [
|
"comment_regex_allowed" : [
|
||||||
|
DocCommentHighlightRules.getTagRule(),
|
||||||
{token : "comment", regex : "\\*\\/", next : "start"},
|
{token : "comment", regex : "\\*\\/", next : "start"},
|
||||||
{defaultToken : "comment"}
|
{defaultToken : "comment", caseInsensitive: true}
|
||||||
],
|
],
|
||||||
"comment" : [
|
"comment" : [
|
||||||
|
DocCommentHighlightRules.getTagRule(),
|
||||||
{token : "comment", regex : "\\*\\/", next : "no_regex"},
|
{token : "comment", regex : "\\*\\/", next : "no_regex"},
|
||||||
{defaultToken : "comment"}
|
{defaultToken : "comment", caseInsensitive: true}
|
||||||
],
|
],
|
||||||
"line_comment_regex_allowed" : [
|
"line_comment_regex_allowed" : [
|
||||||
|
DocCommentHighlightRules.getTagRule(),
|
||||||
{token : "comment", regex : "$|^", next : "start"},
|
{token : "comment", regex : "$|^", next : "start"},
|
||||||
{defaultToken : "comment"}
|
{defaultToken : "comment", caseInsensitive: true}
|
||||||
],
|
],
|
||||||
"line_comment" : [
|
"line_comment" : [
|
||||||
|
DocCommentHighlightRules.getTagRule(),
|
||||||
{token : "comment", regex : "$|^", next : "no_regex"},
|
{token : "comment", regex : "$|^", next : "no_regex"},
|
||||||
{defaultToken : "comment"}
|
{defaultToken : "comment", caseInsensitive: true}
|
||||||
],
|
],
|
||||||
"qqstring" : [
|
"qqstring" : [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,6 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,6 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,6 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
/* This file was autogenerated from https://raw.github.com/dbp/sublime-rust/master/Rust.tmLanguage (uuid: ) */
|
/* This file was autogenerated from https://raw.github.com/dbp/sublime-rust/master/Rust.tmLanguage (uuid: ) */
|
||||||
/****************************************************************************************
|
|
||||||
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
|
|
||||||
* fileTypes *
|
|
||||||
****************************************************************************************/
|
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
@ -55,6 +51,35 @@ var RustHighlightRules = function() {
|
||||||
next: 'pop' },
|
next: 'pop' },
|
||||||
{ include: '#rust_escaped_character' },
|
{ include: '#rust_escaped_character' },
|
||||||
{ defaultToken: 'string.quoted.single.source.rust' } ] },
|
{ defaultToken: 'string.quoted.single.source.rust' } ] },
|
||||||
|
{
|
||||||
|
stateName: "bracketedComment",
|
||||||
|
onMatch : function(value, currentState, stack){
|
||||||
|
stack.unshift(this.next, value.length - 1, currentState);
|
||||||
|
return "string.quoted.raw.source.rust";
|
||||||
|
},
|
||||||
|
regex : /r#*"/,
|
||||||
|
next : [
|
||||||
|
{
|
||||||
|
onMatch : function(value, currentState, stack) {
|
||||||
|
var token = "string.quoted.raw.source.rust";
|
||||||
|
if (value.length >= stack[1]) {
|
||||||
|
if (value.length > stack[1])
|
||||||
|
token = "invalid";
|
||||||
|
stack.shift();
|
||||||
|
stack.shift();
|
||||||
|
this.next = stack.shift();
|
||||||
|
} else {
|
||||||
|
this.next = "";
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
},
|
||||||
|
regex : /"#*/,
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
defaultToken : "string.quoted.raw.source.rust"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{ token: 'string.quoted.double.source.rust',
|
{ token: 'string.quoted.double.source.rust',
|
||||||
regex: '"',
|
regex: '"',
|
||||||
push:
|
push:
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
this.lineCommentStart = "//";
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
this.$id = "ace/mode/stylus";
|
this.$id = "ace/mode/stylus";
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
this.type = "text";
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
if (state == "intag")
|
if (state == "intag")
|
||||||
return tab;
|
return tab;
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ var Search = function() {
|
||||||
if (options.wholeWord)
|
if (options.wholeWord)
|
||||||
needle = "\\b" + needle + "\\b";
|
needle = "\\b" + needle + "\\b";
|
||||||
|
|
||||||
var modifier = options.caseSensitive ? "g" : "gi";
|
var modifier = options.caseSensitive ? "gm" : "gmi";
|
||||||
|
|
||||||
options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle);
|
options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle);
|
||||||
if (options.$isMultiLine)
|
if (options.$isMultiLine)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.ace-cobalt .ace_gutter {
|
.ace-cobalt .ace_gutter {
|
||||||
background: #011e3a;
|
background: #011e3a;
|
||||||
color: #fff
|
color: rgb(128,145,160)
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-cobalt .ace_print-margin {
|
.ace-cobalt .ace_print-margin {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.ace-idle-fingers .ace_gutter {
|
.ace-idle-fingers .ace_gutter {
|
||||||
background: #3b3b3b;
|
background: #3b3b3b;
|
||||||
color: #fff
|
color: rgb(153,153,153)
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-idle-fingers .ace_print-margin {
|
.ace-idle-fingers .ace_print-margin {
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,13 @@
|
||||||
margin: -1px 0 0 -1px;
|
margin: -1px 0 0 -1px;
|
||||||
border: 1px solid #888888
|
border: 1px solid #888888
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-bright .ace_marker-layer .ace_highlight {
|
.ace-tomorrow-night-bright .ace_marker-layer .ace_highlight {
|
||||||
border: 1px solid rgb(110, 119, 0);
|
border: 1px solid rgb(110, 119, 0);
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
box-shadow: inset 0 -1px rgb(110, 119, 0);
|
box-shadow: inset 0 -1px rgb(110, 119, 0);
|
||||||
margin: -1px 0 0 -1px;
|
margin: -1px 0 0 -1px;
|
||||||
background: rgba(255, 235, 0, 0.1);
|
background: rgba(255, 235, 0, 0.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-bright .ace_marker-layer .ace_active-line {
|
.ace-tomorrow-night-bright .ace_marker-layer .ace_active-line {
|
||||||
|
|
@ -132,7 +133,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-bright .ace_c9searchresults.ace_keyword {
|
.ace-tomorrow-night-bright .ace_c9searchresults.ace_keyword {
|
||||||
color: #C2C280;
|
color: #C2C280
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-bright .ace_indent-guide {
|
.ace-tomorrow-night-bright .ace_indent-guide {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,13 @@ window.window = window;
|
||||||
window.ace = window;
|
window.ace = window;
|
||||||
|
|
||||||
window.onerror = function(message, file, line, col, err) {
|
window.onerror = function(message, file, line, col, err) {
|
||||||
console.error("Worker " + (err ? err.stack : message));
|
postMessage({type: "error", data: {
|
||||||
|
message: message,
|
||||||
|
file: file,
|
||||||
|
line: line,
|
||||||
|
col: col,
|
||||||
|
stack: err.stack
|
||||||
|
}});
|
||||||
};
|
};
|
||||||
|
|
||||||
window.normalizeModule = function(parentId, moduleName) {
|
window.normalizeModule = function(parentId, moduleName) {
|
||||||
|
|
@ -85,14 +91,19 @@ window.define = function(id, deps, factory) {
|
||||||
id = window.require.id;
|
id = window.require.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof factory != "function") {
|
||||||
|
window.require.modules[id] = {
|
||||||
|
exports: factory,
|
||||||
|
initialized: true
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!deps.length)
|
if (!deps.length)
|
||||||
// If there is no dependencies, we inject 'require', 'exports' and
|
// If there is no dependencies, we inject 'require', 'exports' and
|
||||||
// 'module' as dependencies, to provide CommonJS compatibility.
|
// 'module' as dependencies, to provide CommonJS compatibility.
|
||||||
deps = ['require', 'exports', 'module'];
|
deps = ['require', 'exports', 'module'];
|
||||||
|
|
||||||
if (id.indexOf("text!") === 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var req = function(childId) {
|
var req = function(childId) {
|
||||||
return window.require(id, childId);
|
return window.require(id, childId);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -92,14 +92,9 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
||||||
this.onMessage = function(e) {
|
this.onMessage = function(e) {
|
||||||
var msg = e.data;
|
var msg = e.data;
|
||||||
switch(msg.type) {
|
switch(msg.type) {
|
||||||
case "log":
|
|
||||||
window.console && console.log && console.log.apply(console, msg.data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "event":
|
case "event":
|
||||||
this._signal(msg.name, {data: msg.data});
|
this._signal(msg.name, {data: msg.data});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "call":
|
case "call":
|
||||||
var callback = this.callbacks[msg.id];
|
var callback = this.callbacks[msg.id];
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
|
@ -107,9 +102,19 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
||||||
delete this.callbacks[msg.id];
|
delete this.callbacks[msg.id];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "error":
|
||||||
|
this.reportError(msg.data);
|
||||||
|
break;
|
||||||
|
case "log":
|
||||||
|
window.console && console.log && console.log.apply(console, msg.data);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.reportError = function(err) {
|
||||||
|
window.console && console.error && console.error(err);
|
||||||
|
};
|
||||||
|
|
||||||
this.$normalizePath = function(path) {
|
this.$normalizePath = function(path) {
|
||||||
return net.qualifyURL(path);
|
return net.qualifyURL(path);
|
||||||
};
|
};
|
||||||
|
|
@ -119,7 +124,8 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
||||||
this.deltaQueue = null;
|
this.deltaQueue = null;
|
||||||
this.$worker.terminate();
|
this.$worker.terminate();
|
||||||
this.$worker = null;
|
this.$worker = null;
|
||||||
this.$doc.removeEventListener("change", this.changeListener);
|
if (this.$doc)
|
||||||
|
this.$doc.off("change", this.changeListener);
|
||||||
this.$doc = null;
|
this.$doc = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
26
tool/Readme.md
Normal file
26
tool/Readme.md
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
Helper Scripts for Ace
|
||||||
|
======================
|
||||||
|
|
||||||
|
To use this you need to install node.js. and run `npm install` in this directory.
|
||||||
|
|
||||||
|
|
||||||
|
# add_mode.js
|
||||||
|
|
||||||
|
Run
|
||||||
|
```
|
||||||
|
node add_mode.js ModeName "extension1|extension2|^FullName"
|
||||||
|
```
|
||||||
|
to create all the files needed for a new mode named `ModeName`
|
||||||
|
this adds stubs for:
|
||||||
|
`ace/mode/mode_name.js`
|
||||||
|
`ace/mode/mode_name_hightlight_rules.js`
|
||||||
|
`ace/snippets/mode_name.js`
|
||||||
|
`ace/demo/kitchen_sink/docs/mode_name.extension1`
|
||||||
|
and adds entry for the new mode to `ace/ext/modelist.js`
|
||||||
|
|
||||||
|
|
||||||
|
# tmlanguage.js
|
||||||
|
|
||||||
|
```
|
||||||
|
node tmlanguage.js ./templates/dummy.JSON-tmLanguage
|
||||||
|
```
|
||||||
189
tool/add_mode.js
189
tool/add_mode.js
|
|
@ -2,100 +2,105 @@ var fs = require('fs');
|
||||||
var lib = require('./lib');
|
var lib = require('./lib');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
var args = process.argv.slice(2);
|
function main(displayName, extRe) {
|
||||||
|
var name = lib.snakeCase(displayName).replace(/[^\w]/g, "");
|
||||||
|
|
||||||
|
/** demo **/
|
||||||
|
var demoFileExt = extRe.split("|")[0] || name;
|
||||||
|
var demoFileName = demoFileExt[0] == "^" ? demoFileExt.substr(1) : name + "." + demoFileExt;
|
||||||
|
var demoFilePath = lib.AceRoot + "demo/kitchen-sink/docs/" + demoFileName;
|
||||||
|
fs.writeFileSync(demoFilePath, "TODO add a nice demo!", "utf8");
|
||||||
|
console.log("Created demo file at: " + path.normalize(demoFilePath));
|
||||||
|
|
||||||
var displayName = args[0];
|
/** mode **/
|
||||||
var extRe = args[1];
|
var template = fs.readFileSync(__dirname + "/templates/mode.js", "utf8");
|
||||||
if (!displayName || ! extRe) {
|
var modePath = lib.AceLib + "ace/mode/" + name + ".js";
|
||||||
console.log("Usage: ModeName ext1|ext2");
|
var text = lib.fillTemplate(template, {
|
||||||
process.exit(1);
|
languageHighlightFilename: name,
|
||||||
|
languagename: name,
|
||||||
|
lineCommentStart: "TODO",
|
||||||
|
blockCommentStart: "TODO",
|
||||||
|
blockCommentEnd: "TODO"
|
||||||
|
});
|
||||||
|
fs.writeFileSync(modePath, text);
|
||||||
|
console.log("Created mode file at: " + path.normalize(modePath));
|
||||||
|
|
||||||
|
/** highlight rules **/
|
||||||
|
template = fs.readFileSync(__dirname + "/templates/highlight_rules.js", "utf8");
|
||||||
|
var hlPath = lib.AceLib + "ace/mode/" + name + "_highlight_rules.js";
|
||||||
|
template = template.replace(/\/\* THIS[\s\S]*?\*{3}\/\s*/, "");
|
||||||
|
text = lib.fillTemplate(template, {
|
||||||
|
language: name,
|
||||||
|
languageTokens: '{\n\
|
||||||
|
start: [{\n\
|
||||||
|
token: "string.start",\n\
|
||||||
|
regex: \'"\',\n\
|
||||||
|
next: "qstring"\n\
|
||||||
|
}],\n\
|
||||||
|
qstring: [{\n\
|
||||||
|
token: "escape",\n\
|
||||||
|
regex: /\\\\./,\n\
|
||||||
|
}, {\n\
|
||||||
|
token: "string.end",\n\
|
||||||
|
regex: \'"\',\n\
|
||||||
|
next: "start"\n\
|
||||||
|
}],\n\
|
||||||
|
}'
|
||||||
|
});
|
||||||
|
fs.writeFileSync(hlPath, text);
|
||||||
|
console.log("Created mode file at: " + path.normalize(hlPath));
|
||||||
|
|
||||||
|
/** snippets **/
|
||||||
|
template = fs.readFileSync(__dirname + "/templates/snippets.js", "utf8");
|
||||||
|
var snipetsPath = lib.AceLib + "ace/snippets/" + name + ".js";
|
||||||
|
text = lib.fillTemplate(template, {
|
||||||
|
languagename: name,
|
||||||
|
snippets: ""
|
||||||
|
});
|
||||||
|
fs.writeFileSync(snipetsPath, text);
|
||||||
|
console.log("Created snippets file at: " + path.normalize(snipetsPath));
|
||||||
|
|
||||||
|
/** modelist **/
|
||||||
|
var modelistPath = lib.AceLib + "ace/ext/modelist.js";
|
||||||
|
var modelist = fs.readFileSync(modelistPath, "utf8").replace(/\r\n?/g, "\n");
|
||||||
|
modelist = modelist.replace(/(supportedModes = {\n)([\s\S]*?)(\n^};)/m, function(_, m1, m2, m3) {
|
||||||
|
var langs = m2.split(/,\n/);
|
||||||
|
var offset = langs[0].trim().indexOf("[");
|
||||||
|
var padding = Array(Math.max(offset - displayName.length - 1, 0) + 1).join(" ");
|
||||||
|
var newLang = " " + displayName + ":" + padding + "[\"" + extRe + "\"]";
|
||||||
|
langs = langs.concat(newLang).map(function(x) {
|
||||||
|
return {
|
||||||
|
value: x,
|
||||||
|
id: x.match(/[^"':\s]+/)[0].toLowerCase()
|
||||||
|
};
|
||||||
|
});
|
||||||
|
langs[langs.length - 1].isNew = true;
|
||||||
|
|
||||||
|
langs = langs.filter(function(x) {
|
||||||
|
console.log(x.id, displayName)
|
||||||
|
return x.id != displayName.toLowerCase() || x.isNew;
|
||||||
|
});
|
||||||
|
langs = langs.sort(function(a, b) {
|
||||||
|
return a.id.localeCompare(b.id);
|
||||||
|
}).map(function(x) {
|
||||||
|
return x.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
return m1 + langs.join(",\n") + m3;
|
||||||
|
});
|
||||||
|
fs.writeFileSync(modelistPath, modelist, "utf8");
|
||||||
|
console.log("Updated modelist at: " + path.normalize(modelistPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = lib.snakeCase(displayName).replace(/[^\w]/g, "");
|
if (!module.parent) {
|
||||||
|
var args = process.argv.slice(2);
|
||||||
/** demo **/
|
var displayName = args[0];
|
||||||
var demoFileExt = extRe.split("|")[0] || name;
|
var extRe = args[1];
|
||||||
var demoFileName = demoFileExt[0] == "^" ? demoFileExt.substr(1) : name + "." + demoFileExt;
|
if (!displayName || ! extRe) {
|
||||||
var demoFilePath = lib.AceRoot + "demo/kitchen-sink/docs/" + demoFileName;
|
console.log("Usage: ModeName ext1|ext2");
|
||||||
fs.writeFileSync(demoFilePath, "TODO add a nice demo!", "utf8");
|
process.exit(1);
|
||||||
console.log("Created demo file at: " + path.normalize(demoFilePath));
|
}
|
||||||
|
} else {
|
||||||
/** mode **/
|
module.exports = main;
|
||||||
var template = fs.readFileSync(__dirname + "/templates/mode.js", "utf8");
|
}
|
||||||
var modePath = lib.AceLib + "ace/mode/" + name + ".js";
|
|
||||||
var text = lib.fillTemplate(template, {
|
|
||||||
languageHighlightFilename: name,
|
|
||||||
languagename: name,
|
|
||||||
lineCommentStart: "TODO",
|
|
||||||
blockCommentStart: "TODO",
|
|
||||||
blockCommentEnd: "TODO"
|
|
||||||
});
|
|
||||||
fs.writeFileSync(modePath, text);
|
|
||||||
console.log("Created mode file at: " + path.normalize(modePath));
|
|
||||||
|
|
||||||
/** highlight rules **/
|
|
||||||
template = fs.readFileSync(__dirname + "/templates/highlight_rules.js", "utf8");
|
|
||||||
var hlPath = lib.AceLib + "ace/mode/" + name + "_highlight_rules.js";
|
|
||||||
template = template.replace(/\/\* THIS[\s\S]*?\*{3}\/\s*/, "");
|
|
||||||
text = lib.fillTemplate(template, {
|
|
||||||
language: name,
|
|
||||||
languageTokens: '{\n\
|
|
||||||
start: [{\n\
|
|
||||||
token: "string.start",\n\
|
|
||||||
regex: \'"\',\n\
|
|
||||||
next: "qstring"\n\
|
|
||||||
}],\n\
|
|
||||||
qstring: [{\n\
|
|
||||||
token: "escape",\n\
|
|
||||||
regex: /\\\\./,\n\
|
|
||||||
}, {\n\
|
|
||||||
token: "string.end",\n\
|
|
||||||
regex: \'"\',\n\
|
|
||||||
next: "start"\n\
|
|
||||||
}],\n\
|
|
||||||
}'
|
|
||||||
});
|
|
||||||
fs.writeFileSync(hlPath, text);
|
|
||||||
console.log("Created mode file at: " + path.normalize(hlPath));
|
|
||||||
|
|
||||||
/** snippets **/
|
|
||||||
template = fs.readFileSync(__dirname + "/templates/snippets.js", "utf8");
|
|
||||||
var snipetsPath = lib.AceLib + "ace/snippets/" + name + ".js";
|
|
||||||
text = lib.fillTemplate(template, {
|
|
||||||
languagename: name,
|
|
||||||
snippets: ""
|
|
||||||
});
|
|
||||||
fs.writeFileSync(snipetsPath, text);
|
|
||||||
console.log("Created snippets file at: " + path.normalize(snipetsPath));
|
|
||||||
|
|
||||||
/** modelist **/
|
|
||||||
var modelistPath = lib.AceLib + "ace/ext/modelist.js";
|
|
||||||
var modelist = fs.readFileSync(modelistPath, "utf8").replace(/\r\n?/g, "\n");
|
|
||||||
modelist = modelist.replace(/(supportedModes = {\n)([\s\S]*?)(\n^};)/m, function(_, m1, m2, m3) {
|
|
||||||
var langs = m2.split(/,\n/);
|
|
||||||
var offset = langs[0].trim().indexOf("[");
|
|
||||||
var padding = Array(Math.max(offset - displayName.length - 1, 0) + 1).join(" ");
|
|
||||||
var newLang = " " + displayName + ":" + padding + "[\"" + extRe + "\"]";
|
|
||||||
langs = langs.concat(newLang).map(function(x) {
|
|
||||||
return {
|
|
||||||
value: x,
|
|
||||||
id: x.match(/[^"':\s]+/)[0].toLowerCase()
|
|
||||||
};
|
|
||||||
});
|
|
||||||
langs[langs.length - 1].isNew = true;
|
|
||||||
|
|
||||||
langs = langs.filter(function(x) {
|
|
||||||
return x.id != name || x.isNew;
|
|
||||||
});
|
|
||||||
langs = langs.sort(function(a, b) {
|
|
||||||
return a.id.localeCompare(b.id);
|
|
||||||
}).map(function(x) {
|
|
||||||
return x.value;
|
|
||||||
});
|
|
||||||
|
|
||||||
return m1 + langs.join(",\n") + m3;
|
|
||||||
});
|
|
||||||
fs.writeFileSync(modelistPath, modelist, "utf8");
|
|
||||||
console.log("Updated modelist at: " + path.normalize(modelistPath));
|
|
||||||
|
|
||||||
|
|
|
||||||
19
tool/lib.js
19
tool/lib.js
|
|
@ -5,13 +5,18 @@ var url = require("url");
|
||||||
var https = require("https");
|
var https = require("https");
|
||||||
var http = require("http");
|
var http = require("http");
|
||||||
|
|
||||||
exports.parsePlist = function(themeXml, callback) {
|
exports.parsePlist = function(xmlOrJSON, callback) {
|
||||||
var result = "";
|
var json;
|
||||||
plist.parseString(themeXml, function(_, theme) {
|
if (xmlOrJSON[0] == "<") {
|
||||||
result = theme[0];
|
plist.parseString(xmlOrJSON, function(_, result) {
|
||||||
callback && callback(theme[0]);
|
json = result[0];
|
||||||
});
|
});
|
||||||
return result;
|
} else {
|
||||||
|
xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
|
||||||
|
json = JSON.parse(xmlOrJSON)
|
||||||
|
}
|
||||||
|
callback && callback(json);
|
||||||
|
return json;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.formatJSON = function(object, initialIndent) {
|
exports.formatJSON = function(object, initialIndent) {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,11 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
/** creates globals intentionally to make things easily accessible from console **/
|
/** creates globals intentionally to make things easily accessible from console **/
|
||||||
|
|
||||||
|
require("ace/ext/language_tools");
|
||||||
|
require("ace/config").setDefaultValues("editor", {
|
||||||
|
enableBasicAutocompletion: true,
|
||||||
|
enableSnippets: true
|
||||||
|
});
|
||||||
var net = require("ace/lib/net");
|
var net = require("ace/lib/net");
|
||||||
var Range = require("ace/range").Range;
|
var Range = require("ace/range").Range;
|
||||||
var util = require("demo/kitchen-sink/util");
|
var util = require("demo/kitchen-sink/util");
|
||||||
|
|
@ -79,28 +84,28 @@ document.getElementById("syncToMode").onclick = function() {
|
||||||
docEl.value = modelist.modesByName[modeEl.value].desc;
|
docEl.value = modelist.modesByName[modeEl.value].desc;
|
||||||
docEl.onchange();
|
docEl.onchange();
|
||||||
run();
|
run();
|
||||||
}
|
};
|
||||||
document.getElementById("perfTest").onclick = function() {
|
document.getElementById("perfTest").onclick = function() {
|
||||||
var lines = editor2.session.doc.getAllLines()
|
var lines = editor2.session.doc.getAllLines();
|
||||||
if (!lines.length)
|
if (!lines.length)
|
||||||
return
|
return;
|
||||||
while (lines.length < 1000) {
|
while (lines.length < 1000) {
|
||||||
lines = lines.concat(lines)
|
lines = lines.concat(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
var tk = new Tokenizer(currentRules);
|
var tk = new Tokenizer(currentRules);
|
||||||
var testPerf = function(lines, tk){
|
var testPerf = function(lines, tk) {
|
||||||
var state = "start"
|
var state = "start";
|
||||||
for (var i=0, l = lines.length; i <l; i++) {
|
for (var i=0, l = lines.length; i <l; i++) {
|
||||||
state = tk.getLineTokens(lines[i], state).state
|
state = tk.getLineTokens(lines[i], state).state;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
var t = performance.now();
|
var t = performance.now();
|
||||||
testPerf(lines, tk);
|
testPerf(lines, tk);
|
||||||
t = t - performance.now(t);
|
t = t - performance.now(t);
|
||||||
log("tokenized " + lines.length + " lines in " + t + " ms");
|
log("tokenized " + lines.length + " lines in " + t + " ms");
|
||||||
}
|
};
|
||||||
|
|
||||||
util.fillDropdown("themeEl", {
|
util.fillDropdown("themeEl", {
|
||||||
bright: [
|
bright: [
|
||||||
|
|
@ -121,7 +126,7 @@ util.bindDropdown("themeEl", function(value) {
|
||||||
|
|
||||||
function getDeps(src, path) {
|
function getDeps(src, path) {
|
||||||
var deps = [];
|
var deps = [];
|
||||||
src.replace(/require\((['"])(.*?)\1/g, function(a,b,c){
|
src.replace(/require\((['"])(.*?)\1/g, function(a,b,c) {
|
||||||
if (c[0] == ".") {
|
if (c[0] == ".") {
|
||||||
var base = path.split("/");
|
var base = path.split("/");
|
||||||
c.split("/").forEach(function(part) {
|
c.split("/").forEach(function(part) {
|
||||||
|
|
@ -145,29 +150,34 @@ function run() {
|
||||||
var src = editor1.getValue();
|
var src = editor1.getValue();
|
||||||
var path = "ace/mode/new";
|
var path = "ace/mode/new";
|
||||||
var deps = getDeps(src, path);
|
var deps = getDeps(src, path);
|
||||||
window.require.undef(path)
|
window.require.undef(path);
|
||||||
src = src.replace("define(", 'define("' + path +'", ["require","exports","module",' + deps +'],');
|
src = src.replace("define(", 'define("' + path +'", ["require","exports","module",' + deps +'],');
|
||||||
try {
|
try {
|
||||||
eval(src);
|
eval(src);
|
||||||
require(["ace/mode/new"], function(e) {
|
require(["ace/mode/new"], function(e) {
|
||||||
try{
|
try {
|
||||||
continueRun(e)
|
continueRun(e);
|
||||||
}catch(e){
|
} catch(e) {
|
||||||
log(e)
|
log(e);
|
||||||
}
|
}
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
log(e);
|
log(e);
|
||||||
window.require.undef(path)
|
window.require.undef(path);
|
||||||
});
|
});
|
||||||
hideLog()
|
hideLog();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
log(e);
|
log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var currentRules
|
var currentRules;
|
||||||
var continueRun = function(rules) {
|
var continueRun = function(rules) {
|
||||||
rules = rules[Object.keys(rules)[0]];
|
for (var i in rules) {
|
||||||
currentRules = new rules().getRules()
|
if (typeof rules[i] == "function" && /rules/i.test(i)) {
|
||||||
|
rules = rules[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentRules = new rules().getRules();
|
||||||
var Tokenizer = DebugTokenizer;
|
var Tokenizer = DebugTokenizer;
|
||||||
|
|
||||||
var tk = new Tokenizer(currentRules);
|
var tk = new Tokenizer(currentRules);
|
||||||
|
|
@ -178,16 +188,16 @@ var continueRun = function(rules) {
|
||||||
|
|
||||||
editor1.commands.bindKey("ctrl-Return", run);
|
editor1.commands.bindKey("ctrl-Return", run);
|
||||||
|
|
||||||
var logEditor
|
var logEditor;
|
||||||
function log(e) {
|
function log(e) {
|
||||||
console.log(e)
|
console.log(e);
|
||||||
if (!logEditor) {
|
if (!logEditor) {
|
||||||
logEditor = util.createEditor(document.getElementById("consoleEditor"));
|
logEditor = util.createEditor(document.getElementById("consoleEditor"));
|
||||||
logEditor.session.setMode("ace/mode/javascript")
|
logEditor.session.setMode("ace/mode/javascript");
|
||||||
logEditor.session.setUseWorker(false)
|
logEditor.session.setUseWorker(false);
|
||||||
}
|
}
|
||||||
logEditor.container.parentNode.style.display = '';
|
logEditor.container.parentNode.style.display = '';
|
||||||
logEditor.resize()
|
logEditor.resize();
|
||||||
logEditor.navigateFileEnd(e);
|
logEditor.navigateFileEnd(e);
|
||||||
logEditor.insert(e + "\n");
|
logEditor.insert(e + "\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
114
tool/regexp_tokenizer.js
Normal file
114
tool/regexp_tokenizer.js
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
/***** regexp tokenizer */
|
||||||
|
require("amd-loader");
|
||||||
|
var lib = require("./lib");
|
||||||
|
|
||||||
|
var Tokenizer = require(lib.AceLib+ "ace/tokenizer").Tokenizer;
|
||||||
|
var Tokenizer = require(lib.AceLib + "ace/tokenizer_dev").Tokenizer; // todo can't use tokenizer because of max token count
|
||||||
|
var TextHighlightRules = require(lib.AceLib + "ace/mode/text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var r = new TextHighlightRules()
|
||||||
|
r.$rules = {
|
||||||
|
start: [
|
||||||
|
{token: "anchor", regex: /[\^\$]|\\[bBAZzG]/, merge:false},
|
||||||
|
{token: "backRef", regex: /\\([1-9]|k(<\w+\b[+-]?\d>|'\w+\b[+-]?\d'))/, merge:false},
|
||||||
|
{include: "charTypes", merge:false},
|
||||||
|
{token: "charclass", regex: /\[\^?/, push: "charclass", merge:false},
|
||||||
|
{token: "alternation", regex: /\|/, merge:false},
|
||||||
|
{include: "quantifiers", merge:false},
|
||||||
|
{include: "groups", merge:false},
|
||||||
|
{include: "xGroup", merge:true}
|
||||||
|
],
|
||||||
|
charTypes: [
|
||||||
|
{token: "char", regex: /\\([tvnrbfae]|[0-8]{1,3}|x[\dA-Fa-f]{2}|x7[\dA-Fa-f]{7})/, merge:false}, // todo \cx
|
||||||
|
{token: "charType", regex: /\.|\\[wWsSdDhH]/, merge:false},
|
||||||
|
{token: "charProperty", regex: /\\p{\w+}/, merge:false},
|
||||||
|
{token: "char", regex: /\\./, merge:false},
|
||||||
|
],
|
||||||
|
quantifiers: [
|
||||||
|
{token: "quantifier", regex: /([?*+]|{\d+\b,?\d*}|{,\d+})[?+]?/, merge:false}
|
||||||
|
],
|
||||||
|
charclass: [
|
||||||
|
{include: "charTypes", merge:false},
|
||||||
|
{token: "charclass.start", regex: /\[\^?/, push: "charclass", merge:false},
|
||||||
|
{token: "charclass.end", regex: /\]/, next: "pop", merge:false}
|
||||||
|
],
|
||||||
|
groups: [
|
||||||
|
{token: "group", regex: /[(]([?](#|[imx\-]+:?|:|=|!|<=|<!|>|<\w+>|'\w+'|))?|[)]/,
|
||||||
|
onMatch: function(val, state, stack) {
|
||||||
|
if (!stack.groupNumber)
|
||||||
|
stack.groupNumber = 1;
|
||||||
|
|
||||||
|
var isStart = val !== ")";
|
||||||
|
var t = {depth:0,type: isStart ? "group.start" : "group.end", value: val};
|
||||||
|
t.groupType = val[2];
|
||||||
|
|
||||||
|
if (val == "(") {
|
||||||
|
t.number = stack.groupNumber++;
|
||||||
|
t.isGroup = true
|
||||||
|
} else if (t.groupType == "'" || (t.groupType == "<" && val.slice(-1) == ">")) {
|
||||||
|
t.name = val.slice(2, -1)
|
||||||
|
t.isGroup = true
|
||||||
|
} else if (t.groupType == ":") {
|
||||||
|
t.isGroup = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t.groupType && val.indexOf("x") != -1) {
|
||||||
|
var minus = val.indexOf("-");
|
||||||
|
if (minus == -1 || minus > val.indexOf("x"))
|
||||||
|
stack.xGroup = t;
|
||||||
|
else
|
||||||
|
stack.xGroup = null;
|
||||||
|
} else if (!isStart && stack.xGroup && stack.xGroup == stack[0]) {
|
||||||
|
if (stack.xGroup.value.slice(-1) == ":")
|
||||||
|
stack.xGroup = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isStart) {
|
||||||
|
if (stack.groupDepth) {
|
||||||
|
stack[0].hasChildren = true
|
||||||
|
}
|
||||||
|
stack.groupDepth = (stack.groupDepth||0)+1;
|
||||||
|
stack.unshift(t)
|
||||||
|
} else {
|
||||||
|
stack.groupDepth --;
|
||||||
|
t.start = stack.shift(t)
|
||||||
|
t.start.end = t
|
||||||
|
}
|
||||||
|
return [t]
|
||||||
|
}, merge:false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
xGroup: [
|
||||||
|
{token: "text", regex:/\s+/, onMatch: function(val, state, stack) {
|
||||||
|
return stack.xGroup ? [] : "text"
|
||||||
|
}, merge: true},
|
||||||
|
{token: "text", regex: /#/, onMatch: function(val, state, stack) {
|
||||||
|
if (stack.xGroup) {
|
||||||
|
this.next = "comment";
|
||||||
|
stack.unshift(state);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
this.next = "";
|
||||||
|
return "text";
|
||||||
|
}, merge: true}
|
||||||
|
],
|
||||||
|
comment: [{
|
||||||
|
regex: "[^\n\r]*|^", token: "", onMatch: function(val, state, stack) {
|
||||||
|
this.next = stack.shift();
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
r.normalizeRules()
|
||||||
|
var tmReTokenizer = new Tokenizer(r.getRules());
|
||||||
|
|
||||||
|
function tokenize(str) {
|
||||||
|
return tmReTokenizer.getLineTokens(str).tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toStr(tokens) { return tokens.map(function(x){return x.value}).join("")}
|
||||||
|
|
||||||
|
|
||||||
|
exports.tokenize = tokenize;
|
||||||
|
exports.toStr = toStr;
|
||||||
|
exports.tmReTokenizer = tmReTokenizer;
|
||||||
30
tool/regexp_tokenizer_test.js
Normal file
30
tool/regexp_tokenizer_test.js
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
require("amd-loader");
|
||||||
|
var assert = require("assert");
|
||||||
|
|
||||||
|
var tk = require("./regexp_tokenizer");
|
||||||
|
var tokenize = tk.tokenize;
|
||||||
|
var toStr = tk.toStr;
|
||||||
|
|
||||||
|
var logTokens = function(tokens) {
|
||||||
|
tokens.forEach(function(x) {
|
||||||
|
delete x.end
|
||||||
|
delete x.start
|
||||||
|
})
|
||||||
|
console.log(tokens)
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.equal(toStr(
|
||||||
|
tokenize("(?x)c + +\n\
|
||||||
|
# comment\n\
|
||||||
|
(?-x) # (?x: 1 \n\
|
||||||
|
(2) [ ] # a \n\
|
||||||
|
3 4) c#"
|
||||||
|
)),
|
||||||
|
"(?x)c++(?-x) # (?x:1(2)[ ]34) c#"
|
||||||
|
)
|
||||||
|
assert.equal(toStr(
|
||||||
|
tokenize("(?x)\n\
|
||||||
|
u # comment\n\
|
||||||
|
")),
|
||||||
|
"(?x)u"
|
||||||
|
)
|
||||||
45
tool/templates/dummy.JSON-tmLanguage
Normal file
45
tool/templates/dummy.JSON-tmLanguage
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
// [PackageDev] target_format: plist, ext: tmLanguage
|
||||||
|
{
|
||||||
|
"name": "Dummy",
|
||||||
|
"scopeName": "source.dummy",
|
||||||
|
"fileTypes": ["dummy"],
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#string"
|
||||||
|
}, {
|
||||||
|
"include": "#escapes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"escapes": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\\\[nrt\\\\\\$\\\"']",
|
||||||
|
"name": "keyword.dummy"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
"beginCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.string.begin.dummy"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"endCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.string.end.dummy"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contentName": "meta.string-contents.quoted.double.dummy",
|
||||||
|
"name": "string.quoted.double.dummy",
|
||||||
|
"end": "'''",
|
||||||
|
"begin": "'''",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#escapes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment": "This is a comment"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -28,17 +28,11 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
/* THIS FILE WAS AUTOGENERATED FROM %name% (UUID: %uuid%) */
|
/* This file was autogenerated from %name% (uuid: %uuid%) */
|
||||||
/****************************************************************
|
/****************************************************************************************
|
||||||
* IT MIGHT NOT BE PERFECT, PARTICULARLY: *
|
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
|
||||||
* IN DECIDING STATES TO TRANSITION TO, *
|
* fileTypes *
|
||||||
* IGNORING WHITESPACE, *
|
****************************************************************************************/
|
||||||
* IGNORING GROUPS WITH ?:, *
|
|
||||||
* EXTENDING EXISTING MODES, *
|
|
||||||
* GATHERING KEYWORDS, OR *
|
|
||||||
* DECIDING WHEN TO USE PUSH. *
|
|
||||||
* ...But it's a good start from an existing *.tmlanguage file. *
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
@ -55,6 +49,9 @@ var %language%HighlightRules = function() {
|
||||||
this.normalizeRules();
|
this.normalizeRules();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
%language%HighlightRules.metaData = %metaData%
|
||||||
|
|
||||||
|
|
||||||
oop.inherits(%language%HighlightRules, TextHighlightRules);
|
oop.inherits(%language%HighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
exports.%language%HighlightRules = %language%HighlightRules;
|
exports.%language%HighlightRules = %language%HighlightRules;
|
||||||
|
|
@ -48,8 +48,8 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.lineCommentStart = "%lineCommentStart%";
|
// this.lineCommentStart = "%lineCommentStart%";
|
||||||
this.blockComment = {start: "%blockCommentStart%", end: "%blockCommentEnd%"};
|
// this.blockComment = {start: "%blockCommentStart%", end: "%blockCommentEnd%"};
|
||||||
// Extra logic goes here.
|
// Extra logic goes here.
|
||||||
this.$id = "ace/mode/%languageHighlightFilename%"
|
this.$id = "ace/mode/%languageHighlightFilename%"
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: %uuid%) */
|
/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: %uuid%) */
|
||||||
|
|
||||||
.%cssClass% .ace_gutter {
|
.%cssClass% .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: %gutterBg%;
|
||||||
color: #333;
|
color: %gutterFg%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.%cssClass% .ace_print-margin {
|
.%cssClass% .ace_print-margin {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,330 @@
|
||||||
|
require("amd-loader");
|
||||||
|
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var util = require("util");
|
var util = require("util");
|
||||||
var lib = require("./lib");
|
var lib = require("./lib");
|
||||||
|
var pathlib = require("path");
|
||||||
var parseLanguage = lib.parsePlist;
|
var parseLanguage = lib.parsePlist;
|
||||||
|
|
||||||
|
var tk = require("./regexp_tokenizer");
|
||||||
|
var tokenize = tk.tokenize;
|
||||||
|
var toStr = tk.toStr;
|
||||||
|
|
||||||
|
function last(array) {return array[array.length - 1]}
|
||||||
|
|
||||||
|
function convertHexEscape(tokens) {
|
||||||
|
var inChClass = false;
|
||||||
|
tokens.forEach(function(t) {
|
||||||
|
if (t.type == "charclass")
|
||||||
|
inChClass = true;
|
||||||
|
else if (t.type == "charclass.end")
|
||||||
|
inChClass = false;
|
||||||
|
else if (t.type == "charType"){
|
||||||
|
if (t.value == "\\h") {
|
||||||
|
t.type = "text";
|
||||||
|
t.value = inChClass ? "\\da-fA-F" : "[\\da-fA-F]";
|
||||||
|
}
|
||||||
|
else if (t.value == "\\H") {
|
||||||
|
if (inChClass) {
|
||||||
|
console.warn("can't convert \\H in charclass");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
t.type = "text";
|
||||||
|
t.value = "[^\\da-fA-F]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertNewLinesTo$(str) {
|
||||||
|
var tokens = tokenize(str);
|
||||||
|
for (var i = 0; i < tokens.length; i++) {
|
||||||
|
var t= tokens[i];
|
||||||
|
if (t.type == "char" && t.value == "\\n") {
|
||||||
|
var p = tokens[i + 1] || {};
|
||||||
|
if (p.type != "quantifier") {
|
||||||
|
t.value = "$";
|
||||||
|
while (p.value == "\\n" || p.type == "quantifier") {
|
||||||
|
p.value = "";
|
||||||
|
p = tokens[++i + 1] || {};
|
||||||
|
}
|
||||||
|
} else if (/\?|\*|{,|{0,/.test(p.value)) {
|
||||||
|
t.value = p.value = "";
|
||||||
|
} else
|
||||||
|
p.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toStr(tokens).replace(/[$]+/g, "$");
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertCharacterTypes(str) {
|
||||||
|
var tokens = tokenize(str);
|
||||||
|
tokens = convertHexEscape(tokens);
|
||||||
|
|
||||||
|
var warn = false;
|
||||||
|
tokens.forEach(function(t){
|
||||||
|
if (t.type == "quantifier") {
|
||||||
|
var val = t.value;
|
||||||
|
if (val.slice(-1) == "+" && val.length > 1) {
|
||||||
|
t.value = val.slice(0, -1);
|
||||||
|
warn = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (warn)
|
||||||
|
console.log("converted possesive quantifier " + warn + " to *");
|
||||||
|
return toStr(tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeInlineFlags(str, rule) {
|
||||||
|
var tokens = tokenize(str);
|
||||||
|
var caseInsensitive = false;
|
||||||
|
tokens.forEach(function(t, i) {
|
||||||
|
if (t.type == "group.start" && /[imsx]/.test(t.value)) {
|
||||||
|
if (/i/.test(t.value))
|
||||||
|
caseInsensitive = true;
|
||||||
|
t.value = t.value.replace(/[imsx\-]/g, "");
|
||||||
|
var next = tokens[i + 1];
|
||||||
|
if (next && next.type == "group.end") {
|
||||||
|
t.value = next.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (caseInsensitive && rule)
|
||||||
|
rule.caseInsensitive = true;
|
||||||
|
return toStr(tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertToNonCapturingGroups(str) {
|
||||||
|
var tokens = tokenize(str);
|
||||||
|
tokens.forEach(function(t, i) {
|
||||||
|
if (t.type == "group.start" && t.value == "(")
|
||||||
|
t.value += "?:";
|
||||||
|
});
|
||||||
|
return toStr(tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
function simplifyNonCapturingGroups(str) {
|
||||||
|
var tokens = tokenize(str);
|
||||||
|
var t = tokens[0];
|
||||||
|
if (t.type == "group.start" && t.value == "(?:"
|
||||||
|
&& t.end == last(tokens)) {
|
||||||
|
t.value = t.end.value = "";
|
||||||
|
}
|
||||||
|
var i = 0;
|
||||||
|
function iter(f) {
|
||||||
|
for (i = 0; i < tokens.length; i++)
|
||||||
|
f(tokens[i]);
|
||||||
|
}
|
||||||
|
function iterGroup(end, f) {
|
||||||
|
for (var i1 = i + 1; i1 < tokens.length; i1++) {
|
||||||
|
var t = tokens[i1];
|
||||||
|
if (t == end)
|
||||||
|
break;
|
||||||
|
var index = f && f(t);
|
||||||
|
if (index > i1)
|
||||||
|
i1 = index;
|
||||||
|
}
|
||||||
|
return i1;
|
||||||
|
}
|
||||||
|
|
||||||
|
iter(function (t) {
|
||||||
|
if (t.type == "group.start" && t.value == "(?:") {
|
||||||
|
if (!t.end)
|
||||||
|
return console.error("malformed regex: " + str);
|
||||||
|
|
||||||
|
var canRemove = true;
|
||||||
|
var next = tokens[tokens.indexOf(t.end, i) + 1];
|
||||||
|
if (next && next.type == "quantifier")
|
||||||
|
return;
|
||||||
|
iterGroup(t.end, function(t) {
|
||||||
|
if (t.type == "alternation")
|
||||||
|
canRemove = false;
|
||||||
|
else if (t.type == "group.start" && t.end)
|
||||||
|
return iterGroup(t.end);
|
||||||
|
});
|
||||||
|
if (canRemove)
|
||||||
|
t.value = t.end.value = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return toStr(tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeLookBehinds(str) {
|
||||||
|
var tokens = tokenize(str);
|
||||||
|
var toRemove = null;
|
||||||
|
tokens.forEach(function(t, i) {
|
||||||
|
if (!toRemove && t.type == "group.start" && /</.test(t.value)) {
|
||||||
|
toRemove = t.end;
|
||||||
|
toRemove.content = [];
|
||||||
|
}
|
||||||
|
if (toRemove) {
|
||||||
|
toRemove.content.push(t.value);
|
||||||
|
t.value = "";
|
||||||
|
}
|
||||||
|
if (t == toRemove) {
|
||||||
|
var c = toRemove.content.slice(1, -1).join("");
|
||||||
|
if (/\^/.test(c))
|
||||||
|
toRemove.value = "(?:" + c +")";
|
||||||
|
|
||||||
|
toRemove = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return toStr(tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertBeginEndBackrefs(rule) {
|
||||||
|
if (!/\\\d/.test(rule.end))
|
||||||
|
return;
|
||||||
|
var startTokens = tokenize(rule.begin);
|
||||||
|
var endTokens = tokenize(rule.end);
|
||||||
|
|
||||||
|
|
||||||
|
var groups = {};
|
||||||
|
startTokens.forEach(function(t, i) {
|
||||||
|
if (t.number && t.end && t.type == "group.start") {
|
||||||
|
var endIndex = startTokens.indexOf(t.end, i + 1);
|
||||||
|
var content = startTokens.slice(i+1, endIndex);
|
||||||
|
groups[t.number] = toStr(content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
endTokens.forEach(function(t) {
|
||||||
|
if (t.type == "backRef") {
|
||||||
|
var num = t.value.substr(1);
|
||||||
|
if (groups[num])
|
||||||
|
t.value = "(?:" + groups[num] + ")";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rule.end = toStr(endTokens);
|
||||||
|
|
||||||
|
console.warn("Begin-End-Backreference is detected", rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkForNamedCaptures(str) {
|
||||||
|
var tokens = tokenize(str);
|
||||||
|
tokens.forEach(function(t) {
|
||||||
|
if (t.type == "group.start" && t.name)
|
||||||
|
console.warn("named capture not implemented", str);
|
||||||
|
if (t.type == "backRef")
|
||||||
|
console.warn("backRef not implemented ", str);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fixGroups(captures, defaultName, regex) {
|
||||||
|
var tokens = tokenize(regex);
|
||||||
|
|
||||||
|
var opened = [], isStart = true, i = 0;
|
||||||
|
function open() {
|
||||||
|
var t = {value: "(", type: "group.start", isGroup: true};
|
||||||
|
opened.push(t);
|
||||||
|
tokens.splice(i++, 0, t);
|
||||||
|
}
|
||||||
|
function close() {
|
||||||
|
var t = {value: ")", type: "group.start"};
|
||||||
|
t.start = opened.pop();
|
||||||
|
t.start.end = t;
|
||||||
|
tokens.splice(i++, 0, t);
|
||||||
|
}
|
||||||
|
function tryOpen(){if (isStart) {open(); isStart = false}}
|
||||||
|
function tryClose(){if (opened.length) close()}
|
||||||
|
function skip(t) {
|
||||||
|
var i1 = tokens.indexOf(t.end, i);
|
||||||
|
if (i1 > i)
|
||||||
|
i = i1;
|
||||||
|
}
|
||||||
|
function lst(t) {return t[t.length - 1]}
|
||||||
|
function iter(f) {
|
||||||
|
for (i = 0; i < tokens.length; i++)
|
||||||
|
f(tokens[i]);
|
||||||
|
}
|
||||||
|
function iterGroup(end, f) {
|
||||||
|
for (var i1 = i + 1; i1 < tokens.length; i1++) {
|
||||||
|
var t = tokens[i1];
|
||||||
|
if (t == end)
|
||||||
|
break;
|
||||||
|
f(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function peek() { return tokens[i + 1] || {}}
|
||||||
|
|
||||||
|
// groupify
|
||||||
|
iter(function(t){
|
||||||
|
if (t.type == "group.start") {
|
||||||
|
tryClose();
|
||||||
|
isStart = true;
|
||||||
|
if (!t.hasChildren || t.isSpecial)
|
||||||
|
skip(t);
|
||||||
|
} else if (t.type == "group.end") {
|
||||||
|
isStart = true;
|
||||||
|
tryClose();
|
||||||
|
} else if (t.type == "alternation") {
|
||||||
|
isStart = true;
|
||||||
|
tryClose();
|
||||||
|
} else if (t.type != "anchor" && t.type != "quantifier"){
|
||||||
|
tryOpen();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tryClose();
|
||||||
|
|
||||||
|
// remove redundand groups
|
||||||
|
var names = [defaultName];
|
||||||
|
iter(function(t){
|
||||||
|
if (t.type == "group.start" && !t.isSpecial) {
|
||||||
|
var captureName = captures[t.number];
|
||||||
|
|
||||||
|
if (!t.hasChildren) {
|
||||||
|
t.tokenName = captureName || lst(names);
|
||||||
|
skip(t);
|
||||||
|
} else {
|
||||||
|
var hasCapture = false;
|
||||||
|
iterGroup(t.end, function(t1) {
|
||||||
|
if (t1.type == "group.start" && captures[t1.number])
|
||||||
|
hasCapture = true;
|
||||||
|
});
|
||||||
|
if (hasCapture) {
|
||||||
|
t.value = "(?:";
|
||||||
|
if (captureName) {
|
||||||
|
names.push(captureName);
|
||||||
|
t.isTokenGroup = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
t.tokenName = captureName || lst(names);
|
||||||
|
iterGroup(t.end, function(t1) {
|
||||||
|
if (t1.value == "(")
|
||||||
|
t1.value = "(?:";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (t.type == "group.end") {
|
||||||
|
if (t.start.isTokenGroup)
|
||||||
|
names.pop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// wrap capturing groups with quantifier
|
||||||
|
iter(function(t){
|
||||||
|
if (t.type == "group.end" && t.start.value == "(" && peek().type == "quantifier") {
|
||||||
|
peek().value += ")";
|
||||||
|
t.start.value += "(?:";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
names = [];
|
||||||
|
tokens.forEach(function(t) {
|
||||||
|
if (t.value == "(" || t.value == "((?:" )
|
||||||
|
t.tokenName && names.push(t.tokenName);
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
names: names,
|
||||||
|
regex: toStr(tokens)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** converter */
|
||||||
|
|
||||||
function logDebug(string, obj) {
|
function logDebug(string, obj) {
|
||||||
console.log(string, obj);
|
console.log(string, obj);
|
||||||
|
|
@ -13,7 +335,6 @@ function logDebug(string, obj) {
|
||||||
|
|
||||||
// for tracking token states
|
// for tracking token states
|
||||||
var states = {start: []};
|
var states = {start: []};
|
||||||
var stateName = "start";
|
|
||||||
|
|
||||||
function processRules(rules){
|
function processRules(rules){
|
||||||
if (rules.patterns)
|
if (rules.patterns)
|
||||||
|
|
@ -40,29 +361,38 @@ function processPatterns(pl) {
|
||||||
return pl.map(processPattern);
|
return pl.map(processPattern);
|
||||||
}
|
}
|
||||||
function processPattern(p) {
|
function processPattern(p) {
|
||||||
|
|
||||||
if (p.end == "(?!\\G)" && p.patterns && p.patterns.length == 1) {
|
if (p.end == "(?!\\G)" && p.patterns && p.patterns.length == 1) {
|
||||||
var rule = processPattern(p.patterns[0]);
|
var rule = processPattern(p.patterns[0]);
|
||||||
}
|
}
|
||||||
else if (p.begin && p.end) {
|
else if (p.begin != null && p.end != null) {
|
||||||
var rule = simpleRule(p.begin, p.name, p.beginCaptures || p.captures)
|
convertBeginEndBackrefs(p);
|
||||||
|
|
||||||
|
var rule = simpleRule(p.begin, p.name, p.beginCaptures || p.captures);
|
||||||
|
|
||||||
var next = processPatterns(p.patterns || []);
|
var next = processPatterns(p.patterns || []);
|
||||||
var endRule = simpleRule(p.end, p.name, p.endCaptures || p.captures);
|
var endRule = simpleRule(p.end, p.name, p.endCaptures || p.captures);
|
||||||
endRule.next = "pop";
|
endRule.next = "pop";
|
||||||
next.push(endRule);
|
if (p.applyEndPatternLast)
|
||||||
|
next.push(endRule);
|
||||||
|
else
|
||||||
|
next.unshift(endRule);
|
||||||
|
|
||||||
if (p.name || p.contentName)
|
if (p.name || p.contentName)
|
||||||
next.push({defaultToken: p.name || p.contentName});
|
next.push({defaultToken: p.name || p.contentName});
|
||||||
|
|
||||||
rule.push = next;
|
rule.push = next;
|
||||||
|
|
||||||
|
rule = removeIncludeSelf(rule);
|
||||||
}
|
}
|
||||||
else if (p.match) {
|
else if (p.match) {
|
||||||
var rule = simpleRule(p.match, p.name, p.captures)
|
var rule = simpleRule(p.match, p.name, p.captures);
|
||||||
}
|
}
|
||||||
else if (p.include) {
|
else if (p.include) {
|
||||||
var rule = {include: p.include};
|
var rule = {include: p.include};
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
var rule = {todo: p};
|
||||||
|
}
|
||||||
|
|
||||||
if (p.comment)
|
if (p.comment)
|
||||||
rule.comment = (rule.comment || "") + p.comment;
|
rule.comment = (rule.comment || "") + p.comment;
|
||||||
|
|
@ -73,106 +403,269 @@ function processPattern(p) {
|
||||||
}
|
}
|
||||||
function simpleRule(regex, name, captures) {
|
function simpleRule(regex, name, captures) {
|
||||||
name = name || "text";
|
name = name || "text";
|
||||||
var rule = {};
|
var rule = {token: "", regex: ""};
|
||||||
|
|
||||||
var origRegex = regex
|
var origRegex = regex;
|
||||||
regex = transformRegExp(regex, rule);
|
regex = transformRegExp(origRegex, rule);
|
||||||
if (captures) {
|
if (captures) {
|
||||||
var tokenArray = [];
|
var tokenArray = [];
|
||||||
Object.keys(captures).forEach(function(x){
|
Object.keys(captures).forEach(function(x){
|
||||||
tokenArray[x] = captures[x] && captures[x].name;
|
tokenArray[x] = captures[x] && captures[x].name;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (tokenArray.length == 1) {
|
if (tokenArray.length == 1) {
|
||||||
name = tokenArray[0];
|
name = tokenArray[0];
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0; i < tokenArray.length; i++)
|
var fixed = fixGroups(tokenArray, name, regex);
|
||||||
if (!tokenArray[i])
|
name = fixed.names;
|
||||||
tokenArray[i] = name;
|
regex = fixed.regex;
|
||||||
name = tokenArray;
|
if (name.length == 1)
|
||||||
rule.todo = "fix grouping";
|
name = name[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof name == "string")
|
||||||
|
regex = convertToNonCapturingGroups(regex);
|
||||||
|
|
||||||
|
regex = simplifyNonCapturingGroups(regex);
|
||||||
|
|
||||||
try {new RegExp(regex);} catch(e) {
|
try {new RegExp(regex);} catch(e) {
|
||||||
rule.TODO = "FIXME: regexp doesn't have js equivalent";
|
rule.TODO = "FIXME: regexp doesn't have js equivalent";
|
||||||
rule.originalRegex = origRegex
|
rule.originalRegex = origRegex;
|
||||||
|
|
||||||
|
// lookbehinds are mostly used to force ordering
|
||||||
|
// regex = removeLookBehinds(regex);
|
||||||
}
|
}
|
||||||
rule.token = name;
|
rule.token = name;
|
||||||
rule.regex = regex;
|
rule.regex = regex;
|
||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeIncludeSelf(rule) {
|
||||||
|
if (!rule.push)
|
||||||
|
return rule;
|
||||||
|
var hasSelfInclude = false;
|
||||||
|
var escapeRule = null;
|
||||||
|
var complexSelfInclude = false;
|
||||||
|
rule.push.forEach(function(sub) {
|
||||||
|
if (sub.include == "$self") {
|
||||||
|
hasSelfInclude = true;
|
||||||
|
} else if (sub.defaultToken) {
|
||||||
|
return;
|
||||||
|
} else if (sub.next == "pop") {
|
||||||
|
escapeRule = sub;
|
||||||
|
} else
|
||||||
|
complexSelfInclude = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (hasSelfInclude) {
|
||||||
|
console.warn("can't convert include $self");
|
||||||
|
return {todo: rule};
|
||||||
|
|
||||||
|
if (complexSelfInclude) {
|
||||||
|
console.warn("can't convert include $self");
|
||||||
|
rule.toDo = "include $self not fully supported";
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
console.warn("include $self not fully supported");
|
||||||
|
delete rule.push;
|
||||||
|
delete escapeRule.next;
|
||||||
|
rule.includeSelf = true;
|
||||||
|
escapeRule.includeSelf = true;
|
||||||
|
return [rule, escapeRule];
|
||||||
|
}
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
// regex transformation
|
// regex transformation
|
||||||
|
|
||||||
function removeXFlag(str) {
|
function removeXFlag(str) {
|
||||||
if (str && str.slice(0,4) == "(?x)") {
|
var tokens = tokenize(str);
|
||||||
str = str.replace(/\\.|\[([^\]\\]|\\.)*?\]|\s+|(?:#[^\n]*)/g, function(s) {
|
return toStr(tokens);
|
||||||
if (s[0] == "[")
|
|
||||||
return s;
|
|
||||||
if (s[0] == "\\")
|
|
||||||
return /[#\s]/.test(s[1]) ? s[1] : s;
|
|
||||||
return "";
|
|
||||||
}).substr(4);
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function transformRegExp(str, rule) {
|
function transformRegExp(str, rule) {
|
||||||
str = removeXFlag(str);
|
str = convertNewLinesTo$(str);
|
||||||
//str = str.replace(/\\n\$|\$\\n/g, '$');
|
|
||||||
str = str.replace(/\\n(?!\?).?/g, '$'); // replace newlines by $ except if its postfixed by ?
|
str = removeInlineFlags(str, rule);
|
||||||
if (/\(\?[i]\:|\(?\w*i\w*\)/g.test(str)) {
|
|
||||||
str = str.replace(/\(\?[ims\-]\:/g, "(?:"); // checkForInvariantRegex
|
|
||||||
str = str.replace(/\(\?[imsx\-]\)/g, "");
|
|
||||||
rule && (rule.caseInsensitive = true);
|
|
||||||
}
|
|
||||||
str = str.replace(/(\\[xu]){([a-fA-F\d]+)}/g, '$1$2');
|
str = str.replace(/(\\[xu]){([a-fA-F\d]+)}/g, '$1$2');
|
||||||
|
|
||||||
|
str = convertCharacterTypes(str, rule);
|
||||||
|
|
||||||
|
checkForNamedCaptures(str);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
function extractPatterns(tmRules) {
|
function extractPatterns(tmRules) {
|
||||||
var patterns = processRules(tmRules);
|
return processRules(tmRules);
|
||||||
return lib.restoreJSONComments(lib.formatJSON(patterns, " "));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function detectLoops(states) {
|
||||||
|
var data = {};
|
||||||
|
var keys = Object.keys(states);
|
||||||
|
var flattenedStates = {};
|
||||||
|
function addRef(item, name) {
|
||||||
|
if (item.refs.indexOf(name) == -1)
|
||||||
|
item.refs.push(name);
|
||||||
|
}
|
||||||
|
function anonStateId(name, next) {
|
||||||
|
var i = 0, old = name;
|
||||||
|
while (flattenedStates[name] || states[name]) {
|
||||||
|
name = old + "_" + i++;
|
||||||
|
}
|
||||||
|
// console.log(old, name)
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
function addState(key, rules) {
|
||||||
|
if (rules && !flattenedStates[key])
|
||||||
|
flattenedStates[key] = rules;
|
||||||
|
return rules || flattenedStates[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
var key = keys[i];
|
||||||
|
var state = addState(key, states[key]);
|
||||||
|
|
||||||
|
var item = data[key] || (data[key] = {/* name: key, */ refs: []});
|
||||||
|
state.forEach(function(rule) {
|
||||||
|
var next = rule.push || rule.next;
|
||||||
|
if (next == "pop") {
|
||||||
|
// nothing
|
||||||
|
} else if (typeof next == "string") {
|
||||||
|
addRef(item, next);
|
||||||
|
} else if (next) {
|
||||||
|
var anonId = anonStateId(key, next);
|
||||||
|
addState(anonId, next);
|
||||||
|
if (rule.push)
|
||||||
|
addRef(item, anonId);
|
||||||
|
keys.push(anonId);
|
||||||
|
} else if (rule.include) {
|
||||||
|
addRef(item, rule.include);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var cycles = [];
|
||||||
|
function addPath(start, path) {
|
||||||
|
var node = data[start];
|
||||||
|
path.push(start);
|
||||||
|
if (!node || !node.refs)
|
||||||
|
console.log(start);
|
||||||
|
var i = path.indexOf(start);
|
||||||
|
if (i > -1 && i != path.length - 1 || start == "$self" || start == "$base") {
|
||||||
|
if (i != -1)
|
||||||
|
path = path.slice(i);
|
||||||
|
for (var j = 0; j < cycles.length; j++) {
|
||||||
|
if (cycles[j] + "" == path + "")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return cycles.push(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!node || !node.refs || !node.refs.length || path.length>30)
|
||||||
|
return;
|
||||||
|
node.refs.forEach(function(x) {
|
||||||
|
addPath(x, path.concat());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
addPath("start", []);
|
||||||
|
|
||||||
|
console.error(cycles.join("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function test(fileName) {
|
||||||
|
console.log("testing highlighter");
|
||||||
|
try {
|
||||||
|
var module = require(fileName);
|
||||||
|
var Mode = module[Object.keys(module)[0]];
|
||||||
|
var mode = new Mode();
|
||||||
|
mode.getTokenizer().getLineTokens("hello world");
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function guessComment(patterns) {
|
||||||
|
var comment = {};
|
||||||
|
for (var i in patterns) {
|
||||||
|
var state = patterns[i];
|
||||||
|
state.forEach(function(r) {
|
||||||
|
if (typeof r.token == "string") {
|
||||||
|
if (/\bcomment\b/.test(r.token)) {
|
||||||
|
comment.line = r.regex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
// cli stuff
|
// cli stuff
|
||||||
var modeTemplate = fs.readFileSync(__dirname + "/templates/mode.js", "utf8");
|
var modeTemplate = fs.readFileSync(__dirname + "/templates/mode.js", "utf8");
|
||||||
var modeHighlightTemplate = fs.readFileSync(__dirname + "/templates/highlight_rules.js", "utf8");
|
var modeHighlightTemplate = fs.readFileSync(__dirname + "/templates/highlight_rules.js", "utf8");
|
||||||
|
|
||||||
function convertLanguageFile(name) {
|
function fetchAndConvert(name) {
|
||||||
var path = /^(\/|\w:)/.test(name) ? name : process.cwd() + "/" + name
|
console.log("Converting " + name);
|
||||||
var tmLanguage = fs.readFileSync(path, "utf8");
|
if (/^http/.test(name)) {
|
||||||
parseLanguage(tmLanguage, function(language) {
|
if (/:\/\/github.com/.test(name)) {
|
||||||
var languageHighlightFilename = language.name.replace(/[-_]/g, "").toLowerCase();
|
name = name.replace(/\/blob\//, "/").replace("github.com", "raw.github.com");
|
||||||
var languageNameSanitized = language.name.replace(/-/g, "");
|
}
|
||||||
|
return lib.download(name, function(data) {
|
||||||
|
convertTmLanguage(name, data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var path = /^(\/|\w:)/.test(name) ? name : process.cwd() + "/" + name;
|
||||||
|
var langStr = fs.readFileSync(path, "utf8");
|
||||||
|
convertTmLanguage(name, langStr);
|
||||||
|
}
|
||||||
|
|
||||||
var languageHighlightFile = __dirname + "/../lib/ace/mode/" + languageHighlightFilename + "_highlight_rules.js";
|
|
||||||
var languageModeFile = __dirname + "/../lib/ace/mode/" + languageHighlightFilename + ".js";
|
|
||||||
|
|
||||||
console.log("Converting " + name + " to " + languageHighlightFile);
|
function convertTmLanguage(name, langStr) {
|
||||||
|
parseLanguage(langStr, function(language) {
|
||||||
|
var highlighterFilename = lib.snakeCase(language.name).replace(/[^\w]/g, "");
|
||||||
|
var languageNameSanitized = lib.camelCase(language.name).replace(/[^\w]/g, "");
|
||||||
|
|
||||||
|
require("./add_mode")(languageNameSanitized, (language.fileTypes || []).join("|"));
|
||||||
|
|
||||||
|
var highlighterFile = pathlib.normalize(lib.AceLib + "ace/mode/" + highlighterFilename + "_highlight_rules.js");
|
||||||
|
var modeFile = pathlib.normalize(lib.AceLib + "ace/mode/" + highlighterFilename + ".js");
|
||||||
|
|
||||||
if (devMode) {
|
if (devMode) {
|
||||||
console.log(util.inspect(language.patterns, false, 4));
|
console.log(util.inspect(language.patterns, false, 4));
|
||||||
console.log(util.inspect(language.repository, false, 4));
|
console.log(util.inspect(language.repository, false, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var patterns = extractPatterns(language);
|
||||||
|
detectLoops(patterns);
|
||||||
|
|
||||||
|
// var uuid = language.uuid
|
||||||
|
delete language.uuid;
|
||||||
|
delete language.patterns;
|
||||||
|
delete language.repository;
|
||||||
|
|
||||||
|
var comment = guessComment(patterns);
|
||||||
var languageMode = lib.fillTemplate(modeTemplate, {
|
var languageMode = lib.fillTemplate(modeTemplate, {
|
||||||
language: languageNameSanitized,
|
language: languageNameSanitized,
|
||||||
languageHighlightFilename: languageHighlightFilename
|
languageHighlightFilename: highlighterFilename,
|
||||||
|
lineCommentStart: JSON.stringify(comment.line || "//"),
|
||||||
|
blockCommentStart: JSON.stringify(comment.start || "/*"),
|
||||||
|
blockCommentEnd: JSON.stringify(comment.end || "*/")
|
||||||
});
|
});
|
||||||
|
|
||||||
var patterns = extractPatterns(language);
|
|
||||||
|
|
||||||
var languageHighlightRules = lib.fillTemplate(modeHighlightTemplate, {
|
var languageHighlightRules = lib.fillTemplate(modeHighlightTemplate, {
|
||||||
language: languageNameSanitized,
|
language: languageNameSanitized,
|
||||||
languageTokens: patterns.trim(),
|
languageTokens: lib.formatJSON(patterns, " ").trim(),
|
||||||
uuid: language.uuid,
|
uuid: language.uuid,
|
||||||
name: name
|
name: name,
|
||||||
|
metaData: lib.formatJSON(language, " ").trim()
|
||||||
});
|
});
|
||||||
|
|
||||||
if (devMode) {
|
if (devMode) {
|
||||||
|
|
@ -181,17 +674,23 @@ function convertLanguageFile(name) {
|
||||||
console.log("Not writing, 'cause we're in dev mode, baby.");
|
console.log("Not writing, 'cause we're in dev mode, baby.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fs.writeFileSync(languageHighlightFile, languageHighlightRules);
|
fs.writeFileSync(highlighterFile, languageHighlightRules);
|
||||||
fs.writeFileSync(languageModeFile, languageMode);
|
fs.writeFileSync(modeFile, languageMode);
|
||||||
|
console.log("created file " + highlighterFile);
|
||||||
|
test(modeFile);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = process.argv.splice(2);
|
if (!module.parent) {
|
||||||
var tmLanguageFile = args[0];
|
var args = process.argv.splice(2);
|
||||||
var devMode = args[1];
|
var tmLanguageFile = args[0];
|
||||||
if (tmLanguageFile === undefined) {
|
var devMode = args[1];
|
||||||
console.error("Please pass in a language file via the command line.");
|
if (tmLanguageFile === undefined) {
|
||||||
process.exit(1);
|
console.error("Usage: node tmlanguage.js path/or/url/to/syntax.file");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
fetchAndConvert(tmLanguageFile);
|
||||||
|
} else {
|
||||||
|
exports.fetchAndConvert = fetchAndConvert;
|
||||||
}
|
}
|
||||||
convertLanguageFile(tmLanguageFile);
|
|
||||||
|
|
@ -135,6 +135,9 @@ function extractStyles(theme) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
colors.gutterBg = colors.background
|
||||||
|
colors.gutterFg = mix(colors.foreground, colors.background, 0.5)
|
||||||
|
|
||||||
if (!colors.selected_word_highlight)
|
if (!colors.selected_word_highlight)
|
||||||
colors.selected_word_highlight = "border: 1px solid " + colors.selection + ";";
|
colors.selected_word_highlight = "border: 1px solid " + colors.selection + ";";
|
||||||
|
|
||||||
|
|
@ -143,16 +146,32 @@ function extractStyles(theme) {
|
||||||
return colors;
|
return colors;
|
||||||
};
|
};
|
||||||
|
|
||||||
function luma(color) {
|
function mix(c1, c2, a1, a2) {
|
||||||
|
c1 = rgbColor(c1);
|
||||||
|
c2 = rgbColor(c2);
|
||||||
|
if (a2 === undefined)
|
||||||
|
a2 = 1 - a1
|
||||||
|
return "rgb(" + [
|
||||||
|
Math.round(a1*c1[0] + a2*c2[0]),
|
||||||
|
Math.round(a1*c1[1] + a2*c2[1]),
|
||||||
|
Math.round(a1*c1[2] + a2*c2[2])
|
||||||
|
].join(",") + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
function rgbColor(color) {
|
||||||
|
if (typeof color == "object")
|
||||||
|
return color;
|
||||||
if (color[0]=="#")
|
if (color[0]=="#")
|
||||||
var rgb = color.match(/^#(..)(..)(..)/).slice(1).map(function(c) {
|
return color.match(/^#(..)(..)(..)/).slice(1).map(function(c) {
|
||||||
return parseInt(c, 16);
|
return parseInt(c, 16);
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
var rgb = color.match(/\(([^,]+),([^,]+),([^,]+)/).slice(1).map(function(c) {
|
return color.match(/\(([^,]+),([^,]+),([^,]+)/).slice(1).map(function(c) {
|
||||||
return parseInt(c, 10);
|
return parseInt(c, 10);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
function luma(color) {
|
||||||
|
var rgb = rgbColor(color);
|
||||||
return (0.21 * rgb[0] + 0.72 * rgb[1] + 0.07 * rgb[2]) / 255;
|
return (0.21 * rgb[0] + 0.72 * rgb[1] + 0.07 * rgb[2]) / 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
399
tool/tmthemes/Katzenmilch.tmTheme
Normal file
399
tool/tmthemes/Katzenmilch.tmTheme
Normal file
|
|
@ -0,0 +1,399 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist
|
||||||
|
PUBLIC '-//Apple//DTD PLIST 1.0//EN'
|
||||||
|
'http://www.apple.com/DTDs/PropertyList-1.0.dtd'>
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Katzen-Milch</string>
|
||||||
|
<key>comment</key>
|
||||||
|
<string>Those silly germans and their cat milk! Ghee wizz!</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#f3f2f3</string>
|
||||||
|
<key>caret</key>
|
||||||
|
<string>#100011</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#0f0009ff</string>
|
||||||
|
<key>invisibles</key>
|
||||||
|
<string>#000000</string>
|
||||||
|
<key>lineHighlight</key>
|
||||||
|
<string>#ffffff</string>
|
||||||
|
<key>selection</key>
|
||||||
|
<string>#6405D044</string>
|
||||||
|
<key>selectionBorder</key>
|
||||||
|
<string>#8425f0</string>
|
||||||
|
<key>bracketContentsOptions</key>
|
||||||
|
<string>underline</string>
|
||||||
|
<key>tagsForeground</key>
|
||||||
|
<string>#0f0009ff</string>
|
||||||
|
<key>tagsOptions</key>
|
||||||
|
<string>underline</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Parenthesis</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>punctuation.definition.list</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string/>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#940494</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#4444940a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Comment</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>comment</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#404f50aa</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#5f0fff02</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>String</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#5a5f9b</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#aaafdb09</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Number</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant.numeric</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#4f827bee</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#77c2bb0f</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>User-defined Constant</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant.character, constant.other</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#025f69ff</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#7f229910</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Built-in Constant</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant.language</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string/>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#7D7e52</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#bDbe820f</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Storage Modifier</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>storage.modifier</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>bold</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#7B5D8f</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#9B9FfD0a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Storage</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>storage</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>bold</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#7B5cbfff</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#8B5Ddf0d</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Function Name</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.function</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#025f49f7</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#22ff491f</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Support Function</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support.function</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#9D7e62</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#bDbe820a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Misc Function</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.function.misc</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#939469</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#E3E4A90a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Predicate Function</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.function.predicate</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#856F63</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#A5DF930a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Input/Output Function</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.function.io</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#aF938C</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#DFB3AC0a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>External Symbol</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>variable.other.external-symbol</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#7BaFaD</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#BBDFDD0a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Variable</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>variable.language, variable.other</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#316fcf</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#3aafff0a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Parameter Variable</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>variable.parameter</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#33969fdd</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#05d6f90b</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Keyword</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#674Aa8</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#A3AAD80e</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Class Name</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.class</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>bold</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B9986F</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#B998DF22</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Structure Name</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.structure</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#22af9d</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#B998DF0a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Type Name</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.type</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#af47a9</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#af77a90d</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Class name</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.class, entity.name.type.class</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#cc4357</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#ffddff92</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Support Class</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support.class</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#ef6aa7ff</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#ef6aa710</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Invalid</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>invalid</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#CC1B27</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#DFDFD5</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>♦ String embedded-source</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string source</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#13499fdd</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#0099ff0a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Tag name</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.tag</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#3976a2</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#49a6d20a</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Tag attribute</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.other.attribute-name</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string/>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#4946c2ee</string>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#4986c209</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
916
tool/tmthemes/Kuroir Theme.tmTheme
Normal file
916
tool/tmthemes/Kuroir Theme.tmTheme
Normal file
|
|
@ -0,0 +1,916 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>author</key>
|
||||||
|
<string>Stanley Rost</string>
|
||||||
|
<key>comment</key>
|
||||||
|
<string>Kuroir</string>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Kuroir Theme</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#E8E9E8</string>
|
||||||
|
<key>caret</key>
|
||||||
|
<string>#202020</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#363636</string>
|
||||||
|
<key>invisibles</key>
|
||||||
|
<string>#0000004A</string>
|
||||||
|
<key>lineHighlight</key>
|
||||||
|
<string>#CBDC2F38</string>
|
||||||
|
<key>selection</key>
|
||||||
|
<string>#F5AA0091</string>
|
||||||
|
|
||||||
|
<key>bracketsForeground</key>
|
||||||
|
<string>#C41717</string>
|
||||||
|
<key>bracketsOptions</key>
|
||||||
|
<string>foreground underline</string>
|
||||||
|
|
||||||
|
<key>bracketContentsForeground</key>
|
||||||
|
<string>#C41717</string>
|
||||||
|
<key>bracketContentsOptions</key>
|
||||||
|
<string>foreground underline background</string>
|
||||||
|
|
||||||
|
<key>guide</key>
|
||||||
|
<string>#8F8F8F</string>
|
||||||
|
<key>activeGuide</key>
|
||||||
|
<string>#FA2828</string>
|
||||||
|
|
||||||
|
<key>tagsOptions</key>
|
||||||
|
<string>stippled_underline</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Comment</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>comment</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#DCDCDC8F</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#949494E8</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Regions</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>comment.line.region</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#E9D6DC85</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#A54776</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Line Marker</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>comment.line.marker.php</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#E9E4BE</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#668D68</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Todo</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>comment.line.todo.php</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#D9EAB8</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#456E48</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>FIXME</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>comment.line.fixme.php</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#E1D0CA</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#880006</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Constant</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#CD6839</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Entity</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#E8E9E8</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#8B4726</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Storage</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>storage</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#A52A2A</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Keyword Control</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword.control</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#CD3700</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Library Function</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support.function - variable, keyword.other.special-method.ruby</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B03060</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Comparison</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword.operator.comparison,keyword.operator.logical</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B83126</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>String</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#639300</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>R Interpolation</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string.quoted.double.ruby source.ruby.embedded.source</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#007E69</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Support</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#104E8B</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Variable</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>variable</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#009ACD</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Invalid Deprecated</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>invalid.deprecated</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#E8E9E8</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic underline</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#FD1732</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Invalid Illegal</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>invalid.illegal</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#FF060026</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#FD1224</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Embedded Source (Bright)</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>text source</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#77ADE900</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#7B211A</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Entity inherited-class</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.other.inherited-class</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#005273</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>String.regexp</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string.regexp</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#C9D4BE</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#417E00</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Support.function</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support.function</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#005273</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Support.constant</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support.constant</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#CF6A4C</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>j Entity Name Type</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.type</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>underline</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>j Cast</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.cast</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#676767</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Doctype/XML Processing</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.sgml.html meta.doctype, meta.sgml.html meta.doctype entity, meta.sgml.html meta.doctype string, meta.xml-processing, meta.xml-processing entity, meta.xml-processing string</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#494949</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Meta.tag.all</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.tag, meta.tag entity</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#005273</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Meta.tag.inline</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>source entity.name.tag, source entity.other.attribute-name, meta.tag.inline, meta.tag.inline entity</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#005273</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Namespaces</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.tag.namespace, entity.other.attribute-name.namespace</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B85423</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css tag-name</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.tag.css</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B83126</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css:pseudo-class</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.selector.css entity.other.attribute-name.tag.pseudo-class</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B12E25</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css#id</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.selector.css entity.other.attribute-name.id,entity.other.attribute-name.id.css</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B8002D</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css.class</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.selector.css entity.other.attribute-name.class, entity.other.attribute-name.class.css</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B8012D</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css property-name:</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support.type.property-name.css, meta.property-name</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#005273</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css @at-rule</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.preprocessor.at-rule keyword.control.at-rule</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#8693A5</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css property-value;</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.property-value</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#417E00</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string> css property-value color</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant.other.color</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B8860B</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css !important / !default</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword.other.important,keyword.other.default </string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#EE3A8C</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css additional-constants</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.property-value support.constant.named-color.css, meta.property-value constant</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#417E00</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
|
||||||
|
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css constructor.argument</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.constructor.argument.css</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#417E00</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css constant.numeric</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>constant.numeric</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#9A5925</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css keyword.unit</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword.other</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#9F5E3D</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>css keyword.unit</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>source.scss support.function.misc</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#1B76B0</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>diff.header</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.diff, meta.diff.header</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#82000E</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#F8BEBE</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>diff.deleted</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.deleted</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#420E09</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#F8F8F8</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>diff.changed</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.changed</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#4A410D</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#F8F8F8</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>diff.inserted</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.inserted</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#253B22</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#F8F8F8</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: Italic</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.italic</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#CD2626</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: Bold</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.bold</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>bold</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#8B1A1A</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: Underline</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.underline</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>underline</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#E18964</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: Quote</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.quote</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#FEE09C12</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#8B7765</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: Heading</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.heading, markup.heading entity</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#BF61330D</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#B8012D</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: List</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.list</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#8F5B26</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: Raw</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.raw</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#B1B3BA08</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#578BB3</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: Comment</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup comment</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#F67B37</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: Separator</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.separator</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#242424</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#60A633</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Markup: Other</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>markup.other</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#B1B3BA08</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#578BB3</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Log Entry</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.line.entry.logfile, meta.line.exit.logfile</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#EEEEEE29</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Log Entry Error</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>meta.line.error.logfile</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#751012</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>SCSS Punctuation End Comments</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>punctuation.definition.end</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#DCDCDC8F</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>--------------------------------</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict/>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>HTML Attribute name</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.other.attribute-name.html</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#629F9E</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>JS String</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>string.quoted.double.js, string.quoted.single.js</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#79A316</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>JS Function</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.function.js</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#488C45</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>JS Embedded code general</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>source.js.embedded.html</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#666</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>JS Storage Type</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>storage.type.js</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#BB3182</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>JS Support Class</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>support.class.js</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#338FD5</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>JS Control Keyword</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>keyword.control.js, keyword.operator.js</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#A99904</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string>italic</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Matching Pairs</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>entity.name.class</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#D7D7A7</string>
|
||||||
|
<key>foreground</key>
|
||||||
|
<string>#616838</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Active Guide</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>active_guide</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#968F96</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Highlight Matching Word</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>highlight_matching_word</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
<string>#CBDC2F38</string>
|
||||||
|
<key>fontStyle</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>uuid</key>
|
||||||
|
<string>467560D0-6ACE-4409-82FD-4791420837AC</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue