New upstream snapshot.
Debian Janitor
1 year, 3 months ago
0 | 0 | Metadata-Version: 2.1 |
1 | 1 | Name: pynvim |
2 | Version: 0.4.2 | |
2 | Version: 0.4.3 | |
3 | 3 | Summary: Python client to neovim |
4 | 4 | Home-page: http://github.com/neovim/pynvim |
5 | Download-URL: https://github.com/neovim/pynvim/archive/0.4.3.tar.gz | |
5 | 6 | Author: Thiago de Arruda |
6 | 7 | Author-email: tpadilha84@gmail.com |
7 | 8 | License: Apache |
8 | Download-URL: https://github.com/neovim/pynvim/archive/0.4.2.tar.gz | |
9 | Description: UNKNOWN | |
10 | Platform: UNKNOWN | |
11 | 9 | Provides-Extra: pyuv |
12 | 10 | Provides-Extra: test |
11 | License-File: LICENSE |
1 | 1 | =================================================================== |
2 | 2 | |
3 | 3 | [![Build Status](https://travis-ci.org/neovim/pynvim.svg?branch=master)](https://travis-ci.org/neovim/pynvim) |
4 | [![Documentation Status](https://readthedocs.org/projects/pynvim/badge/?version=latest)](http://pynvim.readthedocs.io/en/latest/?badge=latest) | |
4 | [![Documentation Status](https://readthedocs.org/projects/pynvim/badge/?version=latest)](https://pynvim.readthedocs.io/en/latest/?badge=latest) | |
5 | 5 | [![Code coverage](https://codecov.io/gh/neovim/pynvim/branch/master/graph/badge.svg)](https://codecov.io/gh/neovim/pynvim) |
6 | 6 | |
7 | 7 | Pynvim implements support for python plugins in Nvim. It also works as a library for |
0 | python-pynvim (0.4.2-3) UNRELEASED; urgency=medium | |
0 | python-pynvim (0.4.3+git20221106.1.12acffc-1) UNRELEASED; urgency=medium | |
1 | 1 | |
2 | 2 | * Update standards version to 4.6.2, no changes needed. |
3 | ||
4 | -- Debian Janitor <janitor@jelmer.uk> Wed, 11 Jan 2023 18:01:40 -0000 | |
3 | * New upstream snapshot. | |
4 | ||
5 | -- Debian Janitor <janitor@jelmer.uk> Wed, 11 Jan 2023 20:04:36 -0000 | |
5 | 6 | |
6 | 7 | python-pynvim (0.4.2-2) unstable; urgency=medium |
7 | 8 |
97 | 97 | When the session is not needed anymore, it is recommended to explicitly |
98 | 98 | close it: |
99 | 99 | nvim.close() |
100 | It is also possible to use the session as a context mangager: | |
100 | It is also possible to use the session as a context manager: | |
101 | 101 | with attach('socket', path=thepath) as nvim: |
102 | 102 | print(nvim.funcs.getpid()) |
103 | 103 | print(nvim.current.line) |
104 | 104 | This will automatically close the session when you're done with it, or |
105 | when an error occured. | |
105 | when an error occurred. | |
106 | 106 | |
107 | 107 | |
108 | 108 | """ |
36 | 36 | buffer. For example, -1 is the last line, -2 is the line before that |
37 | 37 | and so on. |
38 | 38 | |
39 | When retrieving slices, omiting indexes(eg: `buffer[:]`) will bring | |
39 | When retrieving slices, omitting indexes(eg: `buffer[:]`) will bring | |
40 | 40 | the whole buffer. |
41 | 41 | """ |
42 | 42 | if not isinstance(idx, slice): |
51 | 51 | |
52 | 52 | Like with `__getitem__`, indexes may be negative. |
53 | 53 | |
54 | When replacing slices, omiting indexes(eg: `buffer[:]`) will replace | |
54 | When replacing slices, omitting indexes(eg: `buffer[:]`) will replace | |
55 | 55 | the whole buffer. |
56 | 56 | """ |
57 | 57 | if not isinstance(idx, slice): |
68 | 68 | |
69 | 69 | This will retrieve all lines locally before iteration starts. This |
70 | 70 | approach is used because for most cases, the gain is much greater by |
71 | minimizing the number of API calls by transfering all data needed to | |
71 | minimizing the number of API calls by transferring all data needed to | |
72 | 72 | work. |
73 | 73 | """ |
74 | 74 | lines = self[:] |
49 | 49 | |
50 | 50 | A msgpack-rpc with method `method` and argument `args` is sent to |
51 | 51 | Nvim. This will have the same effect as a request, but no response |
52 | will be recieved | |
52 | will be received | |
53 | 53 | """ |
54 | 54 | self._msgpack_stream.send([2, method, args]) |
55 | 55 | |
79 | 79 | self._handlers.get(msg[0], self._on_invalid_message)(msg) |
80 | 80 | except Exception: |
81 | 81 | err_str = format_exc(5) |
82 | pass # replaces next logging statement | |
83 | #warn(err_str) | |
82 | warn(err_str) | |
84 | 83 | self._msgpack_stream.send([1, 0, err_str, None]) |
85 | 84 | |
86 | 85 | def _on_request(self, msg): |
88 | 87 | # - msg[1]: id |
89 | 88 | # - msg[2]: method name |
90 | 89 | # - msg[3]: arguments |
91 | pass # replaces next logging statement | |
92 | #debug('received request: %s, %s', msg[2], msg[3]) | |
90 | debug('received request: %s, %s', msg[2], msg[3]) | |
93 | 91 | self._request_cb(msg[2], msg[3], Response(self._msgpack_stream, |
94 | 92 | msg[1])) |
95 | 93 | |
98 | 96 | # - msg[1]: the id |
99 | 97 | # - msg[2]: error(if any) |
100 | 98 | # - msg[3]: result(if not errored) |
101 | pass # replaces next logging statement | |
102 | #debug('received response: %s, %s', msg[2], msg[3]) | |
99 | debug('received response: %s, %s', msg[2], msg[3]) | |
103 | 100 | self._pending_requests.pop(msg[1])(msg[2], msg[3]) |
104 | 101 | |
105 | 102 | def _on_notification(self, msg): |
106 | 103 | # notification/event |
107 | 104 | # - msg[1]: event name |
108 | 105 | # - msg[2]: arguments |
109 | pass # replaces next logging statement | |
110 | #debug('received notification: %s, %s', msg[1], msg[2]) | |
106 | debug('received notification: %s, %s', msg[1], msg[2]) | |
111 | 107 | self._notification_cb(msg[1], msg[2]) |
112 | 108 | |
113 | 109 | def _on_invalid_message(self, msg): |
114 | 110 | error = 'Received invalid message %s' % msg |
115 | pass # replaces next logging statement | |
116 | #warn(error) | |
111 | warn(error) | |
117 | 112 | self._msgpack_stream.send([1, 0, error, None]) |
118 | 113 | |
119 | 114 | |
139 | 134 | resp = [1, self._request_id, value, None] |
140 | 135 | else: |
141 | 136 | resp = [1, self._request_id, None, value] |
142 | pass # replaces next logging statement | |
143 | #debug('sending response to request %d: %s', self._request_id, resp) | |
137 | debug('sending response to request %d: %s', self._request_id, resp) | |
144 | 138 | self._msgpack_stream.send(resp) |
101 | 101 | pipe = sys.stdin |
102 | 102 | coroutine = self._loop.connect_read_pipe(self._fact, pipe) |
103 | 103 | self._loop.run_until_complete(coroutine) |
104 | pass # replaces next logging statement | |
105 | #debug("native stdin connection successful") | |
104 | debug("native stdin connection successful") | |
106 | 105 | |
107 | 106 | # Make sure subprocesses don't clobber stdout, |
108 | 107 | # send the output to stderr instead. |
115 | 114 | pipe = os.fdopen(rename_stdout, 'wb') |
116 | 115 | coroutine = self._loop.connect_write_pipe(self._fact, pipe) |
117 | 116 | self._loop.run_until_complete(coroutine) |
118 | pass # replaces next logging statement | |
119 | #debug("native stdout connection successful") | |
117 | debug("native stdout connection successful") | |
120 | 118 | |
121 | 119 | def _connect_child(self, argv): |
122 | 120 | if os.name != 'nt': |
94 | 94 | |
95 | 95 | def connect_tcp(self, address, port): |
96 | 96 | """Connect to tcp/ip `address`:`port`. Delegated to `_connect_tcp`.""" |
97 | pass # replaces next logging statement | |
98 | #info('Connecting to TCP address: %s:%d', address, port) | |
97 | info('Connecting to TCP address: %s:%d', address, port) | |
99 | 98 | self._connect_tcp(address, port) |
100 | 99 | |
101 | 100 | def connect_socket(self, path): |
102 | 101 | """Connect to socket at `path`. Delegated to `_connect_socket`.""" |
103 | pass # replaces next logging statement | |
104 | #info('Connecting to %s', path) | |
102 | info('Connecting to %s', path) | |
105 | 103 | self._connect_socket(path) |
106 | 104 | |
107 | 105 | def connect_stdio(self): |
108 | 106 | """Connect using stdin/stdout. Delegated to `_connect_stdio`.""" |
109 | pass # replaces next logging statement | |
110 | #info('Preparing stdin/stdout for streaming data') | |
107 | info('Preparing stdin/stdout for streaming data') | |
111 | 108 | self._connect_stdio() |
112 | 109 | |
113 | 110 | def connect_child(self, argv): |
114 | 111 | """Connect a new Nvim instance. Delegated to `_connect_child`.""" |
115 | pass # replaces next logging statement | |
116 | #info('Spawning a new nvim instance') | |
112 | info('Spawning a new nvim instance') | |
117 | 113 | self._connect_child(argv) |
118 | 114 | |
119 | 115 | def send(self, data): |
120 | 116 | """Queue `data` for sending to Nvim.""" |
121 | pass # replaces next logging statement | |
122 | #debug("Sending '%s'", data) | |
117 | debug("Sending '%s'", data) | |
123 | 118 | self._send(data) |
124 | 119 | |
125 | 120 | def threadsafe_call(self, fn): |
144 | 139 | self._on_data = data_cb |
145 | 140 | if threading.current_thread() == main_thread: |
146 | 141 | self._setup_signals([signal.SIGINT, signal.SIGTERM]) |
147 | pass # replaces next logging statement | |
148 | #debug('Entering event loop') | |
142 | debug('Entering event loop') | |
149 | 143 | self._run() |
150 | pass # replaces next logging statement | |
151 | #debug('Exited event loop') | |
144 | debug('Exited event loop') | |
152 | 145 | if threading.current_thread() == main_thread: |
153 | 146 | self._teardown_signals() |
154 | 147 | signal.signal(signal.SIGINT, default_int_handler) |
157 | 150 | def stop(self): |
158 | 151 | """Stop the event loop.""" |
159 | 152 | self._stop() |
160 | pass # replaces next logging statement | |
161 | #debug('Stopped event loop') | |
153 | debug('Stopped event loop') | |
162 | 154 | |
163 | 155 | def close(self): |
164 | 156 | """Stop the event loop.""" |
165 | 157 | self._close() |
166 | pass # replaces next logging statement | |
167 | #debug('Closed event loop') | |
158 | debug('Closed event loop') | |
168 | 159 | |
169 | 160 | def _on_signal(self, signum): |
170 | 161 | msg = 'Received {}'.format(self._signames[signum]) |
171 | pass # replaces next logging statement | |
172 | #debug(msg) | |
162 | debug(msg) | |
173 | 163 | if signum == signal.SIGINT and self._transport_type == 'stdio': |
174 | 164 | # When the transport is stdio, we are probably running as a Nvim |
175 | 165 | # child process. In that case, we don't want to be killed by |
182 | 172 | self.stop() |
183 | 173 | |
184 | 174 | def _on_error(self, error): |
185 | pass # replaces next logging statement | |
186 | #debug(error) | |
175 | debug(error) | |
187 | 176 | self._error = OSError(error) |
188 | 177 | self.stop() |
189 | 178 |
29 | 29 | |
30 | 30 | def send(self, msg): |
31 | 31 | """Queue `msg` for sending to Nvim.""" |
32 | pass # replaces next logging statement | |
33 | #debug('sent %s', msg) | |
32 | debug('sent %s', msg) | |
34 | 33 | self.loop.send(self._packer.pack(msg)) |
35 | 34 | |
36 | 35 | def run(self, message_cb): |
55 | 54 | self._unpacker.feed(data) |
56 | 55 | while True: |
57 | 56 | try: |
58 | pass # replaces next logging statement | |
59 | #debug('waiting for message...') | |
57 | debug('waiting for message...') | |
60 | 58 | msg = next(self._unpacker) |
61 | pass # replaces next logging statement | |
62 | #debug('received message: %s', msg) | |
59 | debug('received message: %s', msg) | |
63 | 60 | self._message_cb(msg) |
64 | 61 | except StopIteration: |
65 | pass # replaces next logging statement | |
66 | #debug('unpacker needs more data...') | |
62 | debug('unpacker needs more data...') | |
67 | 63 | break |
37 | 37 | try: |
38 | 38 | fn(*args, **kwargs) |
39 | 39 | except Exception: |
40 | pass # replaces next logging statement | |
41 | #warn("error caught while excecuting async callback\n%s\n", | |
42 | #format_exc()) | |
40 | warn("error caught while executing async callback\n%s\n", | |
41 | format_exc()) | |
43 | 42 | |
44 | 43 | def greenlet_wrapper(): |
45 | 44 | gr = greenlet.greenlet(handler) |
98 | 97 | raise OSError('EOF') |
99 | 98 | err, rv = v |
100 | 99 | if err: |
101 | pass # replaces next logging statement | |
102 | #info("'Received error: %s", err) | |
100 | info("'Received error: %s", err) | |
103 | 101 | raise self.error_wrapper(err) |
104 | 102 | return rv |
105 | 103 | |
128 | 126 | gr.switch() |
129 | 127 | |
130 | 128 | if self._setup_exception: |
131 | pass # replaces next logging statement | |
132 | #error('Setup error: {}'.format(self._setup_exception)) | |
129 | error('Setup error: {}'.format(self._setup_exception)) | |
133 | 130 | raise self._setup_exception |
134 | 131 | |
135 | 132 | # Process all pending requests and notifications |
158 | 155 | parent = gr.parent |
159 | 156 | |
160 | 157 | def response_cb(err, rv): |
161 | pass # replaces next logging statement | |
162 | #debug('response is available for greenlet %s, switching back', gr) | |
158 | debug('response is available for greenlet %s, switching back', gr) | |
163 | 159 | gr.switch(err, rv) |
164 | 160 | |
165 | 161 | self._async_session.request(method, args, response_cb) |
166 | pass # replaces next logging statement | |
167 | #debug('yielding from greenlet %s to wait for response', gr) | |
162 | debug('yielding from greenlet %s to wait for response', gr) | |
168 | 163 | return parent.switch() |
169 | 164 | |
170 | 165 | def _blocking_request(self, method, args): |
197 | 192 | def handler(): |
198 | 193 | try: |
199 | 194 | rv = self._request_cb(name, args) |
200 | pass # replaces next logging statement | |
201 | #debug('greenlet %s finished executing, ' | |
202 | #+ 'sending %s as response', gr, rv) | |
195 | debug('greenlet %s finished executing, ' | |
196 | + 'sending %s as response', gr, rv) | |
203 | 197 | response.send(rv) |
204 | 198 | except ErrorResponse as err: |
205 | pass # replaces next logging statement | |
206 | #warn("error response from request '%s %s': %s", name, | |
207 | #args, format_exc()) | |
199 | warn("error response from request '%s %s': %s", name, | |
200 | args, format_exc()) | |
208 | 201 | response.send(err.args[0], error=True) |
209 | 202 | except Exception as err: |
210 | pass # replaces next logging statement | |
211 | #warn("error caught while processing request '%s %s': %s", name, | |
212 | #args, format_exc()) | |
203 | warn("error caught while processing request '%s %s': %s", name, | |
204 | args, format_exc()) | |
213 | 205 | response.send(repr(err) + "\n" + format_exc(5), error=True) |
214 | pass # replaces next logging statement | |
215 | #debug('greenlet %s is now dying...', gr) | |
206 | debug('greenlet %s is now dying...', gr) | |
216 | 207 | |
217 | 208 | # Create a new greenlet to handle the request |
218 | 209 | gr = greenlet.greenlet(handler) |
219 | pass # replaces next logging statement | |
220 | #debug('received rpc request, greenlet %s will handle it', gr) | |
210 | debug('received rpc request, greenlet %s will handle it', gr) | |
221 | 211 | gr.switch() |
222 | 212 | |
223 | 213 | def _on_notification(self, name, args): |
224 | 214 | def handler(): |
225 | 215 | try: |
226 | 216 | self._notification_cb(name, args) |
227 | pass # replaces next logging statement | |
228 | #debug('greenlet %s finished executing', gr) | |
217 | debug('greenlet %s finished executing', gr) | |
229 | 218 | except Exception: |
230 | pass # replaces next logging statement | |
231 | #warn("error caught while processing notification '%s %s': %s", | |
232 | #name, args, format_exc()) | |
233 | ||
234 | pass # replaces next logging statement | |
235 | #debug('greenlet %s is now dying...', gr) | |
219 | warn("error caught while processing notification '%s %s': %s", | |
220 | name, args, format_exc()) | |
221 | ||
222 | debug('greenlet %s is now dying...', gr) | |
236 | 223 | |
237 | 224 | gr = greenlet.greenlet(handler) |
238 | pass # replaces next logging statement | |
239 | #debug('received rpc notification, greenlet %s will handle it', gr) | |
225 | debug('received rpc notification, greenlet %s will handle it', gr) | |
240 | 226 | gr.switch() |
241 | 227 | |
242 | 228 |
88 | 88 | self._discover_functions(plugin, module_handlers, path, False) |
89 | 89 | |
90 | 90 | if sync: |
91 | self._request_handlers[name](*args) | |
91 | return self._request_handlers[name](*args) | |
92 | 92 | else: |
93 | self._notification_handlers[name](*args) | |
93 | return self._notification_handlers[name](*args) | |
94 | 94 | |
95 | 95 | def _wrap_function(self, fn, sync, decode, nvim_bind, name, *args): |
96 | 96 | if decode: |
116 | 116 | handler = self._request_handlers.get(name, None) |
117 | 117 | if not handler: |
118 | 118 | msg = self._missing_handler_error(name, 'request') |
119 | pass # replaces next logging statement | |
120 | #error(msg) | |
119 | error(msg) | |
121 | 120 | raise ErrorResponse(msg) |
122 | 121 | |
123 | pass # replaces next logging statement | |
124 | #debug('calling request handler for "%s", args: "%s"', name, args) | |
122 | debug('calling request handler for "%s", args: "%s"', name, args) | |
125 | 123 | rv = handler(*args) |
126 | pass # replaces next logging statement | |
127 | #debug("request handler for '%s %s' returns: %s", name, args, rv) | |
124 | debug("request handler for '%s %s' returns: %s", name, args, rv) | |
128 | 125 | return rv |
129 | 126 | |
130 | 127 | def _on_notification(self, name, args): |
134 | 131 | handler = self._notification_handlers.get(name, None) |
135 | 132 | if not handler: |
136 | 133 | msg = self._missing_handler_error(name, 'notification') |
137 | pass # replaces next logging statement | |
138 | #error(msg) | |
134 | error(msg) | |
139 | 135 | self._on_async_err(msg + "\n") |
140 | 136 | return |
141 | 137 | |
142 | pass # replaces next logging statement | |
143 | #debug('calling notification handler for "%s", args: "%s"', name, args) | |
138 | debug('calling notification handler for "%s", args: "%s"', name, args) | |
144 | 139 | handler(*args) |
145 | 140 | |
146 | 141 | def _missing_handler_error(self, name, kind): |
157 | 152 | for path in plugins: |
158 | 153 | err = None |
159 | 154 | if path in self._loaded: |
160 | pass # replaces next logging statement | |
161 | #error('{} is already loaded'.format(path)) | |
155 | error('{} is already loaded'.format(path)) | |
162 | 156 | continue |
163 | 157 | try: |
164 | 158 | if path == "script_host.py": |
172 | 166 | self._discover_classes(module, handlers, path) |
173 | 167 | self._discover_functions(module, handlers, path, False) |
174 | 168 | if not handlers: |
175 | pass # replaces next logging statement | |
176 | #error('{} exports no handlers'.format(path)) | |
169 | error('{} exports no handlers'.format(path)) | |
177 | 170 | continue |
178 | 171 | self._loaded[path] = {'handlers': handlers, 'module': module} |
179 | 172 | except Exception as e: |
180 | 173 | err = ('Encountered {} loading plugin at {}: {}\n{}' |
181 | 174 | .format(type(e).__name__, path, e, format_exc(5))) |
182 | pass # replaces next logging statement | |
183 | #error(err) | |
175 | error(err) | |
184 | 176 | self._load_errors[path] = err |
185 | 177 | |
186 | 178 | kind = ("script-host" if len(plugins) == 1 and has_script |
65 | 65 | forwarded to Nvim. |
66 | 66 | """ |
67 | 67 | self.nvim = nvim |
68 | pass # replaces next logging statement | |
69 | #info('install import hook/path') | |
68 | info('install import hook/path') | |
70 | 69 | self.hook = path_hook(nvim) |
71 | 70 | sys.path_hooks.append(self.hook) |
72 | 71 | nvim.VIM_SPECIAL_PATH = '_vim_path_' |
73 | 72 | sys.path.append(nvim.VIM_SPECIAL_PATH) |
74 | pass # replaces next logging statement | |
75 | #info('redirect sys.stdout and sys.stderr') | |
73 | info('redirect sys.stdout and sys.stderr') | |
76 | 74 | self.saved_stdout = sys.stdout |
77 | 75 | self.saved_stderr = sys.stderr |
78 | 76 | sys.stdout = RedirectStream(lambda data: nvim.out_write(data)) |
81 | 79 | def teardown(self): |
82 | 80 | """Restore state modified from the `setup` call.""" |
83 | 81 | nvim = self.nvim |
84 | pass # replaces next logging statement | |
85 | #info('uninstall import hook/path') | |
82 | info('uninstall import hook/path') | |
86 | 83 | sys.path.remove(nvim.VIM_SPECIAL_PATH) |
87 | 84 | sys.path_hooks.remove(self.hook) |
88 | pass # replaces next logging statement | |
89 | #info('restore sys.stdout and sys.stderr') | |
85 | info('restore sys.stdout and sys.stderr') | |
90 | 86 | sys.stdout = self.saved_stdout |
91 | 87 | sys.stderr = self.saved_stderr |
92 | 88 | |
103 | 99 | def python_execute_file(self, file_path, range_start, range_stop): |
104 | 100 | """Handle the `pyfile` ex command.""" |
105 | 101 | self._set_current_range(range_start, range_stop) |
106 | with open(file_path) as f: | |
102 | with open(file_path, 'rb') as f: | |
107 | 103 | script = compile(f.read(), file_path, 'exec') |
108 | 104 | try: |
109 | 105 | exec(script, self.module.__dict__) |
197 | 193 | |
198 | 194 | |
199 | 195 | def num_to_str(obj): |
200 | if isinstance(obj, num_types): | |
196 | if isinstance(obj, num_types) and not isinstance(obj, bool): | |
201 | 197 | return str(obj) |
202 | 198 | else: |
203 | 199 | return obj |
38 | 38 | return (name, VERSION.__dict__, type_, method_spec, attributes) |
39 | 39 | |
40 | 40 | |
41 | VERSION = Version(major=0, minor=4, patch=2, prerelease='') | |
41 | VERSION = Version(major=0, minor=4, patch=3, prerelease='') |
0 | 0 | Metadata-Version: 2.1 |
1 | 1 | Name: pynvim |
2 | Version: 0.4.2 | |
2 | Version: 0.4.3 | |
3 | 3 | Summary: Python client to neovim |
4 | 4 | Home-page: http://github.com/neovim/pynvim |
5 | Download-URL: https://github.com/neovim/pynvim/archive/0.4.3.tar.gz | |
5 | 6 | Author: Thiago de Arruda |
6 | 7 | Author-email: tpadilha84@gmail.com |
7 | 8 | License: Apache |
8 | Download-URL: https://github.com/neovim/pynvim/archive/0.4.2.tar.gz | |
9 | Description: UNKNOWN | |
10 | Platform: UNKNOWN | |
11 | 9 | Provides-Extra: pyuv |
12 | 10 | Provides-Extra: test |
11 | License-File: LICENSE |
34 | 34 | install_requires.append('greenlet') |
35 | 35 | |
36 | 36 | setup(name='pynvim', |
37 | version='0.4.2', | |
37 | version='0.4.3', | |
38 | 38 | description='Python client to neovim', |
39 | 39 | url='http://github.com/neovim/pynvim', |
40 | download_url='https://github.com/neovim/pynvim/archive/0.4.2.tar.gz', | |
40 | download_url='https://github.com/neovim/pynvim/archive/0.4.3.tar.gz', | |
41 | 41 | author='Thiago de Arruda', |
42 | 42 | author_email='tpadilha84@gmail.com', |
43 | 43 | license='Apache', |
14 | 14 | decorated = command('test', count=count_value)(function) |
15 | 15 | assert 'count' not in decorated._nvim_rpc_spec['opts'] |
16 | 16 | |
17 | # Test presesence with value of 0 | |
17 | # Test precedence with value of 0 | |
18 | 18 | count_value = 0 |
19 | 19 | decorated = command('test', count=count_value)(function) |
20 | 20 | assert 'count' in decorated._nvim_rpc_spec['opts'] |
27 | 27 | assert event[1] == 'nvim_error_event' |
28 | 28 | assert 'rplugin-host: Async request caused an error:\nboom\n' \ |
29 | 29 | in h._on_error_event(None, 'boom') |
30 | ||
31 | def test_legacy_vim_eval(vim): | |
32 | h = ScriptHost(vim) | |
33 | assert h.legacy_vim.eval('1') == '1' | |
34 | assert h.legacy_vim.eval('v:null') == None | |
35 | assert h.legacy_vim.eval('v:true') == True | |
36 | assert h.legacy_vim.eval('v:false') == False |