diff options
author | w0rp <devw0rp@gmail.com> | 2019-04-07 15:34:39 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-04-07 15:34:39 +0100 |
commit | e85eb824016a0ca4217d41cc2ec603ff22a3b74d (patch) | |
tree | 46e5ffc641820d765bc5c8898fe56154b23e9eeb /autoload/ale.vim | |
parent | 3bebcb5d48a7150f5a318952ee309acb67fb376d (diff) | |
download | ale-e85eb824016a0ca4217d41cc2ec603ff22a3b74d.zip |
#2132 - Implement feature tests with ale#Has
Diffstat (limited to 'autoload/ale.vim')
-rw-r--r-- | autoload/ale.vim | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim index bcb89095..cd106887 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -151,12 +151,19 @@ function! ale#Queue(delay, ...) abort endif endfunction -let g:ale_has_override = get(g:, 'ale_has_override', {}) +let s:current_ale_version = [2, 4, 0] -" Call has(), but check a global Dictionary so we can force flags on or off -" for testing purposes. +" A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort - return get(g:ale_has_override, a:feature, has(a:feature)) + let l:match = matchlist(a:feature, '\c\v^ale-(\d+)\.(\d+)(\.(\d+))?$') + + if !empty(l:match) + let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] + + return ale#semver#GTE(s:current_ale_version, l:version) + endif + + return 0 endfunction " Given a buffer number and a variable name, look for that variable in the |