aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/provider.vim
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-07-26 07:03:52 -0400
committerGitHub <noreply@github.com>2017-07-26 07:03:52 -0400
commit6e83db479ca5d03f29bf92fe49735eba5339b75e (patch)
tree0a70a249b8e31c77f21f676cddbbf4128129ceef /runtime/autoload/provider.vim
parent55c821184d82cd8d36d7085f74f9625a362fa7a6 (diff)
parent722806a1154a004494ef911c2b77a2f35a8a4a62 (diff)
downloadrneovim-6e83db479ca5d03f29bf92fe49735eba5339b75e.tar.gz
rneovim-6e83db479ca5d03f29bf92fe49735eba5339b75e.tar.bz2
rneovim-6e83db479ca5d03f29bf92fe49735eba5339b75e.zip
Merge pull request #7065 from jamessan/collect-provider-stderr
Provide standard mechanism to collect stderr for providers
Diffstat (limited to 'runtime/autoload/provider.vim')
-rw-r--r--runtime/autoload/provider.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/autoload/provider.vim b/runtime/autoload/provider.vim
new file mode 100644
index 0000000000..a4d5241b57
--- /dev/null
+++ b/runtime/autoload/provider.vim
@@ -0,0 +1,18 @@
+" Common functionality for providers
+
+let s:stderr = {}
+
+function! provider#stderr_collector(chan_id, data, event) dict
+ 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)
+ silent! call delete(s:stderr, a:chan_id)
+endfunction
+
+function! provider#get_stderr(chan_id)
+ return get(s:stderr, a:chan_id, [])
+endfunction