ctags not indexing all the words I want
I'm trying to indexing my rails app with ctags so that vim can give me autocompletion. However, ctags is not i开发者_高级运维ndexing all the words, especially my call to external library. For example: I have this file:
class MultipleChoice < ActiveRecord::Base
has_many :options, :class_name => 'MultipleChoiceOption', :foreign_key => :parent_id, :dependent => :destroy
accepts_nested_attributes_for :options, :allow_destroy => true
def question
Question.find_by_data_id_and_data_type(id, MultipleChoice.name)
end
def randomized_options
(0...options.size).to_a.shuffle.map{|index| [index, options[index]]}
end
def realized_answer(user_answer)
user_answer.blank? ? nil : options[user_answer.to_i].content
end
def answer
options.detect{|o| o.correct}.content
rescue => e
HoptoadNotifier.notify(
:error_class => "MultipleChoice",
:error_message => "Exception while call #answer: #{e.message}",
:parameters => {:multiple_choice_id => self.id}
)
nil
end
end
Then ctags would index MultipleChoice (class name), answer (method name) but not HoptoadNotifier.
I'm indexing with ctags -R *
Is there away to tell ctags to index them all?
First, make sure that you have the HoptoadNotifier source somewhere in your rails app directory. So, let's assume within your directory you have this:
/railsapp/vendor/plugins/hoptoad_notifier/lib
which would be where the HoptoadNotifier source is stored.
Then run the following commands:
cd /railsapp
ctags -R --tag-relative=yes
That will create a file within railsapp/ called tags and will contain the tag info of the HoptoadNotifier module.
I know that appears to be more or less what you have already done, so I can only assume that the HoptoadNotifier source isn't within your directory structure, because I recreated this on my machine and it worked perfectly. You can also run ctags with a "-V" to spit out all the debug info and what it's doing.
精彩评论