2009-09-24 5 views
5

나는 Exuberant 태그를 사용하여 얼랭 파일을 인덱싱하고 있습니다.얼랭 코드의 태그 파일에 모듈 한정자를 포함하도록 태그 가져 오기

"tags"파일에는 기능이 있지만 모듈 한정자가 없습니다. 그래서 나는 "모듈 : 함수"를 검색 할 수없고, 단지 "함수"만 검색 할 수 있습니다. 이는 여러개의 결과를 에게 줄 수 있습니다.

ctags에 태그 한정자를 태그 파일에 포함시키는 방법을 알고 있습니까?

감사합니다.

답변

3

Exuberant ctags는 이미 얼랭에 대해 tag field "모듈"을 지원합니다.

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

사실, 지금은로이 태그 필드를 지원하지 않습니다 VIM입니다 : 같은

$ /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 

"모듈"라는 이름의 태그 필드 일반적인 태그 라인이 보인다. 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 태그를 생성합니다 : 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> 
관련 문제