-
Notifications
You must be signed in to change notification settings - Fork 64
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
RFC: Add a special module method to check if the module is available #572
Comments
返り値で neovim が使えるかどうか判断するとしたら
を決める必要がありそうです。 |
neovim 以外にも様々な理由でモジュールは利用不可になるため、返り値では判断できないと思っています。 個人的には自動的に呼ばれる関数があり、その関数でエラーを投げたら利用不可くらいのゆるい感じがいいなかと思います。 |
理由を
自分もそんな感じでいいと思います。 あと投げる値の構造は個人的には文字列でいいと思います(他に含める情報が思い当たらない)。 |
ただ例外を投げるとなるとそもそも |
良さそう > 例外投げるならわざわざ確認用メソッドではなくload時で的な |
特殊な関数 |
名前案の第一候補: |
名前候補 _vital_validate でいいのではと思ってきた |
Summary
Add '_vital_healthcheck' method which will be called when the module is imported and raise an error with a reason when the module does not work on the running Vim.
Detail
I would like to make modules which requires some requriments.
In that case, the module might not work on some Vim and I would like to skip the tests.
To achive that, I made a helper module import function like
https://github.com/lambdalisue/vital-Whisky/blob/master/autoload/healthcheck/vital.vim
However, it contains a dependency to the vim-themis just for testing.
So it would be nice if vital.vim itself has similar special method which is automatically called when the module is imported and raise an error with the reason.
With that new feature, vim-themis or its harmonic plugin can wrap vital#xxx#import and skip with a reason raised when the module is not available.
What do you think? Esp, @thinca
The text was updated successfully, but these errors were encountered: