revert changes to worker
This commit is contained in:
parent
5c1db2dbcc
commit
dc198344d5
7 changed files with 186 additions and 196 deletions
|
|
@ -46,7 +46,6 @@ var Search = require("./search").Search;
|
|||
var Range = require("./range").Range;
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
var CommandManager = require("./commands/command_manager").CommandManager;
|
||||
var Autocomplete = require("./autocomplete").Autocomplete;
|
||||
var defaultCommands = require("./commands/default_commands").commands;
|
||||
var config = require("./config");
|
||||
|
||||
|
|
@ -90,7 +89,6 @@ var Editor = function(renderer, session) {
|
|||
});
|
||||
|
||||
this.setSession(session || new EditSession(""));
|
||||
Autocomplete.addTo(this);
|
||||
config.resetOptions(this);
|
||||
config._emit("editor", this);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
var Mode = function() {
|
||||
var highlighter = new GolangHighlightRules();
|
||||
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$keywordList = highlighter.$keywordList;
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
(function() {
|
||||
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
|
|
@ -52,7 +52,7 @@ define(function(require, exports, module) {
|
|||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,21 +30,21 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("../mode/text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("../mode/text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
var Mode = function() {
|
||||
var highlighter = new PgsqlHighlightRules();
|
||||
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$keywordList = highlighter.$keywordList;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
(function() {
|
||||
this.lineCommentStart = "--";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ define(function(require, exports, module) {
|
|||
}
|
||||
}
|
||||
|
||||
}).call(Mode.prototype);
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,14 +7,12 @@ var lang = require("../lib/lang");
|
|||
var Mirror = exports.Mirror = function(sender) {
|
||||
this.sender = sender;
|
||||
var doc = this.doc = new Document("");
|
||||
this.data = {};
|
||||
|
||||
var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
|
||||
|
||||
var _self = this;
|
||||
sender.on("change", function(e) {
|
||||
doc.applyDeltas(e.data);
|
||||
if (_self.$defer)
|
||||
deferredUpdate.schedule(_self.$timeout);
|
||||
});
|
||||
};
|
||||
|
|
@ -22,19 +20,13 @@ var Mirror = exports.Mirror = function(sender) {
|
|||
(function() {
|
||||
|
||||
this.$timeout = 500;
|
||||
this.$defer = true;
|
||||
|
||||
this.setTimeout = function(timeout) {
|
||||
this.$timeout = timeout;
|
||||
};
|
||||
|
||||
this.setDeferredUpdate = function(defer) {
|
||||
this.$defer = defer;
|
||||
};
|
||||
|
||||
this.setValue = function(value, data) {
|
||||
this.setValue = function(value) {
|
||||
this.doc.setValue(value);
|
||||
this.data = data;
|
||||
this.deferredUpdate.schedule(this.$timeout);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -144,12 +144,12 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) {
|
|||
catch(ex) {}
|
||||
};
|
||||
|
||||
this.attachToDocument = function(doc, data, ignore) {
|
||||
if (this.$doc && !ignore)
|
||||
this.attachToDocument = function(doc) {
|
||||
if(this.$doc)
|
||||
this.terminate();
|
||||
|
||||
this.$doc = doc;
|
||||
this.call("setValue", [doc.getValue(), data]);
|
||||
this.call("setValue", [doc.getValue()]);
|
||||
doc.on("change", this.changeListener);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue