mikaeljorhult / brackets-todo

Brackets/Edge Code extension that displays all TODO comments in current document or project.
144 stars 37 forks source link

Toggle expanded state of file AND Toggle visibility of tag - Not working #137

Closed Ndot closed 7 years ago

Ndot commented 7 years ago

For some reason when trying to use visibility tag and expand files the following error is thrown: Uncaught TypeError: Object [object Array] has no method 'find'

Which is weird because 'tags' and 'files' are arrays...

Solution

File: /modules/Tags.js Lile: 72 - 74 Change to:

var tag, i = tags.length - 1;  
    for (i; i > -1; i -= 1) {
        if (tags[i].key === key) { tag = tags[i]; }
    }

File: /modules/Files.js Line: 180 - 182 Change to:

var file, i = files.length - 1;
    for (i; i > -1; i -= 1) {
        if (files[i].key === key) { file = files[i]; }
    }
mikaeljorhult commented 7 years ago

Which platform and which version of Brackets are you using? I'm not able to reproduce this on my machine so could list the steps to reproduce the error?

blueorange589 commented 7 years ago

yes, I get these errors too Ubuntu 14.04 - Brackets 1.9.0-17312

Ndot commented 7 years ago

Hi, I'm on Kubuntu 16.04 - Brackets build 1.9.0-17312

The error is thrown when clicking on tags to show/hide, and clicking on files to open/close the task list.

I also had the same problem mentioned on issue #136 changing the keyword let to var on line 36 and 52 did the trick.

I don't see anything wrong with the code in the extension. I just looked at the specification and let, Array.prototype.find() and Array.prototype.findIndex() also mentioned on issue #136 were added in ECMAScript 2015 (ES6).

So I guess the CEF in the Brackets packages for Linux is outdated. These workarounds will just have to do until the CEF is updated for those of us in Linux distros.

By the way nice extension :smiley:

mikaeljorhult commented 7 years ago

Yes, you're right. The Linux version of Brackets seems to be a bit behind the macOS one so I've released a new version that uses lodash methods instead.

It seems to resolve the issue when testing on a virtual machine with Ubuntu so I hope it will work for you as well. Thank you for helping me resolve this!

Ndot commented 7 years ago

Nice, lodash solved it. Thanks.