aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/provider/python3.vim
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2024-01-07 13:05:03 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2024-01-22 22:36:40 +0100
commiteb5d15e3838f53e2fcd25989c88db87458e9f984 (patch)
treede13432021adb8632ed61cd9bbe4270eaec0674c /runtime/autoload/provider/python3.vim
parent13d50c3b13fb6f2bba948e50fefee451e0a90487 (diff)
downloadrneovim-eb5d15e3838f53e2fcd25989c88db87458e9f984.tar.gz
rneovim-eb5d15e3838f53e2fcd25989c88db87458e9f984.tar.bz2
rneovim-eb5d15e3838f53e2fcd25989c88db87458e9f984.zip
refactor: rewrite python provider in lua
Diffstat (limited to 'runtime/autoload/provider/python3.vim')
-rw-r--r--runtime/autoload/provider/python3.vim44
1 files changed, 7 insertions, 37 deletions
diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim
index 38ef0cccfc..d4ffeab155 100644
--- a/runtime/autoload/provider/python3.vim
+++ b/runtime/autoload/provider/python3.vim
@@ -1,45 +1,15 @@
-" The Python3 provider uses a Python3 host to emulate an environment for running
-" python3 plugins. :help provider
-"
-" Associating the plugin with the Python3 host is the first step because
-" plugins will be passed as command-line arguments
-
if exists('g:loaded_python3_provider')
finish
endif
-let [s:prog, s:err] = provider#pythonx#Detect(3)
-let g:loaded_python3_provider = empty(s:prog) ? 1 : 2
-function! provider#python3#Prog() abort
- return s:prog
+function! provider#python3#Call(method, args) abort
+ return v:lua.require'vim.provider.python'.call(a:method, a:args)
endfunction
-function! provider#python3#Error() abort
- return s:err
+function! provider#python3#Require(host) abort
+ return v:lua.require'vim.provider.python'.require(a:host)
endfunction
-" The Python3 provider plugin will run in a separate instance of the Python3
-" host.
-call remote#host#RegisterClone('legacy-python3-provider', 'python3')
-call remote#host#RegisterPlugin('legacy-python3-provider', 'script_host.py', [])
-
-function! provider#python3#Call(method, args) abort
- if s:err != ''
- return
- endif
- if !exists('s:host')
- let s:rpcrequest = function('rpcrequest')
-
- " Ensure that we can load the Python3 host before bootstrapping
- try
- let s:host = remote#host#Require('legacy-python3-provider')
- catch
- let s:err = v:exception
- echohl WarningMsg
- echomsg v:exception
- echohl None
- return
- endtry
- endif
- return call(s:rpcrequest, insert(insert(a:args, 'python_'.a:method), s:host))
-endfunction
+let s:prog = v:lua.require'vim.provider.python'.detect_by_module('neovim')
+let g:loaded_python3_provider = empty(s:prog) ? 1 : 2
+call v:lua.require'vim.provider.python'.start()