lukaszkorecki / coffeetags Goto Github PK
View Code? Open in Web Editor NEWCtags-like tag generator for CoffeeScript
Ctags-like tag generator for CoffeeScript
tagbars api changed new code showld look like this
if executable('coffeetags')
let g:tagbar_type_coffee = {
\ 'ctagsbin' : 'coffeetags',
\ 'ctagsargs' : ' --include-vars ',
" this is where things changed
\ 'kinds' : [
\ 'f:functions:0',
\ 'o:objecs:1',
\ ],
\ 'sro' : ".",
\ 'kind2scope' : {
\ 'f' : 'functions',
\ 'o' : 'objecs',
\ }
\ }
endif
/usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/CoffeeTags-0.0.2.4/lib/CoffeeTags/parser.rb:37:in block in mark_commented_lines': undefined method
each_with_index' for #String:0x007fddf282abe0 (NoMethodError)
^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/CoffeeTags-0.0.2.4/lib/CoffeeTags/parser.rb:35:in tap' ^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/CoffeeTags-0.0.2.4/lib/CoffeeTags/parser.rb:35:in
mark_commented_lines'
^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/CoffeeTags-0.0.2.4/lib/CoffeeTags/parser.rb:27:in initialize' ^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/CoffeeTags-0.0.2.4/lib/CoffeeTags.rb:108:in
new'
^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/CoffeeTags-0.0.2.4/lib/CoffeeTags.rb:108:in block in run' ^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/CoffeeTags-0.0.2.4/lib/CoffeeTags.rb:106:in
each'
^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/CoffeeTags-0.0.2.4/lib/CoffeeTags.rb:106:in run' ^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/CoffeeTags-0.0.2.4/bin/coffeetags:7:in
<top (required)>'
^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/bin/coffeetags:19:in load' ^Ifrom /usr/local/Cellar/ruby/1.9.3-p125/bin/coffeetags:19:in
Hey!
Thanks for CoffeeTags. It's really cool. Just one little thing that prevents it from working with our codebase:
We' re using the @classname notation to make classes declared in one .coffee file visible to other files (in a Browser/Frontend context), for example:
class @Controller
constructor: ->
@pool=DataPool.getInstance()
@initUser()
initUser: =>
# fetch the current user
@user = @pool.currentUser()
this will make the Controller class assigned to window.Controller.
CoffeeTags doesn't seem to recognize this syntax. Instead, in TagBar, I see a "window" object directly containing the methods of the class as functions, without a mention of the actual class name. Like:
window* : object
constructor : function
initUser : function
I'd expect:
Controller : class
constructor : function
...
Would that be possible?
Thanks!
*dir* = fs.readdirSync __dirname
f = _dir_ + '/foo'
Pressing <C-]>
on the underscore'd _dir_
would jump to the starred *dir*
for *f* in dir
do (f) ->
console.log _f_
Pressing <C-]>
on the underscore'd _f_
would jump to the starred *f*
First of all, thank you for this plugin! However, how do I make this work with *.litcoffee files?
If I have a class with 'class methods', i.e.:
class A
@compileXml: (codeXml) ->
Then the output tag file has the symbol as '@compileXml', when the symbol should be 'compileXml'.
As noted in tagbar issue:
###
This is some text.
More text here.
###
will not work correctly in coffeetags
Hi,
first of all... this plugin is great !!! So bravo !!!
I'm using CoffeeScript with ReactJS.
Is it possible to add the following templates as a "class" ?
module.exports = Edit = React.createClass
But most of the time I'm using this little trick
module.exports = exp = {}
[...]
exp.Edit = Edit = React.createClass
Or can I had it myself somewhere ? Sorry I never used Rails :(
Best regards
It looks like --vim-conf was removed as a feature, but it's referenced by the gist pointed to by the --help text:
CoffeeTags + TagBar + Vim ---> https://gist.github.com/1935512
I'm trying to get tagbar to work (which I successfully use with exuberant ctags) with coffeescript files.
Now that the vim-conf option is gone, I don't know how to set it up as a filetype plugin. The documentation should be updated to not use the old parameter, as well as indicate the correct way to set up a filetype plugin to work with tagbar.
Kinda like defunkt/hub
allows you to get hub as either a gem or standalone, executable script
Awesome project. I really appreciate how well it maps functions and variables.
I would really love if it would also dump out tags for the class names themselves.
E.g.
class Animal
constructor: (@name) ->
move: (meters) ->
alert @name + " moved #{meters}m."
Currently spits out tags for constructor and move. If it also spat out a tag for Animal, then I could jump to Animal from another file that references the Animal class.
Would you consider adding this? Or am I missing an existing option that triggers this behavior?
Hi, thanks for a great plugin!
While everything works as intended in Tagbar, no tags show up in plugins like ctrlp or unite. I was under the impression that these plugins share the same tag indexes, but maybe I'm wrong?
Trying to use this in emacs, but I get an 'is not a valid tags table' error, any clues?
The exuberant ctags format is probably what's needed.
e.g MyApp.MyClass = Ember.View.extend
...and stop reinventing the wheel
move
of Animal
is captured but that of Snake
and Horse
are not captured. Is this expected bahvior?
This is part of test cases of universal-ctags(http://ctags.io).
Before updating coffeetags installed via gem all move
are captured. Maybe version 0.2.x.
After updating to 0.6.0, I found only move
of Animal
was captured.
[yamato@x201]~/var/ctags-github/Units/main-xcmd.r/xcmd-coffeetags.d% cat input.coffee
# Taken from http://coffeescript.org/
class Animal
constructor: (@name) ->
move: (meters) ->
alert @name + " moved #{meters}m."
class Snake extends Animal
move: ->
alert "Slithering..."
super 5
class Horse extends Animal
move: ->
alert "Galloping..."
super 45
[yamato@x201]~/var/ctags-github/Units/main-xcmd.r/xcmd-coffeetags.d% coffeetags -f - input.coffee
!_TAG_FILE_FORMAT 2 /extended format/
!_TAG_FILE_SORTED 0 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /[email protected]/
!_TAG_PROGRAM_NAME CoffeeTags //
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
!_TAG_PROGRAM_VERSION 0.6.0 //
Animal input.coffee /^class Animal$/;" c line:3 language:coffee
Horse input.coffee /^class Horse extends Animal$/;" c line:14 language:coffee
Snake input.coffee /^class Snake extends Animal$/;" c line:9 language:coffee
constructor input.coffee /^ constructor: (@name) ->$/;" p line:4 language:coffee object:Animal
move input.coffee /^ move: (meters) ->$/;" p line:6 language:coffee object:Animal
Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.
spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']
There is even a License Finder to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.
How did I find you?
I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for missing ones as a public service :)
https://gist.github.com/bf4/5952053#file-license_issue-rb-L13 So far it's going pretty well
hello i em trying to do this and it wont work
when i check if g:tagbar_type_coffee is set, it is
but it wont display any tags ... i ultimately plan to add this code
snipped as a ftplugin ... i have already done so for lushtags
another tagbarplugin and it worked then
au FileType coffee call coffeetags ()
function! coffeetags ()
" Add this type definition to your vimrc
" or do
" coffeetags --vim-conf >> <PATH TO YOUR VIMRC>
" if you want your tags to include vars/objects do:
" coffeetags --vim-conf --include-vars
if executable('lushtags')
let g:tagbar_type_coffee = {
\ 'ctagsbin' : 'coffeetags',
\ 'ctagsargs' : ' --include-vars ',
\ 'kinds' : [
\ 'f:functions',
\ 'o:object'
\ ],
\ 'sro' : ".",
\ 'kind2scope' : {
\ 'f' : 'object',
\ 'o' : 'object'
\ },
\ }
endif
endfunction
=>
is a valid function indicator as well
parser.rb : L61, change the regex to accept fat rockets:
if not token.nil? and line =~ /(:?-|=)\>/
hacking that in on my system causes it to discover more functions.
I've noticed that CoffeeTags has been adding a lot of things as tags where it shouldn't. For example, it's reading any line that starts with document
, such as
document.getElementById('arrow')
and marking it as a do
block.
Something similar is happening with classes. Every time that I use a method name that has a capital letter in it, CoffeeTags tries to make a new class out of it. So this line
object.classList.add 'class-name'
Will make List.add
as a class.
I try with lastest tagbar and
ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
tagbar produce empty window, sad
I would like to see CoffeeTags in action but unfortunately the link in the readme is currently broken.
This syntax can be seen in 37signals' Pow
module.export = class Configuration
this isn't correctly parsed by coffeetags
I used coffeetags with vim in Win8.1. I found coffeetags will crash when I turn on Tagbar.
Docs pretty much don't exist, it could be useful to document the code here and there
When using the vim plugin in windows I get the error ruby.exe No such file or directory -- <workdir>/coffeetags (LoadError)
Full :mess
Executed command: ""coffeetags" "C:\Users\ksh\AppData\Local\Temp\VIA8C2F.tmp.coffee""
Command output:
ruby.exe: No such file or directory -- Z:/workfolder/coffeetags (LoadError)
tagbars api changed new code showld look like this
if executable('coffeetags')
let g:tagbar_type_coffee = {
\ 'ctagsbin' : 'coffeetags',
\ 'ctagsargs' : ' --include-vars ',
" this is where things changed
\ 'kinds' : [
\ 'f:functions:0',
\ 'o:objecs:1',
\ ],
\ 'sro' : ".",
\ 'kind2scope' : {
\ 'f' : 'functions',
\ 'o' : 'objecs',
\ }
\ }
endif
The following file generates the following CTAG output only for the function foo, not bar.
foo = -> console.log 'hello, world'
### comment here. ###
bar = -> console.log 'hello, world'
Output:
!_TAG_FILE_FORMAT 2 /extended format/
!_TAG_FILE_SORTED 0 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /[email protected]/
!_TAG_PROGRAM_NAME CoffeeTags //
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
!_TAG_PROGRAM_VERSION 0.0.2.6 //
foo test.coffee /foo/;" f lineno:1 object:window type:function
However, if the multiline comment is splited into multiple lines, such as
###
comment here.
###
The correct output is generated
!_TAG_FILE_FORMAT 2 /extended format/
!_TAG_FILE_SORTED 0 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /[email protected]/
!_TAG_PROGRAM_NAME CoffeeTags //
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
!_TAG_PROGRAM_VERSION 0.0.2.6 //
foo test.coffee /foo/;" f lineno:1 object:window type:function
bar test.coffee /bar/;" f lineno:5 object:window type:function
coffeetags -R -f tags
fails with an error "invalid byte sequence in US-ASCII" in my osx 10.9.5.
Users/codeout/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CoffeeTags-0.5.0/lib/CoffeeTags/parser.rb:44:in `=~': invalid byte sequence in US-ASCII (ArgumentError)
(I've tried ruby 1.9.3-p545, 2.0.0-p481 and 2.1.2)
Can we suppose that *.coffee are in US-ASCII while creating tags?
I'm not familiar with tags specs really but I guess keywords of CoffeeScript should be US-ASCII.
Some of specs also failed with the same error as below:
1) Coffeetags::Utils Complete output appends tags for given file
Failure/Error: Coffeetags::Utils.run({ :output => 'test.out', :files => ['spec/fixtures/campfire.coffee'], :append => true })
ArgumentError:
invalid byte sequence in US-ASCII
# ./lib/CoffeeTags.rb:143:in `block in setup_tag_lines'
# ./lib/CoffeeTags.rb:143:in `reject'
# ./lib/CoffeeTags.rb:143:in `setup_tag_lines'
# ./lib/CoffeeTags.rb:100:in `run'
# ./spec/coffeetags_spec.rb:142:in `block (3 levels) in <top (required)>'
coffeetags **/*.coffee -f tags
dumps tags for all coffeescript files to the file specified by -f
flag (similarly to original ctags
)
[maarten@laptop: test]$ echo '# TODO: -> blabla' > test.coffee
[maarten@laptop: test]$ coffeetags -R
!_TAG_FILE_FORMAT 2 /extended format/
!_TAG_FILE_SORTED 0 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /[email protected]/
!_TAG_PROGRAM_NAME CoffeeTags //
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
!_TAG_PROGRAM_VERSION 0.0.1.8 //
TODO ./test.coffee /TODO/;" f lineno:1 object:window type:function
I see classes with a lot of 'TODO' methods showing up in Tagbar :)
CoffeeTags shows the class below as having a constructor and a method called "TODO"
class MyClass
# TODO: -> blabla
constructor: -> console.log 'hello'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.