Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental updates? #46

Open
jhenahan opened this issue May 14, 2018 · 8 comments
Open

Incremental updates? #46

jhenahan opened this issue May 14, 2018 · 8 comments

Comments

@jhenahan
Copy link
Collaborator

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.

@yihuang
Copy link

yihuang commented Jan 17, 2019

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).

@yihuang
Copy link

yihuang commented Jan 17, 2019

Actually, hasktags -x -c -a test.hs && sort -u -o tags tags works very well.

@MarcWeber
Copy link
Owner

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.

@yihuang
Copy link

yihuang commented Jan 17, 2019

#!/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 ?

@MarcWeber
Copy link
Owner

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 ..

@yihuang
Copy link

yihuang commented Jan 19, 2019

Yeah, your script is better ;D
I think --watch would be a useful feature, but it means we need to manage a daemon process.

@jberryman
Copy link

I don't see how hasktags -x -c -a $1 && sort -u -o tags tags does anything sensible...

@codygman
Copy link

codygman commented Oct 1, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants