Skip to content

Instantly share code, notes, and snippets.

@magarcia
Created October 20, 2015 09:19
Show Gist options
  • Save magarcia/5c39e8040232c9e086e7 to your computer and use it in GitHub Desktop.
Save magarcia/5c39e8040232c9e086e7 to your computer and use it in GitHub Desktop.
JsDoc support for CoffeeScript
"" JSDoc / JSDoc Toolkit
if !exists("coffeescript_ignore_javaScriptdoc")
syntax case ignore
syntax region coffeeBlockComment matchgroup=coffeeComment start="###*" end="###" contains=coffeeDocTags,coffeeTodo,@Spell fold
" tags containing a param
syntax match coffeeDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|file\|fires\|kind\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\|ngdoc\|scope\|priority\|animations\|restrict\|methodOf\|propertyOf\|eventOf\|eventType\|platform\)\>" nextgroup=coffeeDocParam skipwhite
" tags containing type and param
syntax match coffeeDocTags contained "@\(arg\|argument\|param\|property\|prop\|methodOf\|propertyOf\|eventOf\|eventType\)\>" nextgroup=coffeeDocType skipwhite
" tags containing type but no param
syntax match coffeeDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" nextgroup=coffeeDocTypeNoParam skipwhite
" tags containing references
syntax match coffeeDocTags contained "@\(lends\|see\|tutorial\)\>" nextgroup=coffeeDocSeeTag skipwhite
" other tags (no extra syntax)
syntax match coffeeDocTags contained "@\(abstract\|access\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
syntax region coffeeDocType start="{" end="}" oneline contained nextgroup=coffeeDocParam skipwhite
syntax match coffeeDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" nextgroup=coffeeDocParam skipwhite
syntax region coffeeDocTypeNoParam start="{" end="}" oneline contained
syntax match coffeeDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
syntax match coffeeDocParam contained "\%(#\|\"\|{\|}\|\w\|\.\|:\|\/\|\[\|]\|=\)\+"
syntax region coffeeDocSeeTag contained matchgroup=coffeeDocSeeTag start="{" end="}" contains=coffeeDocTags
syntax case match
endif "" JSDoc end
if version >= 508 || !exists("did_coffeescript_syn_inits")
if version < 508
let did_javascript_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink coffeeDocTags Special
HiLink coffeeDocSeeTag Function
HiLink coffeeDocType Type
HiLink coffeeDocTypeNoParam Type
HiLink coffeeDocParam Label
delcommand HiLink
endif
@magarcia
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment