2011-05-08 26 views
0

我試圖用ctags的應用索引我的軌道。這樣Vim可以給我自動完成。 但是,ctags並沒有索引所有的單詞,尤其是我對外部庫的調用。 例如: 我有這個文件:的ctags不是索引所有的話我想

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 

然後CTAGS將索引選擇題(類名),答案(方法名),但不HoptoadNotifier。

我與ctags -R *

索引有沒有去告訴CTAGS索引他們呢?

回答

0

首先,確保您的rails應用程序目錄中有HoptoadNotifier源。所以,讓我們假設你的目錄中有這個:

/railsapp/vendor/plugins/hoptoad_notifier/lib 

這將是HoptoadNotifier源的存儲位置。

然後運行以下命令:

cd /railsapp 
ctags -R --tag-relative=yes 

,將創建railsapp /被叫標籤內的文件,將包含HoptoadNotifier模塊的標籤信息。

我知道你似乎已經做了或多或少的事情,所以我只能假定HoptoadNotifier源不在你的目錄結構中,因爲我在我的機器上重新創建了它,並且它完美地工作。你也可以運行帶有「-V」的ctags來吐出所有的調試信息以及它正在做什麼。

相關問題