module.exports is not matched
The following function is not matched:
module.exports = function sum (a, b) {
return a + b
}
I've done a rule to match that case as a function, but don't know if you didn't want to support on purpose since this is also the case for export default function name1(…) { … } as you pointed out on issue https://github.com/romainl/ctags-patterns-for-javascript/issues/7.
Wouldn't make sense to create an default export tag type and put them together on that new tag type? What do you think?
(We could try to create a rule only for default named exports with body definition once the ones that doesn't have definition would be already taken by another rules)
This could be an extension of the function rules, I think. Something like:
--regex-javascript=/^[ \t]*module\.exports[ \t]*=[ \t]*function[ \t]\{1,\}\([a-z][A-Za-z0-9_$]\{1,\}\)/\1/F,Function,Functions/b
nice! I think this could work. Any plans to update the master branch?
I don't think I'll be able to do it in the short term. Could you give it a try on your side?
So I added the following to the bottom of my ~/.ctags file as @romainl recommended, right after the options file import, so my ~/.ctags looks like:
➜ cat ~/.ctags
--exclude=.git
--exclude=.hg
--exclude=log
--exclude=tmp
--exclude=node_modules
--exclude=gulp
--options=/Users/maj/src/dotfiles/ctags-patterns-for-javascript/ctagsrc
--regex-javascript=/^[ \t]*module\.exports[ \t]*=[ \t]*function[ \t]\{1,\}\([a-z][A-Za-z0-9_$]\{1,\}\)/\1/F,Function,Functions/b
... and can confirm it works well! This was the one thing missing for me to have full tag support, as far as I can tell, for JS in my vim. Thanks! I'll send a PR to add to the file in case that's helpful.
Thanks for this - tossing in another possible scenario for the module.exports:
exports = module.exports = /*<function or object>*/;
LMK if there's anything I can do