//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
- exports: ["JavaScript", "javascript"]
-}, this);
+ exports: ["JavaScript", "javascript"],
+ require: ["util"]
+});
+
+lazyRequire("template", ["template"]);
- newContext: function () this.modules.newContext(this.modules.userContext, true),
+ newContext: function () this.modules.newContext(this.modules.userContext, false,
+ "Dactyl JS Temp Context"),
// Some object members are only accessible as function calls
getKey: function (obj, key) {
// Some object members are only accessible as function calls
getKey: function (obj, key) {
let globals = values(toplevel && this.window === obj ? this.globalNames : []);
if (toplevel && isObject(obj) && "wrappedJSObject" in obj)
let globals = values(toplevel && this.window === obj ? this.globalNames : []);
if (toplevel && isObject(obj) && "wrappedJSObject" in obj)
- for (let key in iter(globals, properties(obj, !toplevel, true)))
- if (!Set.add(seen, key))
+ for (let key in iter(globals, properties(obj, !toplevel)))
+ if (!seen.add(key))
- for (let key in properties(this.getKey(obj, "wrappedJSObject"), !toplevel, true))
+ for (let key in properties(this.getKey(obj, "wrappedJSObject"),
+ !toplevel))
- cache[key] = this.modules.dactyl.userEval(arg, context, /*L*/"[Command Line Completion]", 1);
+ cache[key] = this.modules.dactyl.userEval(arg, context,
+ /*L*/"[Command Line Completion]", 1);
// Don't eval any function calls unless the user presses tab.
_checkFunction: function (start, end, key) {
// Don't eval any function calls unless the user presses tab.
_checkFunction: function (start, end, key) {
_complete: function (objects, key, compl, string, last) {
const self = this;
_complete: function (objects, key, compl, string, last) {
const self = this;
let base = this.context.fork("js", this._top.offset);
base.forceAnchored = true;
base.filter = last == null ? key : string;
let prefix = last != null ? key : "";
if (last == null) // We're not looking for a quoted string, so filter out anything that's not a valid identifier
let base = this.context.fork("js", this._top.offset);
base.forceAnchored = true;
base.filter = last == null ? key : string;
let prefix = last != null ? key : "";
if (last == null) // We're not looking for a quoted string, so filter out anything that's not a valid identifier
- base.quote = [last, function (text) util.escapeString(text, ""), last];
+ base.quote = [last, text => util.escapeString(text, ""), last];
objects.forEach(function (obj) {
let context = base.fork(obj[1]);
context.title = [obj[1]];
objects.forEach(function (obj) {
let context = base.fork(obj[1]);
context.title = [obj[1]];
context.key = obj[1] + last;
if (obj[0] == this.cache.evalContext)
context.regenerate = true;
context.key = obj[1] + last;
if (obj[0] == this.cache.evalContext)
context.regenerate = true;
- obj.ctxt_t.generate = function () self.objectKeys(obj[0], true);
- obj.ctxt_p.generate = function () self.objectKeys(obj[0], false);
+ obj.ctxt_t.generate = () => self.objectKeys(obj[0], true);
+ obj.ctxt_p.generate = () => self.objectKeys(obj[0], false);
let [, prefix, args] = /^(function .*?)\((.*?)\)/.exec(Function.prototype.toString.call(func));
let n = this._get(i).comma.length;
args = template.map(Iterator(args.split(", ")),
let [, prefix, args] = /^(function .*?)\((.*?)\)/.exec(Function.prototype.toString.call(func));
let n = this._get(i).comma.length;
args = template.map(Iterator(args.split(", ")),
- function ([i, arg]) <span highlight={i == n ? "Filter" : ""}>{arg}</span>,
- <>, </>);
- this.context.message = <>{prefix}({args})</>;
+ ([i, arg]) => ["span", { highlight: i == n ? "Filter" : "" }, arg],
+ ",\u00a0");
+ this.context.message = ["", prefix + "(", args, ")"];
for (let [i, idx] in Iterator(this._get(-2).comma)) {
let arg = this._str.substring(prev + 1, idx);
prev = idx;
for (let [i, idx] in Iterator(this._get(-2).comma)) {
let arg = this._str.substring(prev + 1, idx);
prev = idx;
if (!this.context.tabPressed && key == "" && obj.length > 1) {
let message = this.context.message || "";
this.context.waitingForTab = true;
if (!this.context.tabPressed && key == "" && obj.length > 1) {
let message = this.context.message || "";
this.context.waitingForTab = true;
- this.context.message = <>{message}
- {_("completion.waitingForKeyPress")}</>;
+ this.context.message = ["", message, "\n",
+ _("completion.waitingForKeyPress")];
"ROCSSPrimitiveValue", "RangeError", "ReferenceError", "RegExp",
"StopIteration", "String", "SyntaxError", "TypeError", "URIError",
"Uint16Array", "Uint32Array", "Uint8Array", "XML", "XMLHttpProgressEvent",
"ROCSSPrimitiveValue", "RangeError", "ReferenceError", "RegExp",
"StopIteration", "String", "SyntaxError", "TypeError", "URIError",
"Uint16Array", "Uint32Array", "Uint8Array", "XML", "XMLHttpProgressEvent",
- "XMLList", "XMLSerializer", "XPCNativeWrapper", "XPCSafeJSWrapper",
+ "XMLList", "XMLSerializer", "XPCNativeWrapper",
"XULControllers", "constructor", "decodeURI", "decodeURIComponent",
"encodeURI", "encodeURIComponent", "escape", "eval", "isFinite", "isNaN",
"isXMLName", "parseFloat", "parseInt", "undefined", "unescape", "uneval"
].concat([k.substr(6) for (k in keys(Ci)) if (/^nsIDOM/.test(k))])
.concat([k.substr(3) for (k in keys(Ci)) if (/^nsI/.test(k))])
.concat(this.magicalNames)
"XULControllers", "constructor", "decodeURI", "decodeURIComponent",
"encodeURI", "encodeURIComponent", "escape", "eval", "isFinite", "isNaN",
"isXMLName", "parseFloat", "parseInt", "undefined", "unescape", "uneval"
].concat([k.substr(6) for (k in keys(Ci)) if (/^nsIDOM/.test(k))])
.concat([k.substr(3) for (k in keys(Ci)) if (/^nsI/.test(k))])
.concat(this.magicalNames)
completion: function (dactyl, modules, window) {
const { completion } = modules;
update(modules.completion, {
completion: function (dactyl, modules, window) {
const { completion } = modules;
update(modules.completion, {
}
let prompt = "js" + this.count;
Class.replaceProperty(this.context, prompt, result);
}
let prompt = "js" + this.count;
Class.replaceProperty(this.context, prompt, result);
- util.xmlToDom(<e4x>
- <div highlight="REPL-E" key="e"><span highlight="REPL-R">{prompt}></span> {js}</div>
- <div highlight="REPL-P" key="p">{xml}</div>
- </e4x>.elements(), this.document, nodes));
+ DOM.fromJSON(
+ [["div", { highlight: "REPL-E", key: "e" },
+ ["span", { highlight: "REPL-R" },
+ prompt, ">"], " ", js],
+ ["div", { highlight: "REPL-P", key: "p" },
+ xml]],
+ this.document, nodes));
this.rootNode.scrollTop += nodes.e.getBoundingClientRect().top
- this.rootNode.getBoundingClientRect().top;
this.rootNode.scrollTop += nodes.e.getBoundingClientRect().top
- this.rootNode.getBoundingClientRect().top;
- default xml namespace = XHTML;
- util.xmlToDom(<div highlight="REPL" key="rootNode"/>,
+ DOM.fromJSON(["div", { highlight: "REPL", key: "rootNode" }],
this.js.globals = [
[this.context, /*L*/"REPL Variables"],
[context, /*L*/"REPL Global"]
this.js.globals = [
[this.context, /*L*/"REPL Variables"],
[context, /*L*/"REPL Global"]
if (!isPrototypeOf.call(modules.jsmodules, context))
this.js.toplevel = context;
if (!isPrototypeOf.call(modules.jsmodules, context))
this.js.toplevel = context;
if (!isPrototypeOf.call(window, context))
this.js.window = context;
if (!isPrototypeOf.call(window, context))
this.js.window = context;
leave: function leave(params) {
leave.superapply(this, arguments);
leave: function leave(params) {
leave.superapply(this, arguments);
mappings: function initMappings(dactyl, modules, window) {
const { mappings, modes } = modules;
mappings: function initMappings(dactyl, modules, window) {
const { mappings, modes } = modules;
bind(["<Return>"], "Accept the current input",
function ({ self }) { self.accept(); });
bind(["<Return>"], "Accept the current input",
function ({ self }) { self.accept(); });
bind(["<C-b>", "<PageUp>"], "Scroll up half a page",
function ({ self }) { self.repl.scrollVertical("pages", -1); });
},
bind(["<C-b>", "<PageUp>"], "Scroll up half a page",
function ({ self }) { self.repl.scrollVertical("pages", -1); });
},
modules.options.add(["jsdebugger", "jsd"],
"Enable the JavaScript debugger service for use in JavaScript completion",
"boolean", false, {
modules.options.add(["jsdebugger", "jsd"],
"Enable the JavaScript debugger service for use in JavaScript completion",
"boolean", false, {