Hirse / brackets-outline-list

Extension for Brackets and Phoenix to display a list of the functions or definitions in the currently opened document.
MIT License
79 stars 30 forks source link

ES6 Support #28

Closed ariririos closed 8 years ago

ariririos commented 9 years ago

The title is self explanatory. I understand that you're using regex to determine if a string is a function declaration, and the semantics of arrow functions introduce a high level of complexity, but browsers and JS environments are already starting to support arrow functions natively, so this extension should keep up with that.

ariririos commented 9 years ago

Thank you for this. Testing it now.

Hirse commented 9 years ago

I didn't upload it to the extension registry yet, so you have to install from GitHub directly. Let me know if I missed anything. :wink:

ariririos commented 9 years ago

@Hirse It works properly for everything I've tried except for functions that are properties of objects. It shows the property name with the function keyword, but only shows function() when using an arrow function. But that's probably too much of an edge case considering the new syntax for object methods (which isn't supported, by the way).

Hirse commented 9 years ago

The (basic) examples I looked at didn't feature these edge cases, but I am still willing to extend the support if possible. Could you post a code snippet here that contains the mentioned syntax features? That would make it easier for me to test.

Also reopening this issue until I added more.

ariririos commented 9 years ago

This code has different behaviors for all three methods:

let obj = {
  one: function() {}, //-> one()
  two: () => {}, //-> function()
  three() {} //-> doesn't show up at all
};

Great work by the way, thanks!

ariririos commented 9 years ago

@Hirse By supporting the last case, it seems that you could also support methods on classes, but I'm not sure if you'd want those to show up also.

Jonatthu commented 9 years ago

How can I get this ES6 support?

Hirse commented 9 years ago

As I didn't finish all cases, it is not released yet. You can install the current state by installing the extension from GitHub directly. Follow the instruction on the readme under installation.