2009-09-24 9 views
5

के लिए टैग फ़ाइल में मॉड्यूल क्वालीफायर शामिल करने के लिए ctags प्राप्त करना मैं Erlang फ़ाइलों को अनुक्रमणित करने के लिए एक्सबेरेंट ctags का उपयोग कर रहा हूं।Erlang कोड

"टैग" फ़ाइल में फ़ंक्शन हैं, लेकिन उनके पास मॉड्यूल क्वालीफायर नहीं हैं; तो मैं "मॉड्यूल: फ़ंक्शन", केवल "फ़ंक्शन" की खोज नहीं कर सकता, जो कई परिणाम दे सकता है।

क्या आप टैग फ़ाइल में मॉड्यूल क्वालीफायर को शामिल करने के लिए ctags प्राप्त करने का कोई तरीका जानते हैं?

धन्यवाद।

उत्तर

3

एक्सबेरेंट सीटीएजी पहले से ही एरलांग के लिए 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 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. 

यही है। केवल "दयालु" और "फ़ाइल" टैग फ़ील्ड नाम समर्थित हैं।

+0

यह टूल मॉड्यूल जेनरेट करता है: एरलैंग फ़ाइलों के लिए फ़ंक्शन टैग इस तरह से उपयोग कर सकते हैं कि Vim उनका उपयोग कर सकता है: https://github.com/vim-erlang/vim-erlang-tags – hcs42

1

ऐसा लगता है कि आप Erlang etags मॉड्यूल का उपयोग नहीं कर रहे हैं: Generate Emacs TAGS file from Erlang source files

+0

ईटैक्स Emacs के लिए है, और मैं विम का उपयोग करता हूं। – hcs42

+0

सुधार: + emacs_tags सुविधा के साथ संकलित होने पर विम भी इटैग का उपयोग कर सकते हैं। लेकिन etags मॉड्यूल क्वालिफायर का समर्थन करने के लिए प्रतीत नहीं होता है। – hcs42

0

मैं एक उत्कृष्ट 2 टेक्स्ट उपयोगकर्ता हूं और सीटीएजी अपने कंप्यूटर में सही तरीके से काम करता है। और मैं उदात्त 2.


के लिए ctags plugin का उपयोग -> ctags --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 पहले से ही टैग फ़ाइल में समारोह के मॉड्यूल संग्रहीत करता है। कम से कम विम (7.4) के हाल के संस्करणों के साथ इस जानकारी को एक्सेस किया जा सकता है। कस्टम "टैग" फ़ंक्शन का उपयोग करके "मॉड्यूल: फ़ंक्शन" को देखना संभव है, उदाहरण:

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>