Note: by "editor tags support" I mean not #tags or tagging as in this forum/board, or version control tags as in git, but tags that a program editor can use in order to take you quickly to the code, function or variable or class definitions, that you care about?
There are many tag database building tools like ctags https://man7.org/linux/man-pages/man1/ctags.1p.html, https://docs.ctags.io/en/latest/man/ctags.1.html], etags https://linux.die.net/man/1/etags.
Many programming editors, like vim and emacs support various tag formats. indeed the etags tag format and program are specifically "tags for emacs", more capable than the original C programming related tags, although both the ctags and etags tools can be configured for many different programming languages. https://linux.die.net/man/1/etags
I am mainly looking for recommendations for a particular tool and particular configuration options that work well with AutoHotKey.
---
I am currently using etags as follows:
Code: Select all
etags --append \
--langdef=ahk --language-force=ahk \
--regex-ahk='/^([a-zA-Z0-9_]+)\(/\1/' \
--regex-ahk='/^[[:blank:]]*([a-zA-Z0-9_]+)\(.*\)[[:blank:]]*$$/\1/' \
--regex-ahk='/^[[:blank:]]*([a-zA-Z0-9_]+)\(.*\)[[:blank:]]*{/\1/' \
--regex-ahk='/^class[[:blank:]]+([a-zA-Z0-9_]+)/\1/'
Code: Select all
--langdef=ahk
I should probably be using
Code: Select all
--langmap=.ahk.ahk-lib
Code: Select all
--language-force=ahk
Code: Select all
--regex-ahk='/^([a-zA-Z0-9_]+)\(/\1/'
Code: Select all
--regex-ahk='/^[[:blank:]]*([a-zA-Z0-9_]+)\(.*\)[[:blank:]]*{/\1/'
Code: Select all
name(args){
...
}
However, I often do not put the { on the same line as the function name or argument list, especially if there are lots of arguments.
Hence
Code: Select all
--regex-ahk='/^[[:blank:]]*([a-zA-Z0-9_]+)\(.*\)[[:blank:]]*$/\1/' \
and even
[code]--regex-ahk='/^[[:blank:]]*([a-zA-Z0-9_]+)\(.*/\1/'
- function calls that begin in column 0
- if(...) { ... statements,
- etc.
the etags format is a little bit more complicated and harder to filter. But the extra features of etags are desirable.
Besides, filtering if statements out is fairly easy, but distinguishing function definitions from function calls is a bit harder. Essentially you have to look past the closing parenthesis of the argument list to see if there is { beginning a function body. AFAIK none of the ctags/etags programs support regular expressions that can cross line boundaries in this way. Perhaps somebody has already written one?
(BTW, one of my most annoying habits is to have AHK function call followed by a { quite a few blank lines later, sometimes across a #include file boundary. I like using {braces} group code blocks, often indenting them.)