File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 6
6
import sys
7
7
8
8
from .decorators import plugin , rpc_export
9
- from ..api import Nvim
9
+ from ..api import Nvim , walk
10
10
11
11
__all__ = ('ScriptHost' ,)
12
12
@@ -161,15 +161,23 @@ def writelines(self, seq):
161
161
self .redirect_handler ('\n ' .join (seq ))
162
162
163
163
164
+ if IS_PYTHON3 :
165
+ num_types = (int , float )
166
+ else :
167
+ num_types = (int , long , float )
168
+
169
+
170
+ def num_to_str (obj ):
171
+ if isinstance (obj , num_types ):
172
+ return str (obj )
173
+ else :
174
+ return obj
175
+
176
+
164
177
class LegacyVim (Nvim ):
165
178
def eval (self , expr ):
166
179
obj = self .request ("vim_eval" , expr )
167
- if IS_PYTHON3 :
168
- if isinstance (obj , (int , float )):
169
- return str (obj )
170
- elif isinstance (obj , (int , long , float )):
171
- return str (obj )
172
- return obj
180
+ return walk (num_to_str , obj )
173
181
174
182
175
183
# This was copied/adapted from nvim-python help
You can’t perform that action at this time.
0 commit comments