aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/provider.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/autoload/provider.vim')
-rw-r--r--runtime/autoload/provider.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/runtime/autoload/provider.vim b/runtime/autoload/provider.vim
new file mode 100644
index 0000000000..e6514f5ba8
--- /dev/null
+++ b/runtime/autoload/provider.vim
@@ -0,0 +1,20 @@
+" Common functionality for providers
+
+let s:stderr = {}
+
+function! provider#stderr_collector(chan_id, data, event)
+ let stderr = get(s:stderr, a:chan_id, [''])
+ let stderr[-1] .= a:data[0]
+ call extend(stderr, a:data[1:])
+ let s:stderr[a:chan_id] = stderr
+endfunction
+
+function! provider#clear_stderr(chan_id)
+ if has_key(s:stderr, a:chan_id)
+ call remove(s:stderr, a:chan_id)
+ endif
+endfunction
+
+function! provider#get_stderr(chan_id)
+ return get(s:stderr, a:chan_id, [])
+endfunction