Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some function symbols do not appear #5

Open
wshito opened this issue Nov 13, 2017 · 5 comments
Open

Some function symbols do not appear #5

wshito opened this issue Nov 13, 2017 · 5 comments

Comments

@wshito
Copy link

wshito commented Nov 13, 2017

Thanks for the great tool! I like the tree view of your package. However, I found some functions not being recognized by the package.

The symbols in the screen shot are sorted as it appears in the source. At the bottom in the navigator, there shows changeAnchorPart(arg_map). However, the source has five more functions after that. You can see in the screenshot that setJqueryMap() and toggleChat() are not displayed in the navigator.

The Atom version I use is 1.22.0 x64 on Mac.
The Symbols navigator's version is 1.0.1.
The UTF-8 JavaScript source: spa.shell.txt

screenshot

@lejsue
Copy link
Owner

lejsue commented Nov 17, 2017

Hi wshito,

Sorry for my late reply, I'm working on company's project and not to have much time for here.
But I think I'll be available next month, and can pay more attention on this package.

Currently, this package is using universal-ctags (https://github.com/universal-ctags/ctags) to analyze all tags for functions, variables, classes, etc. And it seems that the native setting of universal-ctags is not enough, some tags will be missing. Maybe add a customized setting for universal-ctgas will solve it, but I haven't tested this. I'll try it next month!

Thanks for your report! And sorry for the inconvenience of missing tags!

@lejsue
Copy link
Owner

lejsue commented Dec 13, 2017

Hi wshito,

I added this into .ctags file which is in lib folder, then I can see other functions.
--regex-JavaScript=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]*\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\5/,function/
But unfortunately, their scope are not correct. they should belong to spa.shell().
I'm still figuring out the solution.

@Martinsos
Copy link

Related to this, I was wondering if you support arrow functions, for example const foo = () => {}?
I was also looking at official atom/symbols-view#215 and they have not handled it yet it seems -> if you have it working that would be great.

@lejsue
Copy link
Owner

lejsue commented Feb 1, 2018

Hi Martinsos,

Yes, the official symbols-view is using ctags to do tag/symbol analysis, and not support modern Javascript.

In my package, I'm using universal-ctags, but it seems not well support arrow functions. Let me check if there is any update for this.

@nickcombs32
Copy link

nickcombs32 commented Jul 3, 2019

Hi lejsue,
The regex above needs an asterisk for the given capture group in order to match function declarations (as opposed to function expressions):

(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]*\.)*))
>
(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]*\.)*))*

However, I feel like I'm missing something because only one of my function declarations needed this fix while the others matched either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants