Closed bob3000 closed 7 months ago
Well, unsurprisingly, if you don't have a visual selection, :MoltenEvaluateVisual
doesn't work. But it definitely shouldn't crash like that.
thank you for the bug report, I'd imagine this is an easy fix.
Thanks for the quick reply and the fix. I can confirm that the exception doesn't occur anymore. However it's it's still not working as expected for me.
What you say makes perfect sense. According to the name of the command the first thing I actually tried was to invoke it with a visual selection but I was and I'm still being told no range allowed
š¤·š»āāļø
Here is a quick video demonstration https://asciinema.org/a/Ho2PkfyeYIpbAyXnIygQkFSfL
Yeah, it's weird. Inherited from magma. It uses the current visual selection, but you can't pass a range.
That's why it's called out in the README for being weird. You need to map it with :<c-u>MoltenEvaluateRange
from visual mode (or you can type that manually obviously). <c-u>
in the command line with just delete everything before the cursor, which will be the visual range in this case.
It is working now. Thanks a lot for your help šš» You're doing a great job!
`:checkhealth molten`
molten-nvim ~ - OK NeoVim >=0.9 - OK Python >=3.10 - OK Python module pynvim found - OK Python module jupyter-client found - WARNING Optional python module cairosvg not found - ADVICE: - pip install cairosvg - WARNING Optional python module pnglatex not found - ADVICE: - pip install pnglatex - WARNING Optional python module plotly not found - ADVICE: - pip install plotly - WARNING Optional python module kaleido not found - ADVICE: - pip install kaleido - WARNING Optional python module pyperclip not found - ADVICE: - pip install pyperclip - WARNING Optional python module nbformat not found - ADVICE: - pip install nbformat`:checkhealth provider` (the python parts)
provider (optional) ~ - pyenv: Path: /opt/homebrew/Cellar/pyenv/2.3.36/libexec/pyenv - pyenv: Root: /Users/user/.pyenv - Using: g:python3_host_prog = "/Users/user/.pyenv/shims/python" - Executable: /Users/user/.pyenv/shims/python - Python version: 3.10.13 - pynvim version: 0.5.0 - OK Latest pynvim is installed. Python virtualenv ~ - OK no $VIRTUAL_ENVDescription
09:25:34 msg_show MoltenEvaluateVisual Error invoking '/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten:command:MoltenEvaluateVisual' on channel 3 (python3-rplugin-host): error caught in request handler '/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten:command:MoltenEvaluateVisual [[]]': Traceback (most recent call last): File "/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten/utils.py", line 11, in inner func(self, args, kwargs) File "/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten/init.py", line 497, in command_evaluate_visual self.kernel_check("MoltenEvaluateVisual %k", self.nvim.current.buffer) File "/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten/init.py", line 586, in kernel_check self.nvim.command(c) File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pynvim/api/nvim.py", line 311, in command return self.request('nvim_command', string, kwargs) File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pynvim/api/nvim.py", line 199, in request res = self._session.request(name, args, kwargs) File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pynvim/msgpack_rpc/session.py", line 139, in request raise self.error_wrapper(err) pynvim.api.common.NvimError: function remote#define#CommandBootstrap[5]..remote#define#request[2]..remote#define#request, line 2: Vim(let):Error invoking '/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten:command:MoltenEvaluateVisual' on channel 3 (python3-rplugin-host): error caught in request handler '/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten:command:MoltenEvaluateVisual [['python3']]': Traceback (most recent call last): File "/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten/utils.py", line 11, in inner func(self, *args, *kwargs) File "/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten/init.py", line 512, in command_evaluate_visual self._do_evaluate(kernel, span) File "/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten/init.py", line 317, in _do_evaluate DynamicPosition(self.nvim, self.extmark_namespace, bufno, pos[0]), File "/Users/user/.local/share/nvim/lazy/molten-nvim/rplugin/python3/molten/position.py", line 42, in init self.extmark_id = self.nvim.funcs.nvim_buf_set_extmark( File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pynvim/api/nvim.py", line 323, in call return self.request('nvim_call_function', name, args, kwargs) File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pynvim/api/nvim.py", line 199, in request res = self._session.request(name, *args, **kwargs) File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pynvim/msgpack_rpc/session.py", line 139, in request raise self.error_wrapper(err) pynvim.api.common.NvimError: Vim:E5555: API call: Invalid 'line': out of range
Reproduction Steps
test file
execute commands with cursor on line 2
:MoltenInit
:MoltenEvaluateVisual
config (added to LazyVim)
pip freeze
Expected Behavior
Should evaluate to
hello world