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.
# To use, place it in a ~/.ctags file.
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/(^|=[ \t])*class ([A-Za-z.]+)( extends [A-Za-z.]+)?$/\2/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/
@rosenfeld

This comment has been minimized.

Copy link

commented Apr 17, 2012

You can also declare a class like this:

(export ? window).MyClass = class MyClass
constructor: ...

I mean, it doesn't need to start with "class":

https://gist.github.com/2405554

@AndrewRadev

This comment has been minimized.

Copy link
Owner Author

commented Apr 17, 2012

You're right :). I don't use classes much, so I guess I never took a good look at this particular regex. Thanks.

@rosenfeld

This comment has been minimized.

Copy link

commented Apr 17, 2012

No problem, we're all trying to get ctags properly set up for CoffeeScript ;)

@yury

This comment has been minimized.

Copy link

commented May 6, 2012

Maybe it is better to take last part from class definition? https://gist.github.com/2624883

class GS.Views.Campaign extends Backbone.View
   ....

I want just Campaign in my autocompletion list instead of GS.Views.Campaign. In fact, I can't autocomplete classes with dots in sublime %(

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.