|
@@ -1,8 +1,17 @@
|
|
|
-define(["amber/boot", "amber_core/Kernel-Objects", "helios/Helios-Core"], function($boot){"use strict";
|
|
|
+define(["amber/boot"
|
|
|
+//>>excludeStart("imports", pragmas.excludeImports);
|
|
|
+, "codemirror/lib/codemirror", "codemirror/addon/hint/show-hint", "codemirror/mode/smalltalk/smalltalk"
|
|
|
+//>>excludeEnd("imports");
|
|
|
+, "amber_core/Kernel-Objects", "helios/Helios-Core"], function($boot
|
|
|
+//>>excludeStart("imports", pragmas.excludeImports);
|
|
|
+,codeMirrorLib
|
|
|
+//>>excludeEnd("imports");
|
|
|
+){"use strict";
|
|
|
if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
|
|
|
var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
|
|
|
var $pkg = $core.addPackage("Helios-Workspace");
|
|
|
$pkg.innerEval = function (expr) { return eval(expr); };
|
|
|
+$pkg.imports = ["codeMirrorLib=codemirror/lib/codemirror", "codemirror/addon/hint/show-hint", "codemirror/mode/smalltalk/smalltalk"];
|
|
|
$pkg.transport = {"type":"amd","amdNamespace":"helios"};
|
|
|
|
|
|
$core.addClass("HLCodeModel", $globals.Object, ["announcer", "environment", "receiver"], "Helios-Workspace");
|
|
@@ -1475,7 +1484,7 @@ var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-$self["@editor"] = $self._class()._codeMirror().fromTextArea(aTextarea, $self._editorOptions());
|
|
|
+$self["@editor"] = codeMirrorLib.fromTextArea(aTextarea, $self._editorOptions());
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea},$globals.HLCodeWidget)});
|
|
@@ -1483,7 +1492,7 @@ return self;
|
|
|
},
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: ["aTextarea"],
|
|
|
-source: "setEditorOn: aTextarea\x0a\x09<inlineJS: '$self[\x22@editor\x22] = $self._class()._codeMirror().fromTextArea(aTextarea, $self._editorOptions())'>",
|
|
|
+source: "setEditorOn: aTextarea\x0a\x09<inlineJS: '$self[\x22@editor\x22] = codeMirrorLib.fromTextArea(aTextarea, $self._editorOptions())'>",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
messageSends: []
|
|
@@ -1606,45 +1615,21 @@ messageSends: ["collect:", "get", "find:", "asJQuery", "wrapper", "display", "ht
|
|
|
$globals.HLCodeWidget);
|
|
|
|
|
|
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "codeMirror",
|
|
|
-protocol: "accessing",
|
|
|
-fn: function (){
|
|
|
-var self=this,$self=this;
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-return $recv(require)._value_("codemirror/lib/codemirror");
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"codeMirror",{},$globals.HLCodeWidget.a$cls)});
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-},
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: [],
|
|
|
-source: "codeMirror\x0a\x09^ require value: 'codemirror/lib/codemirror'",
|
|
|
-referencedClasses: [],
|
|
|
-//>>excludeEnd("ide");
|
|
|
-messageSends: ["value:"]
|
|
|
-}),
|
|
|
-$globals.HLCodeWidget.a$cls);
|
|
|
-
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "hintFor:options:",
|
|
|
protocol: "hints",
|
|
|
fn: function (anEditor,options){
|
|
|
var self=this,$self=this;
|
|
|
-var cursor,token,completions,codeMirror;
|
|
|
+var cursor,token,completions;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
var $1,$4,$3,$2,$5,$6,$8,$9,$7;
|
|
|
-codeMirror=$self._codeMirror();
|
|
|
cursor=$recv(anEditor)._getCursor();
|
|
|
token=$recv(anEditor)._getTokenAt_(cursor);
|
|
|
$1=token;
|
|
|
-$4=$recv(codeMirror)._basicAt_("innerMode");
|
|
|
+$4=$recv(codeMirrorLib)._basicAt_("innerMode");
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
$ctx1.sendIdx["basicAt:"]=1;
|
|
|
//>>excludeEnd("ctx");
|
|
@@ -1661,7 +1646,7 @@ completions=$recv($globals.HLCodeWidget)._variableHintFor_token_(anEditor,token)
|
|
|
completions=$recv($globals.HLCodeWidget)._messageHintFor_token_(anEditor,token);
|
|
|
}
|
|
|
$6=completions;
|
|
|
-$8=$recv(codeMirror)._basicAt_("Pos");
|
|
|
+$8=$recv(codeMirrorLib)._basicAt_("Pos");
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
$ctx1.sendIdx["basicAt:"]=2;
|
|
|
//>>excludeEnd("ctx");
|
|
@@ -1673,17 +1658,17 @@ $7=$recv($8)._value_value_($9,$recv(token)._end());
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
$ctx1.sendIdx["value:value:"]=2;
|
|
|
//>>excludeEnd("ctx");
|
|
|
-return $globals.HashedCollection._newFromPairs_(["list",$6,"from",$7,"to",$recv($recv(codeMirror)._basicAt_("Pos"))._value_value_($recv(cursor)._line(),$recv(token)._start())]);
|
|
|
+return $globals.HashedCollection._newFromPairs_(["list",$6,"from",$7,"to",$recv($recv(codeMirrorLib)._basicAt_("Pos"))._value_value_($recv(cursor)._line(),$recv(token)._start())]);
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"hintFor:options:",{anEditor:anEditor,options:options,cursor:cursor,token:token,completions:completions,codeMirror:codeMirror},$globals.HLCodeWidget.a$cls)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"hintFor:options:",{anEditor:anEditor,options:options,cursor:cursor,token:token,completions:completions},$globals.HLCodeWidget.a$cls)});
|
|
|
//>>excludeEnd("ctx");
|
|
|
},
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: ["anEditor", "options"],
|
|
|
-source: "hintFor: anEditor options: options\x0a\x09| cursor token completions codeMirror |\x0a\x09\x0a\x09codeMirror := self codeMirror.\x0a\x09cursor := anEditor getCursor.\x0a\x09token := anEditor getTokenAt: cursor.\x0a\x09token at: 'state' put: ((codeMirror basicAt: 'innerMode')\x0a\x09\x09value: anEditor getMode value: (token at: 'state')) state.\x0a\x09\x0a\x09completions := token type = 'variable' \x0a\x09\x09ifTrue: [ HLCodeWidget variableHintFor: anEditor token: token ]\x0a\x09\x09ifFalse: [ HLCodeWidget messageHintFor: anEditor token: token ].\x0a\x09\x0a\x09^ #{\x0a\x09\x09'list' -> completions.\x0a\x09\x09'from' -> ((codeMirror basicAt: 'Pos') value: cursor line value: token end).\x0a\x09\x09'to' -> ((codeMirror basicAt: 'Pos') value: cursor line value: token start)\x0a\x09}",
|
|
|
+source: "hintFor: anEditor options: options\x0a\x09| cursor token completions |\x0a\x09\x0a\x09cursor := anEditor getCursor.\x0a\x09token := anEditor getTokenAt: cursor.\x0a\x09token at: 'state' put: ((codeMirrorLib basicAt: 'innerMode')\x0a\x09\x09value: anEditor getMode value: (token at: 'state')) state.\x0a\x09\x0a\x09completions := token type = 'variable' \x0a\x09\x09ifTrue: [ HLCodeWidget variableHintFor: anEditor token: token ]\x0a\x09\x09ifFalse: [ HLCodeWidget messageHintFor: anEditor token: token ].\x0a\x09\x0a\x09^ #{\x0a\x09\x09'list' -> completions.\x0a\x09\x09'from' -> ((codeMirrorLib basicAt: 'Pos') value: cursor line value: token end).\x0a\x09\x09'to' -> ((codeMirrorLib basicAt: 'Pos') value: cursor line value: token start)\x0a\x09}",
|
|
|
referencedClasses: ["HLCodeWidget"],
|
|
|
//>>excludeEnd("ide");
|
|
|
-messageSends: ["codeMirror", "getCursor", "getTokenAt:", "at:put:", "state", "value:value:", "basicAt:", "getMode", "at:", "ifTrue:ifFalse:", "=", "type", "variableHintFor:token:", "messageHintFor:token:", "line", "end", "start"]
|
|
|
+messageSends: ["getCursor", "getTokenAt:", "at:put:", "state", "value:value:", "basicAt:", "getMode", "at:", "ifTrue:ifFalse:", "=", "type", "variableHintFor:token:", "messageHintFor:token:", "line", "end", "start"]
|
|
|
}),
|
|
|
$globals.HLCodeWidget.a$cls);
|
|
|
|
|
@@ -1819,10 +1804,9 @@ var self=this,$self=this;
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
|
|
|
- var codeMirror = $self._codeMirror();
|
|
|
- codeMirror.keyMap["default"].fallthrough = ["basic"];
|
|
|
- codeMirror.commands.autocomplete = function(cm) {
|
|
|
- codeMirror.showHint(cm, $self._hintFor_options_.bind($self));
|
|
|
+ codeMirrorLib.keyMap["default"].fallthrough = ["basic"];
|
|
|
+ codeMirrorLib.commands.autocomplete = function(cm) {
|
|
|
+ codeMirrorLib.showHint(cm, $self._hintFor_options_.bind($self));
|
|
|
}
|
|
|
;
|
|
|
return self;
|
|
@@ -1832,7 +1816,7 @@ return self;
|
|
|
},
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: [],
|
|
|
-source: "setupCodeMirror\x0a\x09<inlineJS: '\x0a\x09\x09var codeMirror = $self._codeMirror();\x0a\x09\x09codeMirror.keyMap[\x22default\x22].fallthrough = [\x22basic\x22];\x0a\x09\x09codeMirror.commands.autocomplete = function(cm) {\x0a\x09\x09\x09codeMirror.showHint(cm, $self._hintFor_options_.bind($self));\x0a\x09\x09}\x0a\x09'>",
|
|
|
+source: "setupCodeMirror\x0a\x09<inlineJS: '\x0a\x09\x09codeMirrorLib.keyMap[\x22default\x22].fallthrough = [\x22basic\x22];\x0a\x09\x09codeMirrorLib.commands.autocomplete = function(cm) {\x0a\x09\x09\x09codeMirrorLib.showHint(cm, $self._hintFor_options_.bind($self));\x0a\x09\x09}\x0a\x09'>",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
messageSends: []
|
|
@@ -1849,7 +1833,7 @@ var self=this,$self=this;
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
var $1,$2,$3,$4,$5;
|
|
|
-$1=$recv($self._codeMirror())._basicAt_("commands");
|
|
|
+$1=$recv(codeMirrorLib)._basicAt_("commands");
|
|
|
$recv($1)._at_put_("doIt",(function(cm){
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx2) {
|
|
@@ -1930,10 +1914,10 @@ return self;
|
|
|
},
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: [],
|
|
|
-source: "setupCommands\x0a\x09(self codeMirror basicAt: 'commands') \x0a\x09\x09at: 'doIt' put: [ :cm | cm amberCodeWidget doIt ];\x0a\x09\x09at: 'inspectIt' put: [ :cm | cm amberCodeWidget inspectIt ];\x0a\x09\x09at: 'printIt' put: [ :cm | cm amberCodeWidget printIt ];\x0a\x09\x09at: 'saveIt' put: [ :cm | cm amberCodeWidget saveIt ];\x0a\x09\x09at: 'browseIt' put: [ :cm | cm amberCodeWidget browseIt ]",
|
|
|
+source: "setupCommands\x0a\x09(codeMirrorLib basicAt: 'commands') \x0a\x09\x09at: 'doIt' put: [ :cm | cm amberCodeWidget doIt ];\x0a\x09\x09at: 'inspectIt' put: [ :cm | cm amberCodeWidget inspectIt ];\x0a\x09\x09at: 'printIt' put: [ :cm | cm amberCodeWidget printIt ];\x0a\x09\x09at: 'saveIt' put: [ :cm | cm amberCodeWidget saveIt ];\x0a\x09\x09at: 'browseIt' put: [ :cm | cm amberCodeWidget browseIt ]",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
-messageSends: ["at:put:", "basicAt:", "codeMirror", "doIt", "amberCodeWidget", "inspectIt", "printIt", "saveIt", "browseIt"]
|
|
|
+messageSends: ["at:put:", "basicAt:", "doIt", "amberCodeWidget", "inspectIt", "printIt", "saveIt", "browseIt"]
|
|
|
}),
|
|
|
$globals.HLCodeWidget.a$cls);
|
|
|
|
|
@@ -1946,7 +1930,7 @@ var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-$self._codeMirror().keyMap["Amber"] = $self._keyMap();
|
|
|
+codeMirrorLib.keyMap["Amber"] = $self._keyMap();
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{},$globals.HLCodeWidget.a$cls)});
|
|
@@ -1954,7 +1938,7 @@ return self;
|
|
|
},
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: [],
|
|
|
-source: "setupKeyMaps\x0a\x09<inlineJS: '$self._codeMirror().keyMap[\x22Amber\x22] = $self._keyMap()'>",
|
|
|
+source: "setupKeyMaps\x0a\x09<inlineJS: 'codeMirrorLib.keyMap[\x22Amber\x22] = $self._keyMap()'>",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
messageSends: []
|