aiya000 / vim-ghcid-quickfix

Increse your Haskell development via ghcid!
MIT License
30 stars 5 forks source link

Support user defined event hooks #8

Closed aiya000 closed 5 years ago

aiya000 commented 5 years ago

Like

function! NewMyEventHooks(qf_bufnr) abort
  let instance = {
    \ 'qf_bufnr': a:qf_bufnr,
  \ }

  function! instance.on_quickfix_buffer_created() abort dict
    echomsg 'Hello, user :D'
  endfunction

  function! instance.on_outputting_line(line) abort dict
    echomsg ';D You got ' . a:line
  endfunction

  return instance
endfunction

command! -bar -nargs=* GhcidQuickfixStartWithSmile call ghcid_quickfix#start(function('NewMyEventHooks'), <q-args>)
aiya000 commented 5 years ago

I made a mock support 894259ab11d017fb33012dcd0647ed1277970197. Use this :)

alx741 commented 5 years ago

+1 to this! It would be amazing. I could use it to attach something like this: https://github.com/alx741/tdd_traffic-light or to run tests/benchmarking/deployment/etc.

Use this :)

Will try it out

alx741 commented 5 years ago

When I try to execute :GhcidQuickfixStartWithSmile I get this error:

E118: Too many arguments for function: ghcid_quickfix#start

However If i replace this:

command! -bar -nargs=* GhcidQuickfixStartWithSmile call ghcid_quickfix#start(function('NewMyEventHooks'), <q-args>)

with this (removing the <q-args> argument):

command! -bar -nargs=* GhcidQuickfixStartWithSmile call ghcid_quickfix#start(function('NewMyEventHooks'))

Then it complains:

E729: using Funcref as a String
aiya000 commented 5 years ago

@alx741 Sorry, I never implemented yet :joy: (Now, the mock limited only internal.)

but i'll implement soon!

alx741 commented 5 years ago

oh! got too exited :rofl: but the idea is great and flexible enough for the user to tap virtually anything :+1:

but i'll implement soon!

Alright. Maybe make that a new branch? to avoid braking what is already working in master

aiya000 commented 5 years ago

I pushed this support :+1: Now you can see :GhcidQuickfixStartWithSmile with above code!

Alright. Maybe make that a new branch? to avoid braking what is already working in master

Sorry, I jumped the gun, I pushed to into master. Please agree :joy:

Thanks :D