6

私はExuberantctagsを使用してErlangファイルにインデックスを付けています。

「タグ」ファイルには関数が含まれていますが、モジュール修飾子はありません。そのため、「module:function」を検索できず、「function」のみを検索すると、いくつかの結果が得られる可能性があります。

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

ありがとう。

4

4 に答える 4

5

lhtが書いたように、ExuberantCtags5.8はすでに関数のモジュールをタグファイルに保存しています。少なくとも最近のバージョンの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>
于 2013-11-04T22:49:02.200 に答える
4

あふれんばかりのctagsはすでにErlangのタグフィールド「モジュール」をサポートしています。

$ /usr/bin/ctags --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Aug 17 2010, 17:33:33
  Addresses: <dhiebert@users.sourceforge.net>, 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ドキュメントから:

{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」のみがサポートされているタグフィールド名です。

于 2010-09-25T15:24:18.770 に答える
1

Erlangetagsモジュールを使用していないようです。ErlangソースファイルからEmacsTAGSファイルを生成します

于 2009-09-24T13:18:57.007 に答える
0

i'm a sublime 2 text user and find ctags works correctly in my computer. and i use ctags plugin for sublime 2.


->ctags --version

Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Jul 24 2012, 11:45:55
Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
Optional compiled features: +wildcards, +regex
于 2012-07-24T07:15:16.647 に答える