hasktags
hasktags copied to clipboard
Incremental updates?
A comment on Reddit mentioned that fast-tags can do incremental updates on save. This'd be a cute feature for hasktags
, and it could make it easier to scale the tool's use for larger codebases.
Actually, hasktags
has an append mode, but it just simply append, rather than merge with current tags, which makes it quite useless.
I'm interested to change the behavior of append to merge (like what exuberant ctags does).
Actually, hasktags -x -c -a test.hs && sort -u -o tags tags
works very well.
Thinking about it its worth adding to the README. Because whenever you write a file you'll be up to date. its solving a problem. Do you want to send PR or shall I just add it and give you credits?
if fast-tags competes we can add it, too.
But there is another thing to consider -> why run hasktags at all, why not --watch ? It would be fastest eventually.
If it works for you we can wait till more people ask for it.
#!/bin/zsh
if [[ -r tags ]]; then
hasktags -x -c -a $1 && sort -u -o tags tags
fi
au BufWritePost *.hs silent !update-tags %
au BufWritePost *.hsc silent !update-tags %
I end up with configs like above. You can just add it to README.
What do you mean by --watch
?
Why make it so complicated?
au BufWritePost .hs,.hsc if (file_exists('tags') | exec "! ( hasktags -x -c -a % && sort -u -o tags ) &" | endif
should do it. I have to use exec to append | endif.
By --watch I mean update tags file whenever a .hs file changes.
http://hackage.haskell.org/package/hinotify-0.4/docs/System-INotify.html
If you make hasktags read the lines and start sorting you have more IO to do than keeping it in RAM ..
Yeah, your script is better ;D
I think --watch
would be a useful feature, but it means we need to manage a daemon process.
I don't see how hasktags -x -c -a $1 && sort -u -o tags tags
does anything sensible...
Why make it so complicated?
au BufWritePost .hs,.hsc if (file_exists('tags') | exec "! ( hasktags -x -c -a % && sort -u -o tags ) &" | endif
should do it. I have to use exec to append | endif.
Do you mean why complicate the implementation or why complicate it from a user perspective?
Because from a user perspective having:
hasktags --file-watch .
Is as simple as it gets.
As someone about to implement hasktags for a team, if I could just do the above I would save an hour or two minimum. Instead I need to go find all the places/ways people update code. You can say "everyone should update it the same way", but that's not really realistic to expect everywhere in my opinion.
It would complicate implementation quite a bit to add something like --file-watch
though, no arguments there.