atg / chocolat-public

Public bug tracker for the private chocolat project
http://chocolatapp.com
180 stars 4 forks source link

Symbol List does not see stuff build in anonymous functions... #1452

Open tonioloewald opened 10 years ago

tonioloewald commented 10 years ago

Which is problematic since that's how a lot of class libraries are set up, e.g.

(function($){ $.fn.foo = function(){}; }(jQuery));

function bar(){}

foo is not seen, bar is.

sergioramos commented 10 years ago

That would be great, but we can't do that right now because symbol list is based on tern (https://github.com/fileability/ternproxy/blob/master/src/proxy/symbols.js) which only reports top-scope symbols :/

sergioramos commented 10 years ago

related: https://twitter.com/marijnjh/status/383117186174181376

tonioloewald commented 10 years ago

Well it's a pretty fatal shortcoming since most of the module systems out there wrap symbols this way — so it's only going to work for very naive code.

It's not like this code you're using is worth a damn — it also incorrectly identifies symbols in comments. (Our documentation system will execute examples and tests embedded in multiline comments. Chocolat finds THOSE symbols but misses the ones in the actual code.) So any kind of halfway decent regexp would do a better job!

e.g. something like:

function\s(\w+)\s(|\s(\w+)\s_=\s_function

on its own would be more useful than what you've got. (Add a similar expression to grab inline object declarations and you're pretty much golden.)

sergioramos commented 10 years ago

Unfortunately that's not as simple as it looks. Symbol list also reports structure.

Look at https://github.com/mozilla/doctorjs for an example of a javascript ctags reporter.

tonioloewald commented 10 years ago

It's erroneously finding structure in comments.

On Thursday, December 5, 2013, Sérgio Ramos wrote:

Unfortunately that's not as simple as it looks. Symbol list also reports structure.

Look at https://github.com/mozilla/doctorjs for an example of a javascript ctags reporter.

— Reply to this email directly or view it on GitHubhttps://github.com/fileability/chocolat-public/issues/1452#issuecomment-29936974 .

Tonio Loewald | p: (703) 624 9875 | web: loewald.com