Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ctags definitions for coffeescript. Detects classes, static/class methods, plain functions and variables.
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/(^|=[ \t])*class ([A-Za-z]+\.)*([A-Za-z]+)( extends [A-Za-z.]+)?$/\3/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?([A-Za-z.]+):.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
@edubkendo

This comment has been minimized.

Copy link

edubkendo commented Jun 9, 2012

This gets much closer than the last one I tried, doesn't seem to get @variables though. If I knew enough about regex and/or my brain wasn't frazzled from being determined to make this work for the last six hours, I'd attempt to make the adjustment myself. Might look at it later.

@bjornharrtell

This comment has been minimized.

Copy link

bjornharrtell commented Jun 9, 2012

Very usable already but would love to get the @vars of course... regexp also hurts my brain though :(

One caveat when using with gedit and gedit-source-code-browser is that you can't have the # comments in the .ctags file..

@edubkendo

This comment has been minimized.

Copy link

edubkendo commented Jun 9, 2012

@bjornharrtell et all, adding this line at the end will catch some, but unfortunately not all, of the @variables:

--regex-coffee=/^[ \t]*(@[A-Za-z]+)[ \t]*=.*$/\1/i,ivar/
@bjornharrtell

This comment has been minimized.

Copy link

bjornharrtell commented Jun 9, 2012

Hmm doesn't work for me. What does work for me in initial tests is several patterns and repeating one for multiple definitions passed in constructor... check out https://gist.github.com/2901844

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.