universal-ctags / ctags

A maintained ctags implementation
https://ctags.io
GNU General Public License v2.0
6.48k stars 620 forks source link

Maximum tag name limit #2020

Open blueyed opened 5 years ago

blueyed commented 5 years ago

I have noticed that html parser might create very long tags, if it comes across some HTML templates, e.g. in the form <h3>{{ foo }}</h3>, where "{{ foo }}" might be much longer and cross multiple lines.

This might even cause Vim to fail parsing the tags file (https://github.com/vim/vim/issues/4051).

Therefore I think it would make sense to have some generic maximum tag name limit like 200 (which might be configurable).

This could then either truncate the name, or skip it (with a warning).

The tag in question comes from: https://github.com/django/django/blob/65ef5f467ba84c26392a157de1622d805401ec7d/django/contrib/admin/templates/admin/edit_inline/stacked.html#L12-L16 - it does not really make sense to have it altogether indexed (completely).

masatake commented 5 years ago

We have --pattern-length-limit=N. So the option name should be --name-length-limit=N.

TODO: I should write about *-length-limit= to our man page.

masatake commented 5 years ago

If I use --name-length-limit as the name of the option for this purpose, we should truncate the name because --pattern-length-limit=N truncates patterns. In such a case, we have to deal with utf-8 represented name carefully.