ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 114 forks source link

Can I make PR? --wait to run a command on a compile finished #247

Open aiya000 opened 5 years ago

aiya000 commented 5 years ago

Hi, I'm a ghcid user, thanks :smiley:

I'm planning to make PR for below --wait. Can I implement this?


My thinking --wait is a command specification, the command is executed after a compile finished (after --verbose's %WAIT shew).

e.g.

$ cd some-haskell-project
$ ghcid --wait='notify-send "finished!"'

...

Foo.hs:11:1-49: warning: [-Wunused-imports]
    The import of ‘Bar’ from module ‘Baz’ is redundant
    ...

# "finished" shows my desktop at here.

# And I fixed the warning.

...

All good!

# "finished" shows my desktop at here too.

I want to this --wait, because I have an issue (https://github.com/aiya000/vim-ghcid-quickfix/pull/15). That issue needs to --wait to fix :joy:

Thanks!

ndmitchell commented 5 years ago

Not averse to this. My only question is if --test is sufficient, which already runs after a compile finishes?

Other question is whether this should be a command line (like you have), or a GHC command, which could of course be :!notify-send, but could equally be something else.

aiya000 commented 5 years ago

My only question is if --test is sufficient, which already runs after a compile finishes?

Sorry if my opinion is wrong :pray: I think --test='print 10' execute it only if no warnings and no errors occured.

I want to execute it if some warning and some error occured :)

Other question is whether this should be a command line (like you have), or a GHC command, which could of course be :!notify-send, but could equally be something else.

Well..! I just need to run Haskell expressions, like --test. I don't want to run shell commands :+1:

ndmitchell commented 5 years ago

OK, I see the difference. Another alternative would be to allow the test to run even when there are errors. There is already a flag --warnings that makes it run even in the presence of warnings, so having one for errors doesn't sound unreasonable.

aiya000 commented 5 years ago

! Indeed, I think that idea is best!

Like -E and --errors?

ndmitchell commented 5 years ago

I wouldn't bother with a single letter alias (doesn't seem common enough) so just --errors

aiya000 commented 5 years ago

Sorry, I lost a time to make this... But I want this feature, wait please ...!

If you hate to remain this as an issue, I make this as a WIP PR. Please tell me :)