ctags icon indicating copy to clipboard operation
ctags copied to clipboard

Ruby: supporting Rails (Was: Duplicate kind letters issue, edited by @masatake)

Open chrisarcand opened this issue 9 years ago • 6 comments

Hello! This issue stems from conversation by @masatake in https://github.com/universal-ctags/ctags/issues/1062

I use a plugin that has very odd behavior from Exuberant Ctags to Universal Ctags, and it concerns duplicating kind letters. I try and adhere to the warnings I've recently discovered about using unique letters, and it seems to just not work:

The first one with Exuberant Ctags behaves as I expect.

I know this issue is a little odd because it could be this project or the plugin from which I discovered it: https://github.com/ctrlpvim/ctrlp.vim/issues/331 (please read this issue). However, I'm pretty stuck and don't really know how to debug further as to which project is causing the issue.

cc/ @tacahiroy

chrisarcand avatar Dec 05 '16 18:12 chrisarcand

$ ./ctags --list-kinds=Ruby
c  classes
f  methods
m  modules
F  singleton methods

As the list shows f is for methods. If your regex pattern finds more methods, you should/can use f. However, for capturing another things, use different kind letter. The motto of universal ctags is |using "different name for different thing, client tools can unify them later as own needs".

Do I make sense?

BTW, you should not use whitespace in kind long name. In --regex-<LANG> arg, you can specify/define a kind with 3 components: KIND LETTER,KIND LONG NAME,KIND DESCRIPTION. KIND LONG NAME should not include whitespace. If just extenind existing kind, just specifying KIND LETTER is enough.

masatake avatar Dec 06 '16 00:12 masatake

Can I access your .ctags as a text file? An image doesn't help me.

masatake avatar Dec 06 '16 00:12 masatake

Can I access your .ctags as a text file? An image doesn't help me.

Sure can, here you go: https://github.com/chrisarcand/dotfiles/blob/master/ctags/ctags.symlink

Hmmm it sounds from your assessment that the CtrlP plugin has some issue with capturing other kind letters than aren't method-like. I opened this issue anyway because I can't figure out why it works when using Exuberant Ctags but does not when using Universal Ctags.

I'll continue to look at this and try and narrow it down and confirm which project seems to be causing this issue.

chrisarcand avatar Dec 06 '16 15:12 chrisarcand

I don't know vim and the other user interface utilizing tags file. However, I wonder how ctags can serve your job.

I have implemented subparser infrastructure. With the new infrastructure, we can write RubyOnRails4 subparser which runs on Ruby base parser. These two parsers have their own kind namespaces.

I wrote an example: linux kernel subparser running on C base parser. https://github.com/universal-ctags/ctags/commit/991667ff916524a0d91418b705b0650539735472

Though your trouble is not fixed yet, but I hope the example attracts you:-P

The next biggest challenge of mine is rewriting ruby parser. After that I can write rubyOnRails parser on it. The parsers will solve your issue completely. Of course, you will be able to write CloudForms subparser based on the rubyOnRails parser.

The concept of the subparser is expalined in http://docs.ctags.io/en/latest/running-multi-parsers.html#tagging-definitions-of-higher-upper-level-language-sub-base .

masatake avatar Apr 06 '17 14:04 masatake

That does look interesting and does attract me :) I have little time right now to work on it but will circle back around and see what I can do in the future. Thanks for all the info!

chrisarcand avatar May 01 '17 13:05 chrisarcand