2009-09-24 5 views
5

私はExuberantタグを使用してErlangファイルを索引付けしています。Erlangコードのタグファイルにモジュール修飾子を含めるためのctagsの取得

"tags"ファイルには機能が含まれていますが、モジュール修飾子はありません。だから 私は "モジュール:機能"、いくつかの 結果を与えることがあります "機能"のみを検索することはできません。

タグファイルにモジュール修飾子を含める方法を知っていますか?

ありがとうございました。

答えて

3

Exuberant ctagsはすでにErlangの "module"をtag fieldに対応しています。

$ /usr/bin/ctags --version 
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert 
    Compiled: Aug 17 2010, 17:33:33 
    Addresses: <[email protected]>, http://ctags.sourceforge.net 
    Optional compiled features: +wildcards, +regex 
$ /usr/bin/ctags xref_parser.erl 

「モジュール」という名前のタグフィールドを持つ典型的なタグラインは、次のようになります。

yeccgoto_const xref_parser.erl /^yeccgoto_const(24=_S, Cat, Ss, Stack, T, Ts, Tzr) ->$/;"  f  module:xref_parser 

実際には、今のように、このタグフィールドをサポートしていませんVIMです。 VIM docから:

{field} .. A list of optional fields. Each field has the form: 

      <Tab>{fieldname}:{value} 

     The {fieldname} identifies the field, and can only contain 
     alphabetical characters [a-zA-Z]. 
     The {value} is any string, but cannot contain a <Tab>. 

     There is one field that doesn't have a ':'. This is the kind 
     of the tag. It is handled like it was preceded with "kind:". 
     See the documentation of ctags for the kinds it produces. 

     The only other field currently recognized by Vim is "file:" 
     (with an empty value). It is used for a static tag. 

これはそれです。 "kind"と "file"のみがサポートされているタグフィールド名です。

+0

このツールは、Erlangファイル用のmodule:functionタグをVimが使用できるように生成します:https://github.com/vim-erlang/vim-erlang-tags – hcs42

1

Erlang etagsモジュール:Generate Emacs TAGS file from Erlang source filesを使用していないようです。

+0

etagsはEmacs用で、私はVimを使用します。 – hcs42

+0

訂正:Vimは+ emacs_tags機能でコンパイルしたときにetagsも使用できます。しかし、etagsはモジュールの修飾子をサポートしていないようです。 – hcs42

0

私は崇高な2人のテキストユーザーで、自分のコンピュータでctagsが正しく動作することを確認します。そして、私は崇高2.


ためctags pluginを使用 - > --version

Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert 
Compiled: Jul 24 2012, 11:45:55 
Addresses: <[email protected]>, http://ctags.sourceforge.net 
Optional compiled features: +wildcards, +regex 
3

LHTが書いたように、あふれんばかりのctags 5.8が既にタグファイル内の関数のモジュールを格納しctagsの。少なくとも最近のバージョンのVim(7.4)では、この情報にアクセスすることができます。たとえば、カスタム "タグ"関数を使用して "module:function"を検索することができます。例:

function! ErlangTag() 
    let isk_orig = &isk 
    set isk+=: 
    let keyword = expand('<cword>') 
    let &isk = isk_orig 
    let parts = split(keyword, ':') 
    if len(parts) == 1 
     execute 'tag' parts[0] 
    elseif len(parts) == 2 
     let [mod, fun] = parts 
     let i = 1 
     let fun_taglist = taglist('^' . fun . '$') 
     for item in fun_taglist 
      if item.kind == 'f' && item.module == mod 
       silent execute i . 'tag' fnameescape(item.name) 
       break 
      endif 
      let i += 1 
     endfor 
    endif 
endfunction 

nnoremap <buffer> <c-]> :call ErlangTag()<cr> 
関連する問題