Is there a tool to generate tag file that includes the definitions and references for functions/methods/procedures and global variables?
I know of ZLS but I have my setup for c and would like to keep using my etags.
If not, I would like to make one but at the moment I have a hard time using zig AstGen so if someone has an example of a project parsing zig files it would be appreciated
Wow. I was curious, and built it successfully, with two different patches to bring it up-to-date WRT zig 0.14.0, and try and deal with the tabs. But really, zig doesn’t allow tab characters inside of string literals? How does one deal with this? The ‘naive’ way (replacing literal tabs by \t) isn’t the way. And yeah there’s tools out there we might wanna generate TSV for, surely we want to allow tabs in strings?
First difference occurs on line 3:
expected:
MyEnum\ta.zig\t/^const MyEnum = enum {$/;"\tenum
^ ('\x5c')
found:
MyEnum a.zig /^const MyEnum = enum {$/;" enum
^ ('\x09')
std.testing.expectEqualStrings probably needs to learn how to deal with \t vs. at the very, very least. Also other supported escape sequences - it just does a std.mem.indexOfDiff which doesn’t handle escape sequences.
EDIT/Addition: the above is/was factually wrong. The error cause is/was multi-line strings not supporting escape sequence, as per design and documentation, which slipped me. expectEqualStrings is fine as-is.
I just used zig 0.13.0 and it compiled successfully but emacs complains that the tag file is formatted poorly. I have no knowledge in tag file format so I don’t know if it is a problem in my emacs setup
if you compiled successfully, I asume you ran zig fmt on it implicitly and zig fmt has replaced the tabs by spaces and that’s not a valid tags file. Or emacs did. Tags are TSV.