Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1876 from ajaxorg/fix/outline-edge-cases

Fix/outline edge cases
  • Loading branch information...
commit a9f1f11a05d2c8482b7f4a644c884f0e6a0c3069 2 parents 203d048 + dff4a4f
@nightwing nightwing authored
View
4 plugins-client/ext.jslanguage/outline.js
@@ -179,7 +179,7 @@ function extractOutline(doc, node) {
return false;
results.push({
icon: 'event',
- name: eventHandler.s[0].value + fargsToString(eventHandler.fargs),
+ name: eventHandler.s[0].value,
pos: this.getPos(),
displayPos: fixStringPos(doc, eventHandler.s),
items: extractOutline(doc, eventHandler.body)
@@ -257,6 +257,6 @@ var tryExtractEventHandler = outlineHandler.tryExtractEventHandler = function(no
};
});
return result;
-}
+};
});
View
28 plugins-client/ext.language/outline.js
@@ -168,7 +168,8 @@ module.exports = {
this.$originalLine = cursor.row + 1;
this.$originalColumn = cursor.column;
- var selected = this.renderOutline(event.data.showNow);
+ // var selected = this.renderOutline(event.data.showNow);
+ this.renderOutline(event.data.showNow);
if (txtGoToFile.value.match(/^@/))
this.showOutline();
@@ -269,7 +270,7 @@ module.exports = {
},
onSelect: function(el) {
- if (gotofile.eventsEnabled)
+ if (gotofile.eventsEnabled || !el)
return;
if (this.ignoreSelectOnce) {
@@ -291,7 +292,7 @@ module.exports = {
if (lineVisibleStart <= line && lineEnd <= lineVisibleStart + linesVisible)
return;
var SAFETY = 1.5;
- editor.scrollToLine(Math.round((line + lineEnd) / 2 - SAFETY), true)
+ editor.scrollToLine(Math.round((line + lineEnd) / 2 - SAFETY), true);
},
onKeyDown: function(e) {
@@ -342,27 +343,6 @@ module.exports = {
}
},
- getNodeAfter: function(node) {
- if (node.childNodes[1] && treeOutline.isCollapsed(node.childNodes[1])) {
- return node.childNodes[1];
- } else {
- while (!node.nextSibling && node.parentNode)
- node = node.parentNode;
- return node.nextSibling;
- }
- },
-
- getNodeBefore: function(node) {
- if (node.previousSibling && node.previousSibling.attributes) {
- node = node.previousSibling;
- while (node.childNodes[1] && treeOutline.isCollapsed(node.childNodes[1]))
- node = node.childNodes[1];
- return node;
- } else {
- return node.parentNode == treeOutline.root ? null : node.parentNode;
- }
- },
-
onAfterChange: function(event) {
if (txtGoToFile.value.match(/^@/)) {
this.updateOutline();
View
6 plugins-client/ext.language/worker.js
@@ -221,12 +221,14 @@ function asyncParForEach(array, fn, callback) {
this.outline = function(event) {
var _self = this;
+ var foundHandler = false;
this.parse(function(ast) {
asyncForEach(_self.handlers, function(handler, next) {
if (handler.handlesLanguage(_self.$language)) {
handler.outline(_self.doc, ast, function(outline) {
if (outline) {
- outline.ignoreFilter = event.data. ignoreFilter;
+ foundHandler = true;
+ outline.ignoreFilter = event.data.ignoreFilter;
return _self.sender.emit("outline", outline);
}
else {
@@ -239,6 +241,8 @@ function asyncParForEach(array, fn, callback) {
}, function() {
});
}, true);
+ if (!foundHandler)
+ this.sender.emit("outline", { body: [] });
};
this.scheduleEmit = function(messageType, data) {
Please sign in to comment.
Something went wrong with that request. Please try again.