Closed Bug 578709 Opened 15 years ago Closed 4 years ago

[RFE] ctags output from DXR

Categories

(Webtools Graveyard :: DXR, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: crowderbt, Unassigned)

Details

It would be cool if DXR could output a vim/emacs compatible tags file. I think this is the exuberant ctags author's format proposal, not sure how much of it is accepted: http://ctags.sourceforge.net/FORMAT Ideally, one could do this from within the build system with a simple make command, ala "make ctags"
For my reference later: The lines in the tags file must have one of these three formats: 1. {tagname} {TAB} {tagfile} {TAB} {tagaddress} 2. {tagfile}:{tagname} {TAB} {tagfile} {TAB} {tagaddress} 3. {tagname} {TAB} {tagfile} {TAB} {tagaddress} {term} {field} .. The first is a normal tag, which is completely compatible with Vi. It is the only format produced by traditional ctags implementations. This is often used for functions that are global, also referenced in other files. The lines in the tags file can end in <LF> or <CR><LF>. On the Macintosh <CR> also works. The <CR> and <NL> characters can never appear inside a line. The second format is for a static tag only. It is obsolete now, replaced by the third format. It is only supported by Elvis 1.x and Vim and a few versions of ctags. A static tag is often used for functions that are local, only referenced in the file {tagfile}. Note that for the static tag, the two occurrences of {tagfile} must be exactly the same. Also see |tags-option| below, for how static tags are used. The third format is new. It includes additional information in optional fields at the end of each line. It is backwards compatible with Vi. It is only supported by new versions of ctags (such as Exuberant ctags). {tagname} The identifier. Normally the name of a function, but it can be any identifier. It cannot contain a <Tab>. {TAB} One <Tab> character. Note: previous versions allowed any white space here. This has been abandoned to allow spaces in {tagfile}. It can be re-enabled by including the |+tag_any_white| feature at compile time. *tag-any-white* {tagfile} The file that contains the definition of {tagname}. It can have an absolute or relative path. It may contain environment variables and wildcards (although the use of wildcards is doubtful). It cannot contain a <Tab>. {tagaddress} The Ex command that positions the cursor on the tag. It can be any Ex command, although restrictions apply (see |tag-security|). Posix only allows line numbers and search commands, which are mostly used. {term} ;" The two characters semicolon and double quote. This is interpreted by Vi as the start of a comment, which makes the following be ignored. This is for backwards compatibility with Vi, it ignores the following fields. {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>. These characters are special: "\t" stands for a <Tab> "\r" stands for a <CR> "\n" stands for a <NL> "\\" stands for a single '\' character 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. The first lines in the tags file can contain lines that start with !_TAG_ These are sorted to the first lines, only rare tags that start with "!" can sort to before them. Vim recognizes two items. The first one is the line that indicates if the file was sorted. When this line is found, Vim uses binary searching for the tags file: !_TAG_FILE_SORTED<Tab>1<Tab>{anything} ~ A tag file may be case-fold sorted to avoid a linear search when 'ignorecase' is on. See 'tagbsearch' for details. The value '2' should be used then: !_TAG_FILE_SORTED<Tab>2<Tab>{anything} ~ The other tag that Vim recognizes, but only when compiled with the |+multi_byte| feature, is the encoding of the tags file: !_TAG_FILE_ENCODING<Tab>utf-8<Tab>{anything} ~ Here "utf-8" is the encoding used for the tags. Vim will then convert the tag being searched for from 'encoding' to the encoding of the tags file. And when listing tags the reverse happens. When the conversion fails the unconverted tag is used. The command can be any Ex command, but often it is a search command. Examples: tag1 file1 /^main(argc, argv)/ ~ tag2 file2 108 ~ The command is always executed with 'magic' not set. The only special characters in a search pattern are "^" (begin-of-line) and "$" (<EOL>). See |pattern|. Note that you must put a backslash before each backslash in the search text. This is for backwards compatibility with Vi.
Note that this is the same format that Bespin uses for its code completion feature.
Which one? ctags, etags, or exuberant-ctags?
Exuberant ctags, if you're asking about Bespin.
Priority: -- → P1
Priority: P1 → P5
BUMP! Just had a request for this on irc, sounds like it would be a great idea to output ctags and make them available for download.
Priority: P5 → --
Neat idea. I'd take a patch. We could add a little call-out box to the root of the tree or something.

DXR is no longer available. Searchfox is now replacing it.
See meta bug 1669906 & https://groups.google.com/g/mozilla.dev.platform/c/jDRjrq3l-CY for more details.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.