summaryrefslogtreecommitdiff
path: root/autoload/asyncomplete
diff options
context:
space:
mode:
authorDonnie West <igneo676@gmail.com>2019-08-17 12:40:05 -0500
committerw0rp <w0rp@users.noreply.github.com>2019-08-17 18:40:05 +0100
commit5388ff1d54e05cfaa9429cdbf9a2cacba94d190f (patch)
tree33d333acf8d89cb59a407b1549701007f51ce5a8 /autoload/asyncomplete
parent28c93ab1854ef41a46855401cc4addbaf7dfb9d4 (diff)
downloadale-5388ff1d54e05cfaa9429cdbf9a2cacba94d190f.zip
Add asyncomplete.vim Support (#2627)
Diffstat (limited to 'autoload/asyncomplete')
-rw-r--r--autoload/asyncomplete/sources/ale.vim26
1 files changed, 26 insertions, 0 deletions
diff --git a/autoload/asyncomplete/sources/ale.vim b/autoload/asyncomplete/sources/ale.vim
new file mode 100644
index 00000000..ce793773
--- /dev/null
+++ b/autoload/asyncomplete/sources/ale.vim
@@ -0,0 +1,26 @@
+function! asyncomplete#sources#ale#get_source_options(...) abort
+ let l:default = extend({
+ \ 'name': 'ale',
+ \ 'completor': function('asyncomplete#sources#ale#completor'),
+ \ 'whitelist': ['*'],
+ \ 'triggers': asyncomplete#sources#ale#get_triggers(),
+ \ }, a:0 >= 1 ? a:1 : {})
+
+ return extend(l:default, {'refresh_pattern': '\k\+$'})
+endfunction
+
+function! asyncomplete#sources#ale#get_triggers() abort
+ let l:triggers = ale#completion#GetAllTriggers()
+ let l:triggers['*'] = l:triggers['<default>']
+
+ return l:triggers
+endfunction
+
+function! asyncomplete#sources#ale#completor(options, context) abort
+ let l:keyword = matchstr(a:context.typed, '\w\+$')
+ let l:startcol = a:context.col - len(l:keyword)
+
+ call ale#completion#GetCompletions('ale-callback', { 'callback': {completions ->
+ \ asyncomplete#complete(a:options.name, a:context, l:startcol, completions)
+ \ }})
+endfunction