Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JupyniumStartSync RPC channel closed. Stop sending all notifications. And firefox not waking up #91

Open
SupercoolBD opened this issue Aug 31, 2023 · 39 comments
Labels
bug Something isn't working

Comments

@SupercoolBD
Copy link

Describe the bug
I'm on Ubuntu WSL using pip install jupynium to install jupynium (This does not appear in the doc ... so I'm not sure if it's needed... )
I opened a file named test.ju.py as suggested in the quick start session and run :JupyniumStartAndAttachToServer

it shows [Jupynium]: Jupynium successfully attached and initialised. Run :JupyniumStartSync (also firefox does not spawn...)
I did as suggested . Run the command but then I was greeted with

Jupynium : RPC channel closed. Stop sending all notifications.
[Jupynium]: Cancelling sync.....

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
after running JupyniumStartAndAttachToServer, firefox windows should show up and then jupyniumstartsync should reflects what is edited in real time.

Output when using jupynium command
If you launch Jupynium server using the command line program, it gives you more helpful logs.

Paste the output here

Output of jupynium --version

Paste the output here

Output of nvim --version

Paste your output here

Additional context
Add any other context about the problem here.

@SupercoolBD SupercoolBD added the bug Something isn't working label Aug 31, 2023
@kiyoon
Copy link
Owner

kiyoon commented Aug 31, 2023

Can you paste the logs found in /tmp/jupynium/logs?

Usually, firefox has to spawn. Did you install firefox in WSL?
You can check if selenium works in your environment, by running this python script.

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://www.selenium.dev/selenium/web/web-form.html")

@SupercoolBD
Copy link
Author

SupercoolBD commented Sep 1, 2023

The error occurred when running the above code... selenium doesn't seem to be working:

`:!python /home/will/Python_Projects/test.py
Traceback (most recent call last):
File "/home/will/Python_Projects/test.py", line 3, in
driver = webdriver.Firefox()
^^^^^^^^^^^^^^^^^^^
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/firefox/webdriver.py", line 67, in init
super().init(command_executor=executor, options=options)
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 206, in init
self.start_session(capabilities)
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 290, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 345, in execute
self.error_handler.check_response(response)
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executable

shell returned 1`

Logs from /tmp/jupynium/logs
2023-09-01 10:50:17,561 - jupynium.pynvim_helpers: 11 - INFO - nvim addr: /run/user/1000//lvim.49183.0
2023-09-01 10:50:17,561 - asyncio: 54 - DEBUG - Using selector: EpollSelector
2023-09-01 10:50:17,562 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [2, b'nvim_set_client_info', ('python3-client', {'major': 0, 'minor': 4, 'patch': 3, 'prerelease': ''}, 'remote', {}, {'license': 'Apache v2', 'website': 'github.com/neovim/pynvim'})]
2023-09-01 10:50:17,562 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x93\x02\xc4\x14nvim_set_client_info\x95\xaepython3-client\x84\xa5major\x00\xa5minor\x04\xa5patch\x03\xaaprerelease\xa0\xa6remote\x80\x82\xa7license\xa9Apache v2\xa7website\xb8github.com/neovim/pynvim''
2023-09-01 10:50:17,562 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [0, 1, b'nvim_get_api_info', ()]
2023-09-01 10:50:17,562 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x94\x00\x01\xc4\x11nvim_get_api_info\x90''
2023-09-01 10:50:17,562 - pynvim.msgpack_rpc.event_loop.base: 143 - DEBUG - Entering event loop
2023-09-01 10:50:17,562 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,562 - pynvim.msgpack_rpc.msgpack_stream: 60 - DEBUG - received message: [1, 1, None, [4, {'version': {'major': 0, 'minor': 9, 'patch': 1, 'prerelease': False, 'api_level': 11, 'api_compatible': 0, 'api_prerelease': False}, 'functions': [{'since': 9, 'parameters': [['Dictionary', 'opts']], 'return_type': 'Array', 'method': False, 'name': 'nvim_get_autocmds'}, {'since': 9, 'parameters': [['Object', 'event'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_create_autocmd'}, {'since': 9, 'parameters': [['Integer', 'id']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_autocmd'}, {'since': 9, 'parameters': [['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_clear_autocmds'}, {'since': 9, 'parameters': [['String', 'name'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_create_augroup'}, {'since': 9, 'parameters': [['Integer', 'id']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_augroup_by_id'}, {'since': 9, 'parameters': [['String', 'name']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_augroup_by_name'}, {'since': 9, 'parameters': [['Object', 'event'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_exec_autocmds'}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_line_count'}, {'since': 4, 'parameters': [['Buffer', 'buffer'], ['Boolean', 'send_buffer'], ['Dictionary', 'opts']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_attach'}, {'since': 4, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_detach'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'strict_indexing']], 'return_type': 'ArrayOf(String)', 'method': True, 'name': 'nvim_buf_get_lines'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'strict_indexing'], ['ArrayOf(String)', 'replacement']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_lines'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start_row'], ['Integer', 'start_col'], ['Integer', 'end_row'], ['Integer', 'end_col'], ['ArrayOf(String)', 'replacement']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_text'}, {'since': 9, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start_row'], ['Integer', 'start_col'], ['Integer', 'end_row'], ['Integer', 'end_col'], ['Dictionary', 'opts']], 'return_type': 'ArrayOf(String)', 'method': True, 'name': 'nvim_buf_get_text'}, {'since': 5, 'parameters': [['Buffer', 'buffer'], ['Integer', 'index']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_get_offset'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_buf_get_var'}, {'since': 2, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_get_changedtick'}, {'since': 3, 'parameters': [['Buffer', 'buffer'], ['String', 'mode']], 'return_type': 'ArrayOf(Dictionary)', 'method': True, 'name': 'nvim_buf_get_keymap'}, {'since': 6, 'parameters': [['Buffer', 'buffer'], ['String', 'mode'], ['String', 'lhs'], ['String', 'rhs'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_keymap'}, {'since': 6, 'parameters': [['Buffer', 'buffer'], ['String', 'mode'], ['String', 'lhs']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_del_keymap'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_var'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_del_var'}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'String', 'method': True, 'name': 'nvim_buf_get_name'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_name'}, {'since': 5, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_is_loaded'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_delete'}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_is_valid'}, {'since': 8, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_del_mark'}, {'since': 8, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Integer', 'line'], ['Integer', 'col'], ['Dictionary', 'opts']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_set_mark'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'nvim_buf_get_mark'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['LuaRef', 'fun']], 'return_type': 'Object', 'method': True, 'name': 'nvim_buf_call'}, {'since': 10, 'parameters': [['String', 'str'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_parse_cmd'}, {'since': 10, 'parameters': [['Dictionary', 'cmd'], ['Dictionary', 'opts']], 'return_type': 'String', 'method': False, 'name': 'nvim_cmd'}, {'since': 9, 'parameters': [['String', 'name'], ['Object', 'command'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_create_user_command'}, {'since': 9, 'parameters': [['String', 'name']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_user_command'}, {'since': 9, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'command'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_create_user_command'}, {'since': 9, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_del_user_command'}, {'since': 4, 'parameters': [['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_commands'}, {'since': 4, 'parameters': [['Buffer', 'buffer'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': True, 'name': 'nvim_buf_get_commands'}, {'since': 7, 'parameters': [['String', 'src'], ['Boolean', 'output']], 'return_type': 'String', 'method': False, 'name': 'nvim_exec', 'deprecated_since': 11}, {'since': 1, 'parameters': [['String', 'command']], 'return_type': 'String', 'method': False, 'name': 'nvim_command_output', 'deprecated_since': 7}, {'since': 3, 'parameters': [['String', 'code'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'nvim_execute_lua', 'deprecated_since': 7}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_get_number', 'deprecated_since': 2}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'line_start'], ['Integer', 'line_end']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_clear_highlight', 'deprecated_since': 7}, {'since': 5, 'parameters': [['Buffer', 'buffer'], ['Integer', 'src_id'], ['Integer', 'line'], ['Array', 'chunks'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_set_virtual_text', 'deprecated_since': 8}, {'since': 3, 'parameters': [['Integer', 'hl_id'], ['Boolean', 'rgb']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_hl_by_id', 'deprecated_since': 9}, {'since': 3, 'parameters': [['String', 'name'], ['Boolean', 'rgb']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_hl_by_name', 'deprecated_since': 9}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'lnum'], ['ArrayOf(String)', 'lines']], 'return_type': 'void', 'method': False, 'name': 'buffer_insert', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'index']], 'return_type': 'String', 'method': False, 'name': 'buffer_get_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'index'], ['String', 'line']], 'return_type': 'void', 'method': False, 'name': 'buffer_set_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'index']], 'return_type': 'void', 'method': False, 'name': 'buffer_del_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'include_start'], ['Boolean', 'include_end']], 'return_type': 'ArrayOf(String)', 'method': False, 'name': 'buffer_get_line_slice', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'include_start'], ['Boolean', 'include_end'], ['ArrayOf(String)', 'replacement']], 'return_type': 'void', 'method': False, 'name': 'buffer_set_line_slice', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'value']], 'return_type': 'Object', 'method': False, 'name': 'buffer_set_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'buffer_del_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name'], ['Object', 'value']], 'return_type': 'Object', 'method': False, 'name': 'window_set_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'window_del_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name'], ['Object', 'value']], 'return_type': 'Object', 'method': False, 'name': 'tabpage_set_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'tabpage_del_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'Object', 'method': False, 'name': 'vim_set_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'vim_del_var', 'deprecated_since': 1}, {'since': 7, 'parameters': [['String', 'name']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_option_info'}, {'since': 5, 'parameters': [['String', 'name']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_create_namespace'}, {'since': 5, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_namespaces'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'id'], ['Dictionary', 'opts']], 'return_type': 'ArrayOf(Integer)', 'method': True, 'name': 'nvim_buf_get_extmark_by_id'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Object', 'start'], ['Object', 'end'], ['Dictionary', 'opts']], 'return_type': 'Array', 'method': True, 'name': 'nvim_buf_get_extmarks'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'line'], ['Integer', 'col'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_set_extmark'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'id']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_del_extmark'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['String', 'hl_group'], ['Integer', 'line'], ['Integer', 'col_start'], ['Integer', 'col_end']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_add_highlight'}, {'since': 5, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'line_start'], ['Integer', 'line_end']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_clear_namespace'}, {'since': 7, 'parameters': [['Integer', 'ns_id'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_decoration_provider'}, {'since': 9, 'parameters': [['String', 'name'], ['Dictionary', 'opts']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_option_value'}, {'since': 9, 'parameters': [['String', 'name'], ['Object', 'value'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_option_value'}, {'since': 7, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_all_options_info'}, {'since': 11, 'parameters': [['String', 'name'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_option_info2'}, {'since': 1, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_option'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_option'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_buf_get_option'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_option'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_win_get_option'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_option'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'ArrayOf(Window)', 'method': True, 'name': 'nvim_tabpage_list_wins'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_tabpage_get_var'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_tabpage_set_var'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_tabpage_del_var'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Window', 'method': True, 'name': 'nvim_tabpage_get_win'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_tabpage_get_number'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_tabpage_is_valid'}, {'since': 1, 'parameters': [['Integer', 'width'], ['Integer', 'height'], ['Dictionary', 'options']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_attach'}, {'since': 0, 'parameters': [['Integer', 'width'], ['Integer', 'height'], ['Boolean', 'enable_rgb']], 'return_type': 'void', 'method': False, 'name': 'ui_attach', 'deprecated_since': 1}, {'since': 11, 'parameters': [['Boolean', 'gained']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_set_focus'}, {'since': 1, 'parameters': [], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_detach'}, {'since': 1, 'parameters': [['Integer', 'width'], ['Integer', 'height']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_try_resize'}, {'since': 1, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_set_option'}, {'since': 6, 'parameters': [['Integer', 'grid'], ['Integer', 'width'], ['Integer', 'height']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_try_resize_grid'}, {'since': 6, 'parameters': [['Integer', 'height']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_pum_set_height'}, {'since': 7, 'parameters': [['Float', 'width'], ['Float', 'height'], ['Float', 'row'], ['Float', 'col']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_pum_set_bounds'}, {'since': 7, 'parameters': [['String', 'name']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_get_hl_id_by_name'}, {'since': 11, 'parameters': [['Integer', 'ns_id'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_hl'}, {'since': 7, 'parameters': [['Integer', 'ns_id'], ['String', 'name'], ['Dictionary', 'val']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_hl'}, {'since': 10, 'parameters': [['Integer', 'ns_id']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_hl_ns'}, {'since': 10, 'parameters': [['Integer', 'ns_id']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_hl_ns_fast'}, {'since': 1, 'parameters': [['String', 'keys'], ['String', 'mode'], ['Boolean', 'escape_ks']], 'return_type': 'void', 'method': False, 'name': 'nvim_feedkeys'}, {'since': 1, 'parameters': [['String', 'keys']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_input'}, {'since': 6, 'parameters': [['String', 'button'], ['String', 'action'], ['String', 'modifier'], ['Integer', 'grid'], ['Integer', 'row'], ['Integer', 'col']], 'return_type': 'void', 'method': False, 'name': 'nvim_input_mouse'}, {'since': 1, 'parameters': [['String', 'str'], ['Boolean', 'from_part'], ['Boolean', 'do_lt'], ['Boolean', 'special']], 'return_type': 'String', 'method': False, 'name': 'nvim_replace_termcodes'}, {'since': 7, 'parameters': [['String', 'code'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'nvim_exec_lua'}, {'since': 7, 'parameters': [['String', 'msg'], ['Integer', 'log_level'], ['Dictionary', 'opts']], 'return_type': 'Object', 'method': False, 'name': 'nvim_notify'}, {'since': 1, 'parameters': [['String', 'text']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_strwidth'}, {'since': 1, 'parameters': [], 'return_type': 'ArrayOf(String)', 'method': False, 'name': 'nvim_list_runtime_paths'}, {'since': 7, 'parameters': [['String', 'name'], ['Boolean', 'all']], 'return_type': 'ArrayOf(String)', 'method': False, 'name': 'nvim_get_runtime_file'}, {'since': 1, 'parameters': [['String', 'dir']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_dir'}, {'since': 1, 'parameters': [], 'return_type': 'String', 'method': False, 'name': 'nvim_get_current_line'}, {'since': 1, 'parameters': [['String', 'line']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_line'}, {'since': 1, 'parameters': [], 'return_type': 'void', 'method': False, 'name': 'nvim_del_current_line'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_var'}, {'since': 1, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_var'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_var'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_vvar'}, {'since': 6, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_vvar'}, {'since': 7, 'parameters': [['Array', 'chunks'], ['Boolean', 'history'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_echo'}, {'since': 1, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'nvim_out_write'}, {'since': 1, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'nvim_err_write'}, {'since': 1, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'nvim_err_writeln'}, {'since': 1, 'parameters': [], 'return_type': 'ArrayOf(Buffer)', 'method': False, 'name': 'nvim_list_bufs'}, {'since': 1, 'parameters': [], 'return_type': 'Buffer', 'method': False, 'name': 'nvim_get_current_buf'}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_buf'}, {'since': 1, 'parameters': [], 'return_type': 'ArrayOf(Window)', 'method': False, 'name': 'nvim_list_wins'}, {'since': 1, 'parameters': [], 'return_type': 'Window', 'method': False, 'name': 'nvim_get_current_win'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_win'}, {'since': 6, 'parameters': [['Boolean', 'listed'], ['Boolean', 'scratch']], 'return_type': 'Buffer', 'method': False, 'name': 'nvim_create_buf'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_open_term'}, {'since': 7, 'parameters': [['Integer', 'chan'], ['String', 'data']], 'return_type': 'void', 'method': False, 'name': 'nvim_chan_send'}, {'since': 1, 'parameters': [], 'return_type': 'ArrayOf(Tabpage)', 'method': False, 'name': 'nvim_list_tabpages'}, {'since': 1, 'parameters': [], 'return_type': 'Tabpage', 'method': False, 'name': 'nvim_get_current_tabpage'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_tabpage'}, {'since': 6, 'parameters': [['String', 'data'], ['Boolean', 'crlf'], ['Integer', 'phase']], 'return_type': 'Boolean', 'method': False, 'name': 'nvim_paste'}, {'since': 6, 'parameters': [['ArrayOf(String)', 'lines'], ['String', 'type'], ['Boolean', 'after'], ['Boolean', 'follow']], 'return_type': 'void', 'method': False, 'name': 'nvim_put'}, {'since': 1, 'parameters': [['String', 'event']], 'return_type': 'void', 'method': False, 'name': 'nvim_subscribe'}, {'since': 1, 'parameters': [['String', 'event']], 'return_type': 'void', 'method': False, 'name': 'nvim_unsubscribe'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_get_color_by_name'}, {'since': 1, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_color_map'}, {'since': 6, 'parameters': [['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_context'}, {'since': 6, 'parameters': [['Dictionary', 'dict']], 'return_type': 'Object', 'method': False, 'name': 'nvim_load_context'}, {'since': 2, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_mode'}, {'since': 3, 'parameters': [['String', 'mode']], 'return_type': 'ArrayOf(Dictionary)', 'method': False, 'name': 'nvim_get_keymap'}, {'since': 6, 'parameters': [['String', 'mode'], ['String', 'lhs'], ['String', 'rhs'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_keymap'}, {'since': 6, 'parameters': [['String', 'mode'], ['String', 'lhs']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_keymap'}, {'since': 1, 'parameters': [], 'return_type': 'Array', 'method': False, 'name': 'nvim_get_api_info'}, {'since': 4, 'parameters': [['String', 'name'], ['Dictionary', 'version'], ['String', 'type'], ['Dictionary', 'methods'], ['Dictionary', 'attributes']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_client_info'}, {'since': 4, 'parameters': [['Integer', 'chan']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_chan_info'}, {'since': 4, 'parameters': [], 'return_type': 'Array', 'method': False, 'name': 'nvim_list_chans'}, {'since': 1, 'parameters': [['Array', 'calls']], 'return_type': 'Array', 'method': False, 'name': 'nvim_call_atomic'}, {'since': 4, 'parameters': [], 'return_type': 'Array', 'method': False, 'name': 'nvim_list_uis'}, {'since': 4, 'parameters': [['Integer', 'pid']], 'return_type': 'Array', 'method': False, 'name': 'nvim_get_proc_children'}, {'since': 4, 'parameters': [['Integer', 'pid']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_proc'}, {'since': 6, 'parameters': [['Integer', 'item'], ['Boolean', 'insert'], ['Boolean', 'finish'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_select_popupmenu_item'}, {'since': 8, 'parameters': [['String', 'name']], 'return_type': 'Boolean', 'method': False, 'name': 'nvim_del_mark'}, {'since': 8, 'parameters': [['String', 'name'], ['Dictionary', 'opts']], 'return_type': 'Array', 'method': False, 'name': 'nvim_get_mark'}, {'since': 8, 'parameters': [['String', 'str'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_eval_statusline'}, {'since': 11, 'parameters': [['String', 'src'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_exec2'}, {'since': 1, 'parameters': [['String', 'command']], 'return_type': 'void', 'method': False, 'name': 'nvim_command'}, {'since': 1, 'parameters': [['String', 'expr']], 'return_type': 'Object', 'method': False, 'name': 'nvim_eval'}, {'since': 1, 'parameters': [['String', 'fn'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'nvim_call_function'}, {'since': 4, 'parameters': [['Object', 'dict'], ['String', 'fn'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'nvim_call_dict_function'}, {'since': 4, 'parameters': [['String', 'expr'], ['String', 'flags'], ['Boolean', 'highlight']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_parse_expression'}, {'since': 6, 'parameters': [['Buffer', 'buffer'], ['Boolean', 'enter'], ['Dictionary', 'config']], 'return_type': 'Window', 'method': False, 'name': 'nvim_open_win'}, {'since': 6, 'parameters': [['Window', 'window'], ['Dictionary', 'config']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_config'}, {'since': 6, 'parameters': [['Window', 'window']], 'return_type': 'Dictionary', 'method': True, 'name': 'nvim_win_get_config'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Buffer', 'method': True, 'name': 'nvim_win_get_buf'}, {'since': 5, 'parameters': [['Window', 'window'], ['Buffer', 'buffer']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_buf'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'nvim_win_get_cursor'}, {'since': 1, 'parameters': [['Window', 'window'], ['ArrayOf(Integer, 2)', 'pos']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_cursor'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_win_get_height'}, {'since': 1, 'parameters': [['Window', 'window'], ['Integer', 'height']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_height'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_win_get_width'}, {'since': 1, 'parameters': [['Window', 'window'], ['Integer', 'width']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_width'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_win_get_var'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_var'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_del_var'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'nvim_win_get_position'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Tabpage', 'method': True, 'name': 'nvim_win_get_tabpage'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_win_get_number'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_win_is_valid'}, {'since': 7, 'parameters': [['Window', 'window']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_hide'}, {'since': 6, 'parameters': [['Window', 'window'], ['Boolean', 'force']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_close'}, {'since': 7, 'parameters': [['Window', 'window'], ['LuaRef', 'fun']], 'return_type': 'Object', 'method': True, 'name': 'nvim_win_call'}, {'since': 10, 'parameters': [['Window', 'window'], ['Integer', 'ns_id']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_hl_ns'}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'buffer_line_count', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'strict_indexing']], 'return_type': 'ArrayOf(String)', 'method': True, 'name': 'buffer_get_lines', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'strict_indexing'], ['ArrayOf(String)', 'replacement']], 'return_type': 'void', 'method': True, 'name': 'buffer_set_lines', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'buffer_get_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'String', 'method': True, 'name': 'buffer_get_name', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'buffer_set_name', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Boolean', 'method': True, 'name': 'buffer_is_valid', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'buffer_get_mark', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'command']], 'return_type': 'String', 'method': False, 'name': 'vim_command_output', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'buffer_get_number', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'line_start'], ['Integer', 'line_end']], 'return_type': 'void', 'method': True, 'name': 'buffer_clear_highlight', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['String', 'hl_group'], ['Integer', 'line'], ['Integer', 'col_start'], ['Integer', 'col_end']], 'return_type': 'Integer', 'method': True, 'name': 'buffer_add_highlight', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'vim_set_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'vim_get_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'buffer_get_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'buffer_set_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'window_get_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'window_set_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'ArrayOf(Window)', 'method': True, 'name': 'tabpage_get_windows', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'tabpage_get_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Window', 'method': True, 'name': 'tabpage_get_window', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Boolean', 'method': True, 'name': 'tabpage_is_valid', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'void', 'method': False, 'name': 'ui_detach', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Integer', 'width'], ['Integer', 'height']], 'return_type': 'Object', 'method': False, 'name': 'ui_try_resize', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'keys'], ['String', 'mode'], ['Boolean', 'escape_ks']], 'return_type': 'void', 'method': False, 'name': 'vim_feedkeys', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'keys']], 'return_type': 'Integer', 'method': False, 'name': 'vim_input', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'str'], ['Boolean', 'from_part'], ['Boolean', 'do_lt'], ['Boolean', 'special']], 'return_type': 'String', 'method': False, 'name': 'vim_replace_termcodes', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'text']], 'return_type': 'Integer', 'method': False, 'name': 'vim_strwidth', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'ArrayOf(String)', 'method': False, 'name': 'vim_list_runtime_paths', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'dir']], 'return_type': 'void', 'method': False, 'name': 'vim_change_directory', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'String', 'method': False, 'name': 'vim_get_current_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'line']], 'return_type': 'void', 'method': False, 'name': 'vim_set_current_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'void', 'method': False, 'name': 'vim_del_current_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'vim_get_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'vim_get_vvar', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'vim_out_write', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'vim_err_write', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'vim_report_error', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'ArrayOf(Buffer)', 'method': False, 'name': 'vim_get_buffers', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Buffer', 'method': False, 'name': 'vim_get_current_buffer', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'void', 'method': False, 'name': 'vim_set_current_buffer', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'ArrayOf(Window)', 'method': False, 'name': 'vim_get_windows', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Window', 'method': False, 'name': 'vim_get_current_window', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'void', 'method': False, 'name': 'vim_set_current_window', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'ArrayOf(Tabpage)', 'method': False, 'name': 'vim_get_tabpages', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Tabpage', 'method': False, 'name': 'vim_get_current_tabpage', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'void', 'method': False, 'name': 'vim_set_current_tabpage', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'event']], 'return_type': 'void', 'method': False, 'name': 'vim_subscribe', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'event']], 'return_type': 'void', 'method': False, 'name': 'vim_unsubscribe', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Integer', 'method': False, 'name': 'vim_name_to_color', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'vim_get_color_map', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Array', 'method': False, 'name': 'vim_get_api_info', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'command']], 'return_type': 'void', 'method': False, 'name': 'vim_command', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'expr']], 'return_type': 'Object', 'method': False, 'name': 'vim_eval', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'fn'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'vim_call_function', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Buffer', 'method': True, 'name': 'window_get_buffer', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'window_get_cursor', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['ArrayOf(Integer, 2)', 'pos']], 'return_type': 'void', 'method': True, 'name': 'window_set_cursor', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'window_get_height', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['Integer', 'height']], 'return_type': 'void', 'method': True, 'name': 'window_set_height', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'window_get_width', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['Integer', 'width']], 'return_type': 'void', 'method': True, 'name': 'window_set_width', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'window_get_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'window_get_position', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Tabpage', 'method': True, 'name': 'window_get_tabpage', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Boolean', 'method': True, 'name': 'window_is_valid', 'deprecated_since': 1}], 'ui_events': [{'name': 'mode_info_set', 'since': 3, 'parameters': [['Boolean', 'enabled'], ['Array', 'cursor_styles']]}, {'name': 'update_menu', 'since': 3, 'parameters': []}, {'name': 'busy_start', 'since': 3, 'parameters': []}, {'name': 'busy_stop', 'since': 3, 'parameters': []}, {'name': 'mouse_on', 'since': 3, 'parameters': []}, {'name': 'mouse_off', 'since': 3, 'parameters': []}, {'name': 'mode_change', 'since': 3, 'parameters': [['String', 'mode'], ['Integer', 'mode_idx']]}, {'name': 'bell', 'since': 3, 'parameters': []}, {'name': 'visual_bell', 'since': 3, 'parameters': []}, {'name': 'flush', 'since': 3, 'parameters': []}, {'name': 'suspend', 'since': 3, 'parameters': []}, {'name': 'set_title', 'since': 3, 'parameters': [['String', 'title']]}, {'name': 'set_icon', 'since': 3, 'parameters': [['String', 'icon']]}, {'name': 'screenshot', 'since': 7, 'parameters': [['String', 'path']]}, {'name': 'option_set', 'since': 4, 'parameters': [['String', 'name'], ['Object', 'value']]}, {'name': 'update_fg', 'since': 3, 'parameters': [['Integer', 'fg']]}, {'name': 'update_bg', 'since': 3, 'parameters': [['Integer', 'bg']]}, {'name': 'update_sp', 'since': 3, 'parameters': [['Integer', 'sp']]}, {'name': 'resize', 'since': 3, 'parameters': [['Integer', 'width'], ['Integer', 'height']]}, {'name': 'clear', 'since': 3, 'parameters': []}, {'name': 'eol_clear', 'since': 3, 'parameters': []}, {'name': 'cursor_goto', 'since': 3, 'parameters': [['Integer', 'row'], ['Integer', 'col']]}, {'name': 'highlight_set', 'since': 3, 'parameters': [['Dictionary', 'attrs']]}, {'name': 'put', 'since': 3, 'parameters': [['String', 'str']]}, {'name': 'set_scroll_region', 'since': 3, 'parameters': [['Integer', 'top'], ['Integer', 'bot'], ['Integer', 'left'], ['Integer', 'right']]}, {'name': 'scroll', 'since': 3, 'parameters': [['Integer', 'count']]}, {'name': 'default_colors_set', 'since': 4, 'parameters': [['Integer', 'rgb_fg'], ['Integer', 'rgb_bg'], ['Integer', 'rgb_sp'], ['Integer', 'cterm_fg'], ['Integer', 'cterm_bg']]}, {'name': 'hl_attr_define', 'since': 5, 'parameters': [['Integer', 'id'], ['Dictionary', 'rgb_attrs'], ['Dictionary', 'cterm_attrs'], ['Array', 'info']]}, {'name': 'hl_group_set', 'since': 6, 'parameters': [['String', 'name'], ['Integer', 'id']]}, {'name': 'grid_resize', 'since': 5, 'parameters': [['Integer', 'grid'], ['Integer', 'width'], ['Integer', 'height']]}, {'name': 'grid_clear', 'since': 5, 'parameters': [['Integer', 'grid']]}, {'name': 'grid_cursor_goto', 'since': 5, 'parameters': [['Integer', 'grid'], ['Integer', 'row'], ['Integer', 'col']]}, {'name': 'grid_line', 'since': 5, 'parameters': [['Integer', 'grid'], ['Integer', 'row'], ['Integer', 'col_start'], ['Array', 'data']]}, {'name': 'grid_scroll', 'since': 5, 'parameters': [['Integer', 'grid'], ['Integer', 'top'], ['Integer', 'bot'], ['Integer', 'left'], ['Integer', 'right'], ['Integer', 'rows'], ['Integer', 'cols']]}, {'name': 'grid_destroy', 'since': 6, 'parameters': [['Integer', 'grid']]}, {'name': 'win_pos', 'since': 6, 'parameters': [['Integer', 'grid'], ['Window', 'win'], ['Integer', 'startrow'], ['Integer', 'startcol'], ['Integer', 'width'], ['Integer', 'height']]}, {'name': 'win_float_pos', 'since': 6, 'parameters': [['Integer', 'grid'], ['Window', 'win'], ['String', 'anchor'], ['Integer', 'anchor_grid'], ['Float', 'anchor_row'], ['Float', 'anchor_col'], ['Boolean', 'focusable'], ['Integer', 'zindex']]}, {'name': 'win_external_pos', 'since': 6, 'parameters': [['Integer', 'grid'], ['Window', 'win']]}, {'name': 'win_hide', 'since': 6, 'parameters': [['Integer', 'grid']]}, {'name': 'win_close', 'since': 6, 'parameters': [['Integer', 'grid']]}, {'name': 'msg_set_pos', 'since': 6, 'parameters': [['Integer', 'grid'], ['Integer', 'row'], ['Boolean', 'scrolled'], ['String', 'sep_char']]}, {'name': 'win_viewport', 'since': 7, 'parameters': [['Integer', 'grid'], ['Window', 'win'], ['Integer', 'topline'], ['Integer', 'botline'], ['Integer', 'curline'], ['Integer', 'curcol'], ['Integer', 'line_count'], ['Integer', 'scroll_delta']]}, {'name': 'win_extmark', 'since': 10, 'parameters': [['Integer', 'grid'], ['Window', 'win'], ['Integer', 'ns_id'], ['Integer', 'mark_id'], ['Integer', 'row'], ['Integer', 'col']]}, {'name': 'popupmenu_show', 'since': 3, 'parameters': [['Array', 'items'], ['Integer', 'selected'], ['Integer', 'row'], ['Integer', 'col'], ['Integer', 'grid']]}, {'name': 'popupmenu_hide', 'since': 3, 'parameters': []}, {'name': 'popupmenu_select', 'since': 3, 'parameters': [['Integer', 'selected']]}, {'name': 'tabline_update', 'since': 3, 'parameters': [['Tabpage', 'current'], ['Array', 'tabs'], ['Buffer', 'current_buffer'], ['Array', 'buffers']]}, {'name': 'cmdline_show', 'since': 3, 'parameters': [['Array', 'content'], ['Integer', 'pos'], ['String', 'firstc'], ['String', 'prompt'], ['Integer', 'indent'], ['Integer', 'level']]}, {'name': 'cmdline_pos', 'since': 3, 'parameters': [['Integer', 'pos'], ['Integer', 'level']]}, {'name': 'cmdline_special_char', 'since': 3, 'parameters': [['String', 'c'], ['Boolean', 'shift'], ['Integer', 'level']]}, {'name': 'cmdline_hide', 'since': 3, 'parameters': [['Integer', 'level']]}, {'name': 'cmdline_block_show', 'since': 3, 'parameters': [['Array', 'lines']]}, {'name': 'cmdline_block_append', 'since': 3, 'parameters': [['Array', 'lines']]}, {'name': 'cmdline_block_hide', 'since': 3, 'parameters': []}, {'name': 'wildmenu_show', 'since': 3, 'parameters': [['Array', 'items']]}, {'name': 'wildmenu_select', 'since': 3, 'parameters': [['Integer', 'selected']]}, {'name': 'wildmenu_hide', 'since': 3, 'parameters': []}, {'name': 'msg_show', 'since': 6, 'parameters': [['String', 'kind'], ['Array', 'content'], ['Boolean', 'replace_last']]}, {'name': 'msg_clear', 'since': 6, 'parameters': []}, {'name': 'msg_showcmd', 'since': 6, 'parameters': [['Array', 'content']]}, {'name': 'msg_showmode', 'since': 6, 'parameters': [['Array', 'content']]}, {'name': 'msg_ruler', 'since': 6, 'parameters': [['Array', 'content']]}, {'name': 'msg_history_show', 'since': 6, 'parameters': [['Array', 'entries']]}, {'name': 'msg_history_clear', 'since': 10, 'parameters': []}], 'ui_options': ['rgb', 'ext_cmdline', 'ext_popupmenu', 'ext_tabline', 'ext_wildmenu', 'ext_messages', 'ext_linegrid', 'ext_multigrid', 'ext_hlstate', 'ext_termcolors'], 'error_types': {'Exception': {'id': 0}, 'Validation': {'id': 1}}, 'types': {'Buffer': {'id': 0, 'prefix': 'nvim_buf_'}, 'Window': {'id': 1, 'prefix': 'nvim_win_'}, 'Tabpage': {'id': 2, 'prefix': 'nvim_tabpage_'}}}]]
2023-09-01 10:50:17,563 - pynvim.msgpack_rpc.async_session: 100 - DEBUG - received response: None, [4, {'version': {'major': 0, 'minor': 9, 'patch': 1, 'prerelease': False, 'api_level': 11, 'api_compatible': 0, 'api_prerelease': False}, 'functions': [{'since': 9, 'parameters': [['Dictionary', 'opts']], 'return_type': 'Array', 'method': False, 'name': 'nvim_get_autocmds'}, {'since': 9, 'parameters': [['Object', 'event'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_create_autocmd'}, {'since': 9, 'parameters': [['Integer', 'id']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_autocmd'}, {'since': 9, 'parameters': [['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_clear_autocmds'}, {'since': 9, 'parameters': [['String', 'name'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_create_augroup'}, {'since': 9, 'parameters': [['Integer', 'id']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_augroup_by_id'}, {'since': 9, 'parameters': [['String', 'name']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_augroup_by_name'}, {'since': 9, 'parameters': [['Object', 'event'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_exec_autocmds'}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_line_count'}, {'since': 4, 'parameters': [['Buffer', 'buffer'], ['Boolean', 'send_buffer'], ['Dictionary', 'opts']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_attach'}, {'since': 4, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_detach'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'strict_indexing']], 'return_type': 'ArrayOf(String)', 'method': True, 'name': 'nvim_buf_get_lines'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'strict_indexing'], ['ArrayOf(String)', 'replacement']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_lines'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start_row'], ['Integer', 'start_col'], ['Integer', 'end_row'], ['Integer', 'end_col'], ['ArrayOf(String)', 'replacement']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_text'}, {'since': 9, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start_row'], ['Integer', 'start_col'], ['Integer', 'end_row'], ['Integer', 'end_col'], ['Dictionary', 'opts']], 'return_type': 'ArrayOf(String)', 'method': True, 'name': 'nvim_buf_get_text'}, {'since': 5, 'parameters': [['Buffer', 'buffer'], ['Integer', 'index']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_get_offset'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_buf_get_var'}, {'since': 2, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_get_changedtick'}, {'since': 3, 'parameters': [['Buffer', 'buffer'], ['String', 'mode']], 'return_type': 'ArrayOf(Dictionary)', 'method': True, 'name': 'nvim_buf_get_keymap'}, {'since': 6, 'parameters': [['Buffer', 'buffer'], ['String', 'mode'], ['String', 'lhs'], ['String', 'rhs'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_keymap'}, {'since': 6, 'parameters': [['Buffer', 'buffer'], ['String', 'mode'], ['String', 'lhs']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_del_keymap'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_var'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_del_var'}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'String', 'method': True, 'name': 'nvim_buf_get_name'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_name'}, {'since': 5, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_is_loaded'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_delete'}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_is_valid'}, {'since': 8, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_del_mark'}, {'since': 8, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Integer', 'line'], ['Integer', 'col'], ['Dictionary', 'opts']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_set_mark'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'nvim_buf_get_mark'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['LuaRef', 'fun']], 'return_type': 'Object', 'method': True, 'name': 'nvim_buf_call'}, {'since': 10, 'parameters': [['String', 'str'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_parse_cmd'}, {'since': 10, 'parameters': [['Dictionary', 'cmd'], ['Dictionary', 'opts']], 'return_type': 'String', 'method': False, 'name': 'nvim_cmd'}, {'since': 9, 'parameters': [['String', 'name'], ['Object', 'command'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_create_user_command'}, {'since': 9, 'parameters': [['String', 'name']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_user_command'}, {'since': 9, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'command'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_create_user_command'}, {'since': 9, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_del_user_command'}, {'since': 4, 'parameters': [['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_commands'}, {'since': 4, 'parameters': [['Buffer', 'buffer'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': True, 'name': 'nvim_buf_get_commands'}, {'since': 7, 'parameters': [['String', 'src'], ['Boolean', 'output']], 'return_type': 'String', 'method': False, 'name': 'nvim_exec', 'deprecated_since': 11}, {'since': 1, 'parameters': [['String', 'command']], 'return_type': 'String', 'method': False, 'name': 'nvim_command_output', 'deprecated_since': 7}, {'since': 3, 'parameters': [['String', 'code'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'nvim_execute_lua', 'deprecated_since': 7}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_get_number', 'deprecated_since': 2}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'line_start'], ['Integer', 'line_end']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_clear_highlight', 'deprecated_since': 7}, {'since': 5, 'parameters': [['Buffer', 'buffer'], ['Integer', 'src_id'], ['Integer', 'line'], ['Array', 'chunks'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_set_virtual_text', 'deprecated_since': 8}, {'since': 3, 'parameters': [['Integer', 'hl_id'], ['Boolean', 'rgb']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_hl_by_id', 'deprecated_since': 9}, {'since': 3, 'parameters': [['String', 'name'], ['Boolean', 'rgb']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_hl_by_name', 'deprecated_since': 9}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'lnum'], ['ArrayOf(String)', 'lines']], 'return_type': 'void', 'method': False, 'name': 'buffer_insert', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'index']], 'return_type': 'String', 'method': False, 'name': 'buffer_get_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'index'], ['String', 'line']], 'return_type': 'void', 'method': False, 'name': 'buffer_set_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'index']], 'return_type': 'void', 'method': False, 'name': 'buffer_del_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'include_start'], ['Boolean', 'include_end']], 'return_type': 'ArrayOf(String)', 'method': False, 'name': 'buffer_get_line_slice', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'include_start'], ['Boolean', 'include_end'], ['ArrayOf(String)', 'replacement']], 'return_type': 'void', 'method': False, 'name': 'buffer_set_line_slice', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'value']], 'return_type': 'Object', 'method': False, 'name': 'buffer_set_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'buffer_del_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name'], ['Object', 'value']], 'return_type': 'Object', 'method': False, 'name': 'window_set_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'window_del_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name'], ['Object', 'value']], 'return_type': 'Object', 'method': False, 'name': 'tabpage_set_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'tabpage_del_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'Object', 'method': False, 'name': 'vim_set_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'vim_del_var', 'deprecated_since': 1}, {'since': 7, 'parameters': [['String', 'name']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_option_info'}, {'since': 5, 'parameters': [['String', 'name']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_create_namespace'}, {'since': 5, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_namespaces'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'id'], ['Dictionary', 'opts']], 'return_type': 'ArrayOf(Integer)', 'method': True, 'name': 'nvim_buf_get_extmark_by_id'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Object', 'start'], ['Object', 'end'], ['Dictionary', 'opts']], 'return_type': 'Array', 'method': True, 'name': 'nvim_buf_get_extmarks'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'line'], ['Integer', 'col'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_set_extmark'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'id']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_buf_del_extmark'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['String', 'hl_group'], ['Integer', 'line'], ['Integer', 'col_start'], ['Integer', 'col_end']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_buf_add_highlight'}, {'since': 5, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'line_start'], ['Integer', 'line_end']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_clear_namespace'}, {'since': 7, 'parameters': [['Integer', 'ns_id'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_decoration_provider'}, {'since': 9, 'parameters': [['String', 'name'], ['Dictionary', 'opts']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_option_value'}, {'since': 9, 'parameters': [['String', 'name'], ['Object', 'value'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_option_value'}, {'since': 7, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_all_options_info'}, {'since': 11, 'parameters': [['String', 'name'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_option_info2'}, {'since': 1, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_option'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_option'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_buf_get_option'}, {'since': 1, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_buf_set_option'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_win_get_option'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_option'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'ArrayOf(Window)', 'method': True, 'name': 'nvim_tabpage_list_wins'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_tabpage_get_var'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_tabpage_set_var'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_tabpage_del_var'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Window', 'method': True, 'name': 'nvim_tabpage_get_win'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_tabpage_get_number'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_tabpage_is_valid'}, {'since': 1, 'parameters': [['Integer', 'width'], ['Integer', 'height'], ['Dictionary', 'options']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_attach'}, {'since': 0, 'parameters': [['Integer', 'width'], ['Integer', 'height'], ['Boolean', 'enable_rgb']], 'return_type': 'void', 'method': False, 'name': 'ui_attach', 'deprecated_since': 1}, {'since': 11, 'parameters': [['Boolean', 'gained']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_set_focus'}, {'since': 1, 'parameters': [], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_detach'}, {'since': 1, 'parameters': [['Integer', 'width'], ['Integer', 'height']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_try_resize'}, {'since': 1, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_set_option'}, {'since': 6, 'parameters': [['Integer', 'grid'], ['Integer', 'width'], ['Integer', 'height']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_try_resize_grid'}, {'since': 6, 'parameters': [['Integer', 'height']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_pum_set_height'}, {'since': 7, 'parameters': [['Float', 'width'], ['Float', 'height'], ['Float', 'row'], ['Float', 'col']], 'return_type': 'void', 'method': False, 'name': 'nvim_ui_pum_set_bounds'}, {'since': 7, 'parameters': [['String', 'name']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_get_hl_id_by_name'}, {'since': 11, 'parameters': [['Integer', 'ns_id'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_hl'}, {'since': 7, 'parameters': [['Integer', 'ns_id'], ['String', 'name'], ['Dictionary', 'val']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_hl'}, {'since': 10, 'parameters': [['Integer', 'ns_id']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_hl_ns'}, {'since': 10, 'parameters': [['Integer', 'ns_id']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_hl_ns_fast'}, {'since': 1, 'parameters': [['String', 'keys'], ['String', 'mode'], ['Boolean', 'escape_ks']], 'return_type': 'void', 'method': False, 'name': 'nvim_feedkeys'}, {'since': 1, 'parameters': [['String', 'keys']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_input'}, {'since': 6, 'parameters': [['String', 'button'], ['String', 'action'], ['String', 'modifier'], ['Integer', 'grid'], ['Integer', 'row'], ['Integer', 'col']], 'return_type': 'void', 'method': False, 'name': 'nvim_input_mouse'}, {'since': 1, 'parameters': [['String', 'str'], ['Boolean', 'from_part'], ['Boolean', 'do_lt'], ['Boolean', 'special']], 'return_type': 'String', 'method': False, 'name': 'nvim_replace_termcodes'}, {'since': 7, 'parameters': [['String', 'code'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'nvim_exec_lua'}, {'since': 7, 'parameters': [['String', 'msg'], ['Integer', 'log_level'], ['Dictionary', 'opts']], 'return_type': 'Object', 'method': False, 'name': 'nvim_notify'}, {'since': 1, 'parameters': [['String', 'text']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_strwidth'}, {'since': 1, 'parameters': [], 'return_type': 'ArrayOf(String)', 'method': False, 'name': 'nvim_list_runtime_paths'}, {'since': 7, 'parameters': [['String', 'name'], ['Boolean', 'all']], 'return_type': 'ArrayOf(String)', 'method': False, 'name': 'nvim_get_runtime_file'}, {'since': 1, 'parameters': [['String', 'dir']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_dir'}, {'since': 1, 'parameters': [], 'return_type': 'String', 'method': False, 'name': 'nvim_get_current_line'}, {'since': 1, 'parameters': [['String', 'line']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_line'}, {'since': 1, 'parameters': [], 'return_type': 'void', 'method': False, 'name': 'nvim_del_current_line'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_var'}, {'since': 1, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_var'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_var'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_vvar'}, {'since': 6, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_vvar'}, {'since': 7, 'parameters': [['Array', 'chunks'], ['Boolean', 'history'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_echo'}, {'since': 1, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'nvim_out_write'}, {'since': 1, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'nvim_err_write'}, {'since': 1, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'nvim_err_writeln'}, {'since': 1, 'parameters': [], 'return_type': 'ArrayOf(Buffer)', 'method': False, 'name': 'nvim_list_bufs'}, {'since': 1, 'parameters': [], 'return_type': 'Buffer', 'method': False, 'name': 'nvim_get_current_buf'}, {'since': 1, 'parameters': [['Buffer', 'buffer']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_buf'}, {'since': 1, 'parameters': [], 'return_type': 'ArrayOf(Window)', 'method': False, 'name': 'nvim_list_wins'}, {'since': 1, 'parameters': [], 'return_type': 'Window', 'method': False, 'name': 'nvim_get_current_win'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_win'}, {'since': 6, 'parameters': [['Boolean', 'listed'], ['Boolean', 'scratch']], 'return_type': 'Buffer', 'method': False, 'name': 'nvim_create_buf'}, {'since': 7, 'parameters': [['Buffer', 'buffer'], ['Dictionary', 'opts']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_open_term'}, {'since': 7, 'parameters': [['Integer', 'chan'], ['String', 'data']], 'return_type': 'void', 'method': False, 'name': 'nvim_chan_send'}, {'since': 1, 'parameters': [], 'return_type': 'ArrayOf(Tabpage)', 'method': False, 'name': 'nvim_list_tabpages'}, {'since': 1, 'parameters': [], 'return_type': 'Tabpage', 'method': False, 'name': 'nvim_get_current_tabpage'}, {'since': 1, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_current_tabpage'}, {'since': 6, 'parameters': [['String', 'data'], ['Boolean', 'crlf'], ['Integer', 'phase']], 'return_type': 'Boolean', 'method': False, 'name': 'nvim_paste'}, {'since': 6, 'parameters': [['ArrayOf(String)', 'lines'], ['String', 'type'], ['Boolean', 'after'], ['Boolean', 'follow']], 'return_type': 'void', 'method': False, 'name': 'nvim_put'}, {'since': 1, 'parameters': [['String', 'event']], 'return_type': 'void', 'method': False, 'name': 'nvim_subscribe'}, {'since': 1, 'parameters': [['String', 'event']], 'return_type': 'void', 'method': False, 'name': 'nvim_unsubscribe'}, {'since': 1, 'parameters': [['String', 'name']], 'return_type': 'Integer', 'method': False, 'name': 'nvim_get_color_by_name'}, {'since': 1, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_color_map'}, {'since': 6, 'parameters': [['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_context'}, {'since': 6, 'parameters': [['Dictionary', 'dict']], 'return_type': 'Object', 'method': False, 'name': 'nvim_load_context'}, {'since': 2, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_mode'}, {'since': 3, 'parameters': [['String', 'mode']], 'return_type': 'ArrayOf(Dictionary)', 'method': False, 'name': 'nvim_get_keymap'}, {'since': 6, 'parameters': [['String', 'mode'], ['String', 'lhs'], ['String', 'rhs'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_keymap'}, {'since': 6, 'parameters': [['String', 'mode'], ['String', 'lhs']], 'return_type': 'void', 'method': False, 'name': 'nvim_del_keymap'}, {'since': 1, 'parameters': [], 'return_type': 'Array', 'method': False, 'name': 'nvim_get_api_info'}, {'since': 4, 'parameters': [['String', 'name'], ['Dictionary', 'version'], ['String', 'type'], ['Dictionary', 'methods'], ['Dictionary', 'attributes']], 'return_type': 'void', 'method': False, 'name': 'nvim_set_client_info'}, {'since': 4, 'parameters': [['Integer', 'chan']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_get_chan_info'}, {'since': 4, 'parameters': [], 'return_type': 'Array', 'method': False, 'name': 'nvim_list_chans'}, {'since': 1, 'parameters': [['Array', 'calls']], 'return_type': 'Array', 'method': False, 'name': 'nvim_call_atomic'}, {'since': 4, 'parameters': [], 'return_type': 'Array', 'method': False, 'name': 'nvim_list_uis'}, {'since': 4, 'parameters': [['Integer', 'pid']], 'return_type': 'Array', 'method': False, 'name': 'nvim_get_proc_children'}, {'since': 4, 'parameters': [['Integer', 'pid']], 'return_type': 'Object', 'method': False, 'name': 'nvim_get_proc'}, {'since': 6, 'parameters': [['Integer', 'item'], ['Boolean', 'insert'], ['Boolean', 'finish'], ['Dictionary', 'opts']], 'return_type': 'void', 'method': False, 'name': 'nvim_select_popupmenu_item'}, {'since': 8, 'parameters': [['String', 'name']], 'return_type': 'Boolean', 'method': False, 'name': 'nvim_del_mark'}, {'since': 8, 'parameters': [['String', 'name'], ['Dictionary', 'opts']], 'return_type': 'Array', 'method': False, 'name': 'nvim_get_mark'}, {'since': 8, 'parameters': [['String', 'str'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_eval_statusline'}, {'since': 11, 'parameters': [['String', 'src'], ['Dictionary', 'opts']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_exec2'}, {'since': 1, 'parameters': [['String', 'command']], 'return_type': 'void', 'method': False, 'name': 'nvim_command'}, {'since': 1, 'parameters': [['String', 'expr']], 'return_type': 'Object', 'method': False, 'name': 'nvim_eval'}, {'since': 1, 'parameters': [['String', 'fn'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'nvim_call_function'}, {'since': 4, 'parameters': [['Object', 'dict'], ['String', 'fn'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'nvim_call_dict_function'}, {'since': 4, 'parameters': [['String', 'expr'], ['String', 'flags'], ['Boolean', 'highlight']], 'return_type': 'Dictionary', 'method': False, 'name': 'nvim_parse_expression'}, {'since': 6, 'parameters': [['Buffer', 'buffer'], ['Boolean', 'enter'], ['Dictionary', 'config']], 'return_type': 'Window', 'method': False, 'name': 'nvim_open_win'}, {'since': 6, 'parameters': [['Window', 'window'], ['Dictionary', 'config']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_config'}, {'since': 6, 'parameters': [['Window', 'window']], 'return_type': 'Dictionary', 'method': True, 'name': 'nvim_win_get_config'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Buffer', 'method': True, 'name': 'nvim_win_get_buf'}, {'since': 5, 'parameters': [['Window', 'window'], ['Buffer', 'buffer']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_buf'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'nvim_win_get_cursor'}, {'since': 1, 'parameters': [['Window', 'window'], ['ArrayOf(Integer, 2)', 'pos']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_cursor'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_win_get_height'}, {'since': 1, 'parameters': [['Window', 'window'], ['Integer', 'height']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_height'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_win_get_width'}, {'since': 1, 'parameters': [['Window', 'window'], ['Integer', 'width']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_width'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'nvim_win_get_var'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_var'}, {'since': 1, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_del_var'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'nvim_win_get_position'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Tabpage', 'method': True, 'name': 'nvim_win_get_tabpage'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'nvim_win_get_number'}, {'since': 1, 'parameters': [['Window', 'window']], 'return_type': 'Boolean', 'method': True, 'name': 'nvim_win_is_valid'}, {'since': 7, 'parameters': [['Window', 'window']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_hide'}, {'since': 6, 'parameters': [['Window', 'window'], ['Boolean', 'force']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_close'}, {'since': 7, 'parameters': [['Window', 'window'], ['LuaRef', 'fun']], 'return_type': 'Object', 'method': True, 'name': 'nvim_win_call'}, {'since': 10, 'parameters': [['Window', 'window'], ['Integer', 'ns_id']], 'return_type': 'void', 'method': True, 'name': 'nvim_win_set_hl_ns'}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'buffer_line_count', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'strict_indexing']], 'return_type': 'ArrayOf(String)', 'method': True, 'name': 'buffer_get_lines', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'start'], ['Integer', 'end'], ['Boolean', 'strict_indexing'], ['ArrayOf(String)', 'replacement']], 'return_type': 'void', 'method': True, 'name': 'buffer_set_lines', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'buffer_get_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'String', 'method': True, 'name': 'buffer_get_name', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'void', 'method': True, 'name': 'buffer_set_name', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Boolean', 'method': True, 'name': 'buffer_is_valid', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'buffer_get_mark', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'command']], 'return_type': 'String', 'method': False, 'name': 'vim_command_output', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'Integer', 'method': True, 'name': 'buffer_get_number', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['Integer', 'line_start'], ['Integer', 'line_end']], 'return_type': 'void', 'method': True, 'name': 'buffer_clear_highlight', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['Integer', 'ns_id'], ['String', 'hl_group'], ['Integer', 'line'], ['Integer', 'col_start'], ['Integer', 'col_end']], 'return_type': 'Integer', 'method': True, 'name': 'buffer_add_highlight', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': False, 'name': 'vim_set_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'vim_get_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'buffer_get_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'buffer_set_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'window_get_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name'], ['Object', 'value']], 'return_type': 'void', 'method': True, 'name': 'window_set_option', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'ArrayOf(Window)', 'method': True, 'name': 'tabpage_get_windows', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'tabpage_get_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Window', 'method': True, 'name': 'tabpage_get_window', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'Boolean', 'method': True, 'name': 'tabpage_is_valid', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'void', 'method': False, 'name': 'ui_detach', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Integer', 'width'], ['Integer', 'height']], 'return_type': 'Object', 'method': False, 'name': 'ui_try_resize', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'keys'], ['String', 'mode'], ['Boolean', 'escape_ks']], 'return_type': 'void', 'method': False, 'name': 'vim_feedkeys', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'keys']], 'return_type': 'Integer', 'method': False, 'name': 'vim_input', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'str'], ['Boolean', 'from_part'], ['Boolean', 'do_lt'], ['Boolean', 'special']], 'return_type': 'String', 'method': False, 'name': 'vim_replace_termcodes', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'text']], 'return_type': 'Integer', 'method': False, 'name': 'vim_strwidth', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'ArrayOf(String)', 'method': False, 'name': 'vim_list_runtime_paths', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'dir']], 'return_type': 'void', 'method': False, 'name': 'vim_change_directory', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'String', 'method': False, 'name': 'vim_get_current_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'line']], 'return_type': 'void', 'method': False, 'name': 'vim_set_current_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'void', 'method': False, 'name': 'vim_del_current_line', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'vim_get_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Object', 'method': False, 'name': 'vim_get_vvar', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'vim_out_write', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'vim_err_write', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'str']], 'return_type': 'void', 'method': False, 'name': 'vim_report_error', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'ArrayOf(Buffer)', 'method': False, 'name': 'vim_get_buffers', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Buffer', 'method': False, 'name': 'vim_get_current_buffer', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Buffer', 'buffer']], 'return_type': 'void', 'method': False, 'name': 'vim_set_current_buffer', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'ArrayOf(Window)', 'method': False, 'name': 'vim_get_windows', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Window', 'method': False, 'name': 'vim_get_current_window', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'void', 'method': False, 'name': 'vim_set_current_window', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'ArrayOf(Tabpage)', 'method': False, 'name': 'vim_get_tabpages', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Tabpage', 'method': False, 'name': 'vim_get_current_tabpage', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Tabpage', 'tabpage']], 'return_type': 'void', 'method': False, 'name': 'vim_set_current_tabpage', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'event']], 'return_type': 'void', 'method': False, 'name': 'vim_subscribe', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'event']], 'return_type': 'void', 'method': False, 'name': 'vim_unsubscribe', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'name']], 'return_type': 'Integer', 'method': False, 'name': 'vim_name_to_color', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Dictionary', 'method': False, 'name': 'vim_get_color_map', 'deprecated_since': 1}, {'since': 0, 'parameters': [], 'return_type': 'Array', 'method': False, 'name': 'vim_get_api_info', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'command']], 'return_type': 'void', 'method': False, 'name': 'vim_command', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'expr']], 'return_type': 'Object', 'method': False, 'name': 'vim_eval', 'deprecated_since': 1}, {'since': 0, 'parameters': [['String', 'fn'], ['Array', 'args']], 'return_type': 'Object', 'method': False, 'name': 'vim_call_function', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Buffer', 'method': True, 'name': 'window_get_buffer', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'window_get_cursor', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['ArrayOf(Integer, 2)', 'pos']], 'return_type': 'void', 'method': True, 'name': 'window_set_cursor', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'window_get_height', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['Integer', 'height']], 'return_type': 'void', 'method': True, 'name': 'window_set_height', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Integer', 'method': True, 'name': 'window_get_width', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['Integer', 'width']], 'return_type': 'void', 'method': True, 'name': 'window_set_width', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window'], ['String', 'name']], 'return_type': 'Object', 'method': True, 'name': 'window_get_var', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'ArrayOf(Integer, 2)', 'method': True, 'name': 'window_get_position', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Tabpage', 'method': True, 'name': 'window_get_tabpage', 'deprecated_since': 1}, {'since': 0, 'parameters': [['Window', 'window']], 'return_type': 'Boolean', 'method': True, 'name': 'window_is_valid', 'deprecated_since': 1}], 'ui_events': [{'name': 'mode_info_set', 'since': 3, 'parameters': [['Boolean', 'enabled'], ['Array', 'cursor_styles']]}, {'name': 'update_menu', 'since': 3, 'parameters': []}, {'name': 'busy_start', 'since': 3, 'parameters': []}, {'name': 'busy_stop', 'since': 3, 'parameters': []}, {'name': 'mouse_on', 'since': 3, 'parameters': []}, {'name': 'mouse_off', 'since': 3, 'parameters': []}, {'name': 'mode_change', 'since': 3, 'parameters': [['String', 'mode'], ['Integer', 'mode_idx']]}, {'name': 'bell', 'since': 3, 'parameters': []}, {'name': 'visual_bell', 'since': 3, 'parameters': []}, {'name': 'flush', 'since': 3, 'parameters': []}, {'name': 'suspend', 'since': 3, 'parameters': []}, {'name': 'set_title', 'since': 3, 'parameters': [['String', 'title']]}, {'name': 'set_icon', 'since': 3, 'parameters': [['String', 'icon']]}, {'name': 'screenshot', 'since': 7, 'parameters': [['String', 'path']]}, {'name': 'option_set', 'since': 4, 'parameters': [['String', 'name'], ['Object', 'value']]}, {'name': 'update_fg', 'since': 3, 'parameters': [['Integer', 'fg']]}, {'name': 'update_bg', 'since': 3, 'parameters': [['Integer', 'bg']]}, {'name': 'update_sp', 'since': 3, 'parameters': [['Integer', 'sp']]}, {'name': 'resize', 'since': 3, 'parameters': [['Integer', 'width'], ['Integer', 'height']]}, {'name': 'clear', 'since': 3, 'parameters': []}, {'name': 'eol_clear', 'since': 3, 'parameters': []}, {'name': 'cursor_goto', 'since': 3, 'parameters': [['Integer', 'row'], ['Integer', 'col']]}, {'name': 'highlight_set', 'since': 3, 'parameters': [['Dictionary', 'attrs']]}, {'name': 'put', 'since': 3, 'parameters': [['String', 'str']]}, {'name': 'set_scroll_region', 'since': 3, 'parameters': [['Integer', 'top'], ['Integer', 'bot'], ['Integer', 'left'], ['Integer', 'right']]}, {'name': 'scroll', 'since': 3, 'parameters': [['Integer', 'count']]}, {'name': 'default_colors_set', 'since': 4, 'parameters': [['Integer', 'rgb_fg'], ['Integer', 'rgb_bg'], ['Integer', 'rgb_sp'], ['Integer', 'cterm_fg'], ['Integer', 'cterm_bg']]}, {'name': 'hl_attr_define', 'since': 5, 'parameters': [['Integer', 'id'], ['Dictionary', 'rgb_attrs'], ['Dictionary', 'cterm_attrs'], ['Array', 'info']]}, {'name': 'hl_group_set', 'since': 6, 'parameters': [['String', 'name'], ['Integer', 'id']]}, {'name': 'grid_resize', 'since': 5, 'parameters': [['Integer', 'grid'], ['Integer', 'width'], ['Integer', 'height']]}, {'name': 'grid_clear', 'since': 5, 'parameters': [['Integer', 'grid']]}, {'name': 'grid_cursor_goto', 'since': 5, 'parameters': [['Integer', 'grid'], ['Integer', 'row'], ['Integer', 'col']]}, {'name': 'grid_line', 'since': 5, 'parameters': [['Integer', 'grid'], ['Integer', 'row'], ['Integer', 'col_start'], ['Array', 'data']]}, {'name': 'grid_scroll', 'since': 5, 'parameters': [['Integer', 'grid'], ['Integer', 'top'], ['Integer', 'bot'], ['Integer', 'left'], ['Integer', 'right'], ['Integer', 'rows'], ['Integer', 'cols']]}, {'name': 'grid_destroy', 'since': 6, 'parameters': [['Integer', 'grid']]}, {'name': 'win_pos', 'since': 6, 'parameters': [['Integer', 'grid'], ['Window', 'win'], ['Integer', 'startrow'], ['Integer', 'startcol'], ['Integer', 'width'], ['Integer', 'height']]}, {'name': 'win_float_pos', 'since': 6, 'parameters': [['Integer', 'grid'], ['Window', 'win'], ['String', 'anchor'], ['Integer', 'anchor_grid'], ['Float', 'anchor_row'], ['Float', 'anchor_col'], ['Boolean', 'focusable'], ['Integer', 'zindex']]}, {'name': 'win_external_pos', 'since': 6, 'parameters': [['Integer', 'grid'], ['Window', 'win']]}, {'name': 'win_hide', 'since': 6, 'parameters': [['Integer', 'grid']]}, {'name': 'win_close', 'since': 6, 'parameters': [['Integer', 'grid']]}, {'name': 'msg_set_pos', 'since': 6, 'parameters': [['Integer', 'grid'], ['Integer', 'row'], ['Boolean', 'scrolled'], ['String', 'sep_char']]}, {'name': 'win_viewport', 'since': 7, 'parameters': [['Integer', 'grid'], ['Window', 'win'], ['Integer', 'topline'], ['Integer', 'botline'], ['Integer', 'curline'], ['Integer', 'curcol'], ['Integer', 'line_count'], ['Integer', 'scroll_delta']]}, {'name': 'win_extmark', 'since': 10, 'parameters': [['Integer', 'grid'], ['Window', 'win'], ['Integer', 'ns_id'], ['Integer', 'mark_id'], ['Integer', 'row'], ['Integer', 'col']]}, {'name': 'popupmenu_show', 'since': 3, 'parameters': [['Array', 'items'], ['Integer', 'selected'], ['Integer', 'row'], ['Integer', 'col'], ['Integer', 'grid']]}, {'name': 'popupmenu_hide', 'since': 3, 'parameters': []}, {'name': 'popupmenu_select', 'since': 3, 'parameters': [['Integer', 'selected']]}, {'name': 'tabline_update', 'since': 3, 'parameters': [['Tabpage', 'current'], ['Array', 'tabs'], ['Buffer', 'current_buffer'], ['Array', 'buffers']]}, {'name': 'cmdline_show', 'since': 3, 'parameters': [['Array', 'content'], ['Integer', 'pos'], ['String', 'firstc'], ['String', 'prompt'], ['Integer', 'indent'], ['Integer', 'level']]}, {'name': 'cmdline_pos', 'since': 3, 'parameters': [['Integer', 'pos'], ['Integer', 'level']]}, {'name': 'cmdline_special_char', 'since': 3, 'parameters': [['String', 'c'], ['Boolean', 'shift'], ['Integer', 'level']]}, {'name': 'cmdline_hide', 'since': 3, 'parameters': [['Integer', 'level']]}, {'name': 'cmdline_block_show', 'since': 3, 'parameters': [['Array', 'lines']]}, {'name': 'cmdline_block_append', 'since': 3, 'parameters': [['Array', 'lines']]}, {'name': 'cmdline_block_hide', 'since': 3, 'parameters': []}, {'name': 'wildmenu_show', 'since': 3, 'parameters': [['Array', 'items']]}, {'name': 'wildmenu_select', 'since': 3, 'parameters': [['Integer', 'selected']]}, {'name': 'wildmenu_hide', 'since': 3, 'parameters': []}, {'name': 'msg_show', 'since': 6, 'parameters': [['String', 'kind'], ['Array', 'content'], ['Boolean', 'replace_last']]}, {'name': 'msg_clear', 'since': 6, 'parameters': []}, {'name': 'msg_showcmd', 'since': 6, 'parameters': [['Array', 'content']]}, {'name': 'msg_showmode', 'since': 6, 'parameters': [['Array', 'content']]}, {'name': 'msg_ruler', 'since': 6, 'parameters': [['Array', 'content']]}, {'name': 'msg_history_show', 'since': 6, 'parameters': [['Array', 'entries']]}, {'name': 'msg_history_clear', 'since': 10, 'parameters': []}], 'ui_options': ['rgb', 'ext_cmdline', 'ext_popupmenu', 'ext_tabline', 'ext_wildmenu', 'ext_messages', 'ext_linegrid', 'ext_multigrid', 'ext_hlstate', 'ext_termcolors'], 'error_types': {'Exception': {'id': 0}, 'Validation': {'id': 1}}, 'types': {'Buffer': {'id': 0, 'prefix': 'nvim_buf_'}, 'Window': {'id': 1, 'prefix': 'nvim_win_'}, 'Tabpage': {'id': 2, 'prefix': 'nvim_tabpage_'}}}]
2023-09-01 10:50:17,564 - pynvim.msgpack_rpc.event_loop.base: 154 - DEBUG - Stopped event loop
2023-09-01 10:50:17,564 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,564 - pynvim.msgpack_rpc.msgpack_stream: 63 - DEBUG - unpacker needs more data...
2023-09-01 10:50:17,564 - pynvim.msgpack_rpc.event_loop.base: 145 - DEBUG - Exited event loop
2023-09-01 10:50:17,565 - jupynium.pynvim_helpers: 30 - INFO - nvim attached
2023-09-01 10:50:17,565 - jupynium.pynvim_helpers: 34 - INFO - Initialising..
2023-09-01 10:50:17,565 - jupynium.pynvim_helpers: 35 - INFO - Communicating with channel_id 4
2023-09-01 10:50:17,565 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [0, 2, 'nvim_set_var', ('jupynium_channel_id', 4)]
2023-09-01 10:50:17,565 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x94\x00\x02\xacnvim_set_var\x92\xb3jupynium_channel_id\x04''
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.event_loop.base: 143 - DEBUG - Entering event loop
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 60 - DEBUG - received message: [1, 2, None, None]
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.async_session: 100 - DEBUG - received response: None, None
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.event_loop.base: 154 - DEBUG - Stopped event loop
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 63 - DEBUG - unpacker needs more data...
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.event_loop.base: 145 - DEBUG - Exited event loop
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [0, 3, 'nvim_set_var', ('jupynium_num_pending_msgs', 0)]
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x94\x00\x03\xacnvim_set_var\x92\xb9jupynium_num_pending_msgs\x00''
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.event_loop.base: 143 - DEBUG - Entering event loop
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 60 - DEBUG - received message: [1, 3, None, None]
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.async_session: 100 - DEBUG - received response: None, None
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.event_loop.base: 154 - DEBUG - Stopped event loop
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 63 - DEBUG - unpacker needs more data...
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.event_loop.base: 145 - DEBUG - Exited event loop
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [0, 4, 'nvim_execute_lua', ('-- Set default values\n-- It is not necessary but it's good for cleaning up logging messages.\n-- Also it is useful for users to understand what values exist.\n\n-- Option values. You can customise in your init.lua\nif vim.g.jupynium_auto_download_ipynb == nil then\n vim.g.jupynium_auto_download_ipynb = true\nend\n\nif vim.g.jupynium_autoscroll_enable == nil then\n vim.g.jupynium_autoscroll_enable = true\nend\n\nif vim.g.jupynium_autoscroll_mode == nil then\n vim.g.jupynium_autoscroll_mode = "always"\nend\n\nif vim.g.jupynium_autoscroll_cell_top_margin_percent == nil then\n vim.g.jupynium_autoscroll_cell_top_margin_percent = true\nend\n\nif vim.g.jupynium_scroll_page_step == nil then\n vim.g.jupynium_scroll_page_step = 0.5\nend\n\nif vim.g.jupynium_scroll_cell_top_margin_percent == nil then\n vim.g.jupynium_scroll_cell_top_margin_percent = 20\nend\n\n-- max messages = max(vim.api.nvim_buf_line_count(all_buffer), vim.g.jupynium_num_max_msgs)\n-- If we're processing more than this many events, ignore everything and perform full-sync instead.\n-- However, the full-sync can be more expensive depending on how big the files are.\n-- It's an old method I implemented to make things faster a little, but the current lazy processing seems to work much better so we can maybe deprecate this.\nif vim.g.jupynium_num_max_msgs == nil then\n vim.g.jupynium_num_max_msgs = 1000\nend\n\n-- System values. You should not customise in your init.lua\n-- These values are used for internal processing.\nif vim.g.jupynium_channel_id == nil then\n vim.g.jupynium_channel_id = -1\nend\n', [])]
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x94\x00\x04\xb0nvim_execute_lua\x92\xda\x06\x0b-- Set default values\n-- It is not necessary but it's good for cleaning up logging messages.\n-- Also it is useful for users to understand what values exist.\n\n-- Option values. You can customise in your init.lua\nif vim.g.jupynium_auto_download_ipynb == nil then\n vim.g.jupynium_auto_download_ipynb = true\nend\n\nif vim.g.jupynium_autoscroll_enable == nil then\n vim.g.jupynium_autoscroll_enable = true\nend\n\nif vim.g.jupynium_autoscroll_mode == nil then\n vim.g.jupynium_autoscroll_mode = "always"\nend\n\nif vim.g.jupynium_autoscroll_cell_top_margin_percent == nil then\n vim.g.jupynium_autoscroll_cell_top_margin_percent = true\nend\n\nif vim.g.jupynium_scroll_page_step == nil then\n vim.g.jupynium_scroll_page_step = 0.5\nend\n\nif vim.g.jupynium_scroll_cell_top_margin_percent == nil then\n vim.g.jupynium_scroll_cell_top_margin_percent = 20\nend\n\n-- max messages = max(vim.api.nvim_buf_line_count(all_buffer), vim.g.jupynium_num_max_msgs)\n-- If we're processing more than this many events, ignore everything and perform full-sync instead.\n-- However, the full-sync can be more expensive depending on how big the files are.\n-- It's an old method I implemented to make things faster a little, but the current lazy processing seems to work much better so we can maybe deprecate this.\nif vim.g.jupynium_num_max_msgs == nil then\n vim.g.jupynium_num_max_msgs = 1000\nend\n\n-- System values. You should not customise in your init.lua\n-- These values are used for internal processing.\nif vim.g.jupynium_channel_id == nil then\n vim.g.jupynium_channel_id = -1\nend\n\x90''
2023-09-01 10:50:17,566 - pynvim.msgpack_rpc.event_loop.base: 143 - DEBUG - Entering event loop
2023-09-01 10:50:17,567 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,567 - pynvim.msgpack_rpc.msgpack_stream: 60 - DEBUG - received message: [1, 4, None, None]
2023-09-01 10:50:17,567 - pynvim.msgpack_rpc.async_session: 100 - DEBUG - received response: None, None
2023-09-01 10:50:17,567 - pynvim.msgpack_rpc.event_loop.base: 154 - DEBUG - Stopped event loop
2023-09-01 10:50:17,567 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,567 - pynvim.msgpack_rpc.msgpack_stream: 63 - DEBUG - unpacker needs more data...
2023-09-01 10:50:17,567 - pynvim.msgpack_rpc.event_loop.base: 145 - DEBUG - Exited event loop
2023-09-01 10:50:17,567 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [0, 5, 'nvim_execute_lua', ('vim.g.jupynium_message_bloated = false\n\n-- This number is not strictly accurate. We only use this to detect blockage (bloated)\nvim.g.jupynium_num_pending_msgs = 0\n\n-- Remove syncing without sending stop message.\n-- Use when initialising or no Jupynium server is running.\nfunction Jupynium_reset_sync()\n for bufnr, _ in pairs(Jupynium_syncing_bufs) do\n -- This will clear autocmds if there are any\n vim.api.nvim_create_augroup(string.format("jupynium_buf_%d", bufnr), { clear = true })\n end\nend\n\nif Jupynium_syncing_bufs ~= nil then\n Jupynium_reset_sync()\nend\n\nJupynium_syncing_bufs = {} -- key = bufnr, value = 1\n\nfunction Jupynium_reset_channel()\n vim.g.jupynium_channel_id = -1\n vim.g.jupynium_message_bloated = false\n vim.g.jupynium_num_pending_msgs = 0\n Jupynium_reset_sync()\nend\n\nlocal function get_line_count_all_buffers()\n local line_count = 0\n for buf_id, _ in pairs(Jupynium_syncing_bufs) do\n line_count = line_count + vim.api.nvim_buf_line_count(buf_id)\n end\n return line_count\nend\n\nget_line_count_all_buffers()\n\nlocal function get_num_max_events()\n return math.max(vim.g.jupynium_num_max_msgs, get_line_count_all_buffers())\nend\n\nlocal function rpc(method, event, buf, ...)\n if vim.g.jupynium_channel_id ~= nil and vim.g.jupynium_channel_id > 0 then\n -- If bloated, wait until the messages are cleared\n -- Jupynium server should detect this and clear the messages\n -- And send grab_entire_buf\n if vim.g.jupynium_message_bloated then\n return\n end\n\n if vim.g.jupynium_num_pending_msgs < get_num_max_events() then\n vim.g.jupynium_num_pending_msgs = vim.g.jupynium_num_pending_msgs + 1\n local status, res = pcall(method, vim.g.jupynium_channel_id, event, buf, ...)\n if not status then\n print "Jupynium: RPC channel closed. Stop sending all notifications."\n Jupynium_reset_channel()\n else\n return res\n end\n else\n vim.g.jupynium_message_bloated = true\n end\n else\n Jupynium_reset_channel()\n end\nend\n\nfunction Jupynium_rpcnotify(event, buf, ensure_syncing, ...)\n -- check if it's already syncing\n if ensure_syncing then\n if Jupynium_syncing_bufs[buf] == nil then\n return\n end\n end\n rpc(vim.rpcnotify, event, buf, ...)\nend\n\n-- block until jupynium responds to the message\nfunction Jupynium_rpcrequest(event, buf, ensure_syncing, ...)\n if ensure_syncing then\n if Jupynium_syncing_bufs[buf] == nil then\n if event ~= "start_sync" then\n return\n end\n end\n end\n\n local response = rpc(vim.rpcrequest, event, buf, ...)\n return response\nend\n\n--- API: Execute javascript in the browser. It will switch to the correct tab before executing.\n---@param bufnr integer | nil If given, before executing the code it will switch to the tab of this buffer. Requires syncing in advance.\n---@param code string Javascript code\n---@return boolean, object: Success, response\nfunction Jupynium_execute_javascript(bufnr, code)\n local ensure_syncing = true\n if bufnr == nil then\n ensure_syncing = false\n elseif bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n\n if ensure_syncing and Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error {\n [[Cannot execute javascript because it's not synchronised]],\n [[Run :JupyniumStartSync or set bufnr=nil in Jupynium_execute_javascript()]],\n }\n return false, nil\n end\n\n -- set ensure_syncing to false, because we checked that already.\n return true, Jupynium_rpcrequest("execute_javascript", bufnr, false, code)\nend\n\nfunction Jupynium_grab_entire_buffer(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot grab buffer without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local entire_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)\n Jupynium_rpcnotify("grab_entire_buf", bufnr, true, entire_buf)\nend\n\nfunction Jupynium_load_from_ipynb_tab_cmd(args)\n local is_number = args.args:match "^%d+$"\n if is_number == nil then\n Jupynium_notify.error { "Tab index should be a number but got: " .. args.args }\n return\n end\n local tab_idx = tonumber(args.args)\n local buf = vim.api.nvim_get_current_buf()\n Jupynium_load_from_ipynb_tab(buf, tab_idx)\nend\n\nfunction Jupynium_load_from_ipynb_tab(bufnr, tab_idx)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n local response = Jupynium_rpcrequest("load_from_ipynb_tab", bufnr, false, tab_idx)\n\n if response ~= "OK" then\n Jupynium_notify.error { "Failed to load from ipynb tab" }\n end\nend\n\nfunction Jupynium_load_from_ipynb_tab_and_start_sync_cmd(args)\n local is_number = args.args:match "^%d+$"\n if is_number == nil then\n Jupynium_notify.error { "Tab index should be a number but got: " .. args.args }\n return\n end\n local tab_idx = tonumber(args.args)\n local buf = vim.api.nvim_get_current_buf()\n Jupynium_load_from_ipynb_tab_and_start_sync(buf, tab_idx)\nend\n\nfunction Jupynium_load_from_ipynb_tab_and_start_sync(bufnr, tab_idx)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n local response = Jupynium_rpcrequest("load_from_ipynb_tab", bufnr, false, tab_idx)\n\n if response == "OK" then\n -- start sync with no content copying from nvim and no asking.\n Jupynium_start_sync(bufnr, tostring(tab_idx), false)\n else\n Jupynium_notify.error { "Failed to load from ipynb tab" }\n end\nend\n\nfunction Jupynium_start_sync_cmd(args)\n local filename = args.args\n local buf = vim.api.nvim_get_current_buf()\n Jupynium_start_sync(buf, filename)\nend\n\n---Start synchronising the buffer with the ipynb file\n---@param bufnr integer buffer number\n---@param ipynb_filename string name of the ipynb file\n---@param ask boolean whether to ask for confirmation\nfunction Jupynium_start_sync(bufnr, ipynb_filename, ask)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if ask == nil then\n ask = true\n end\n\n -- This will clear autocmds if there are any\n local augroup = vim.api.nvim_create_augroup(string.format("jupynium_buf_%d", bufnr), { clear = true })\n\n if Jupynium_syncing_bufs[bufnr] ~= nil then\n Jupynium_notify.error { "Already syncing this buffer.", ":JupyniumStopSync to stop." }\n return\n end\n\n local content = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)\n\n -- Used for choosing the correct kernel\n local buf_filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")\n local conda_or_venv_path = vim.env.CONDA_PREFIX or vim.env.VIRTUAL_ENV\n\n local response =\n Jupynium_rpcrequest("start_sync", bufnr, false, ipynb_filename, ask, content, buf_filetype, conda_or_venv_path)\n if response ~= "OK" then\n Jupynium_notify.info { "Cancelling sync.." }\n return\n end\n\n Jupynium_syncing_bufs[bufnr] = 1\n\n vim.api.nvim_create_autocmd({ "CursorMoved" }, {\n buffer = bufnr,\n callback = function()\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n local cursor_pos_row = cursor_pos[1] - 1\n local visual_start_row = vim.fn.getpos("v")[2] - 1\n Jupynium_rpcnotify("CursorMoved", bufnr, true, cursor_pos_row, visual_start_row)\n end,\n group = augroup,\n })\n\n vim.api.nvim_create_autocmd({ "CursorMovedI" }, {\n buffer = bufnr,\n callback = function()\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n local cursor_pos_row = cursor_pos[1] - 1\n Jupynium_rpcnotify("CursorMovedI", bufnr, true, cursor_pos_row, cursor_pos_row)\n end,\n group = augroup,\n })\n\n -- Load completion items when cursor hold\n -- vim.api.nvim_create_autocmd({ "CursorHoldI" }, {\n -- buffer = bufnr,\n -- callback = function()\n -- local winid = vim.call("bufwinid", bufnr)\n -- -- (1, 0)-indexed\n -- local row, col = unpack(vim.api.nvim_win_get_cursor(winid))\n -- -- 0-indexed\n -- local code_line = vim.api.nvim_buf_get_lines(bufnr, row - 1, row, false)[1]\n -- local completion = Jupynium_kernel_complete(bufnr, code_line, col)\n -- vim.pretty_print(completion)\n -- end,\n -- group = augroup,\n -- })\n\n vim.api.nvim_create_autocmd({ "ModeChanged" }, {\n buffer = bufnr,\n callback = function()\n local old_mode = vim.api.nvim_get_vvar("event")["old_mode"]\n local new_mode = vim.api.nvim_get_vvar("event")["new_mode"]\n if new_mode == "V" or new_mode == "v" or new_mode == "\x16" then\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n local cursor_pos_row = cursor_pos[1] - 1\n local visual_start_row = vim.fn.getpos("v")[2] - 1\n Jupynium_rpcnotify("visual_enter", bufnr, true, cursor_pos_row, visual_start_row)\n elseif\n (old_mode == "v" or old_mode == "V" or old_mode == "\x16")\n and (new_mode ~= "v" and new_mode ~= "V" and new_mode ~= "\x16")\n then\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n local cursor_pos_row = cursor_pos[1] - 1\n Jupynium_rpcnotify("visual_leave", bufnr, true, cursor_pos_row, cursor_pos_row)\n end\n end,\n group = augroup,\n })\n\n vim.api.nvim_create_autocmd({ "BufWritePre" }, {\n buffer = bufnr,\n callback = function()\n local buf_filepath = vim.api.nvim_buf_get_name(bufnr)\n Jupynium_rpcnotify("BufWritePre", bufnr, true, buf_filepath)\n end,\n group = augroup,\n })\n\n vim.api.nvim_create_autocmd({ "BufUnload" }, {\n buffer = bufnr,\n callback = function()\n Jupynium_rpcnotify("BufUnload", bufnr, true)\n Jupynium_stop_sync(bufnr)\n end,\n group = augroup,\n })\n\n vim.api.nvim_buf_attach(bufnr, false, {\n on_lines = function(_, , , start_row, old_end_row, new_end_row, )\n if Jupynium_syncing_bufs[bufnr] == nil then\n return\n end\n\n local lines = vim.api.nvim_buf_get_lines(bufnr, start_row, new_end_row, false)\n Jupynium_rpcnotify("on_lines", bufnr, true, lines, start_row, old_end_row, new_end_row)\n end,\n })\nend\n\nfunction Jupynium_stop_sync(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n Jupynium_rpcnotify("stop_sync", bufnr, true)\n -- This will clear autocmds if there are any\n vim.api.nvim_create_augroup(string.format("jupynium_buf%d", bufnr), { clear = true })\n Jupynium_syncing_bufs[bufnr] = nil\n\n -- detach doesn't work. We just disable the on_lines callback by looking at Jupynium_syncing_bufs\n -- vim.api.nvim_buf_detach(buf)\nend\n\nfunction Jupynium_execute_selected_cells(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot execute cells without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("execute_selected_cells", bufnr, true)\nend\n\nfunction Jupynium_toggle_selected_cells_outputs_scroll(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot toggle output cell without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("toggle_selected_cells_outputs_scroll", bufnr, true)\nend\n\nfunction Jupynium_scroll_to_cell(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot scroll to cell without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n Jupynium_rpcnotify("scroll_to_cell", bufnr, true, cursor_pos[1] - 1)\nend\n\nfunction Jupynium_save_ipynb(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot save notebook without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("save_ipynb", bufnr, true)\nend\n\nfunction Jupynium_download_ipynb(bufnr, output_name)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n -- get winnr from bufnr\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot download ipynb without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local buf_filepath = vim.api.nvim_buf_get_name(bufnr)\n if buf_filepath == "" then\n Jupynium_notify.error { [[Cannot download ipynb without having the filename for the buffer.]] }\n return\n end\n\n Jupynium_rpcnotify("download_ipynb", bufnr, true, buf_filepath, output_name)\nend\n\nfunction Jupynium_download_ipynb_cmd(args)\n local output_name = args.args\n Jupynium_download_ipynb(nil, output_name)\nend\n\nfunction Jupynium_auto_download_ipynb_toggle()\n vim.g.jupynium_autodownload_ipynb = 1 - vim.g.jupynium_auto_download_ipynb\n Jupynium_notify.info { "Auto download ipynb is now ", vim.g.jupynium_auto_download_ipynb == 1 and "on" or "off" }\nend\n\nfunction Jupynium_scroll_up(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot scroll notebook without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local scroll_page = vim.g.jupynium_scroll_page or 0.5\n Jupynium_rpcnotify("scroll_ipynb", bufnr, true, -scroll_page)\nend\n\nfunction Jupynium_scroll_down(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot scroll notebook without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local scroll_page = vim.g.jupynium_scroll_page or 0.5\n Jupynium_rpcnotify("scroll_ipynb", bufnr, true, scroll_page)\nend\n\nfunction Jupynium_autoscroll_toggle()\n vim.g.jupynium_autoscroll = 1 - vim.g.jupynium_autoscroll\n Jupynium_notify.info { "Autoscroll is now ", vim.g.jupynium_autoscroll == 1 and "on" or "off" }\nend\n\nfunction Jupynium_clear_selected_cells_outputs(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot clear outputs without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("clear_selected_cells_outputs", bufnr, true)\nend\n\nfunction Jupynium_kernel_get_spec(bufnr)\n -- Users shouldn't have to call this function directly, and thus it won't be available as a command.\n -- returns a table\n -- ret[1] = current kernel name\n -- ret[2] = table of kernel names to spec\n -- ret[2].python3.spec.display_name\n -- ret[2].python3.spec.language\n -- ret[2].python3.spec.metadata.conda_env_name\n -- ret[2].python3.spec.metadata.conda_env_path\n\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot get kernel list without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local kernel_spec = Jupynium_rpcrequest("kernel_get_spec", bufnr, true)\n return kernel_spec\nend\n\nfunction Jupynium_kernel_change(bufnr, kernel_name)\n -- note that the kernel name is different from the display name in the kernel list in Jupyter Notebook.\n -- Users shouldn't have to call this function directly, and thus it won't be available as a command.\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot change kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("kernel_change", bufnr, true, kernel_name)\nend\n\nfunction Jupynium_restart_kernel(bufnr)\n Jupynium_notify.warn { [[Sorry! Command name changed.]], [[Please use :JupyniumKernelRestart]] }\n return Jupynium_kernel_restart(bufnr)\nend\n\nfunction Jupynium_kernel_restart(bufnr)\n -- note that the kernel name is different from the display name in the kernel list in Jupyter Notebook.\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot restart kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("kernel_restart", bufnr, true)\nend\n\nfunction Jupynium_kernel_interrupt(bufnr)\n -- note that the kernel name is different from the display name in the kernel list in Jupyter Notebook.\n -- Users shouldn't have to call this function directly, and thus it won't be available as a command.\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot interrupt kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("kernel_interrupt", bufnr, true)\nend\n\nfunction Jupynium_select_kernel(bufnr)\n Jupynium_notify.warn { [[Sorry! Command name changed.]], [[Please use :JupyniumKernelSelect]] }\n return Jupynium_kernel_select(bufnr)\nend\n\nfunction Jupynium_kernel_select(bufnr)\n -- note that the kernel name is different from the display name in the kernel list in Jupyter Notebook.\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot select kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local jupynium_kernel_name_and_spec = Jupynium_kernel_get_spec(bufnr)\n local current_kernel_name = jupynium_kernel_name_and_spec[1]\n local kernel_spec = jupynium_kernel_name_and_spec[2]\n local kernel_display_names, kernel_dispname_to_name = {}, {}\n for kernel_name, kern in pairs(kernel_spec) do\n -- filter by language\n if kern.spec.language:lower() == vim.bo.filetype then\n if kernel_name ~= current_kernel_name then\n table.insert(kernel_display_names, kern.spec.display_name)\n else\n -- current kernel is always first (default)\n table.insert(kernel_display_names, 1, kern.spec.display_name)\n end\n kernel_dispname_to_name[kern.spec.display_name] = kernel_name\n end\n end\n\n if kernel_dispname_to_name[kernel_display_names[1]] ~= current_kernel_name then\n -- by applying filtering, we dropped the current kernel.\n -- cancel the filtering and include everything.\n kernel_display_names = {}\n kernel_dispname_to_name = {}\n for kernel_name, kern in pairs(kernel_spec) do\n if kernel_name ~= current_kernel_name then\n table.insert(kernel_display_names, kern.spec.display_name)\n else\n -- current kernel is always first (default)\n table.insert(kernel_display_names, 1, kern.spec.display_name)\n end\n kernel_dispname_to_name[kern.spec.display_name] = kernel_name\n end\n end\n\n -- Use dressing.nvim to use Telescope, fzf-lua etc.\n vim.ui.select(kernel_display_names, {\n prompt = "Select a kernel for Jupynium (Jupyter Notebook)",\n }, function(selected)\n if selected == nil then\n return\n end\n Jupynium_kernel_change(bufnr, kernel_dispname_to_name[selected])\n end)\nend\n\n--- Inspect kernel and return the response.\n---@param bufnr integer\n---@param code_line string\n---@param col integer 0-indexed\n---@return table | nil\nfunction Jupynium_kernel_inspect(bufnr, code_line, col)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot inspect kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n return Jupynium_rpcrequest("kernel_inspect", bufnr, true, code_line, col)\nend\n\n--- Inspect kernel at cursor and display the response on a floating window.\n--- Just like vim.lsp.buf.hover().\n--- Code mainly from https://github.com/lkhphuc/jupyter-kernel.nvim\n---@param bufnr integer\nfunction Jupynium_kernel_hover(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot inspect kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n -- (1, 0)-indexed\n local winid = vim.call("bufwinid", bufnr)\n local row, col = unpack(vim.api.nvim_win_get_cursor(winid))\n -- 0-indexed\n local code_line = vim.api.nvim_buf_get_lines(bufnr, row - 1, row, false)[1]\n local inspect = Jupynium_kernel_inspect(bufnr, code_line, col)\n local out = ""\n\n if inspect == nil or inspect == vim.NIL then\n out = "Failed to inspect kernel. Maybe the kernel has timed out."\n elseif inspect.status ~= "ok" then\n out = inspect.status\n elseif inspect.found == false then\n out = "No information from kernel"\n elseif inspect.found == true then\n local sections = vim.split(inspect.data["text/plain"], "\x1b%[0;31m")\n for , section in ipairs(sections) do\n section = section\n -- Strip ANSI Escape code: https://stackoverflow.com/a/55324681\n -- \x1b is the escape character\n -- %[%d+; is the ANSI escape code for a digit color\n :gsub(\n "\x1b%[%d+;%d+;%d+;%d+;%d+m",\n ""\n )\n :gsub("\x1b%[%d+;%d+;%d+;%d+m", "")\n :gsub("\x1b%[%d+;%d+;%d+m", "")\n :gsub("\x1b%[%d+;%d+m", "")\n :gsub("\x1b%[%d+m", "")\n :gsub("\x1b%[H", "\t")\n -- Groups: name, 0 or more new line, content till end\n -- TODO: Fix for non-python kernel\n :gsub(\n "^(Call signature):(%s*)(.-)\n$",\n "python\\n%3 # %1\\n"\n )\n :gsub("^(Init signature):(%s*)(.-)\n$", "python\\n%3 # %1\\n")\n :gsub("^(Signature):(%s*)(.-)\n$", "python\\n%3 # %1\\n")\n :gsub("^(String form):(%s*)(.-)\n$", "python\\n%3 # %1\\n")\n :gsub("^(Docstring):(%s*)(.-)$", "\n---\nrst\\n%3\\n")\n :gsub("^(Class docstring):(%s*)(.-)$", "\n---\nrst\\n%3\\n")\n :gsub("^(File):(%s*)(.-)\n$", "%1: %3\n")\n :gsub("^(Type):(%s*)(.-)\n$", "%1: %3\n")\n :gsub("^(Length):(%s*)(.-)\n$", "%1: %3\n")\n :gsub("^(Subclasses):(%s*)(.-)\n$", "%1: %3\n")\n if section:match "%S" ~= nil and section:match "%S" ~= "" then\n -- Only add non-empty section\n out = out .. section\n end\n end\n end\n\n local markdown_lines = vim.lsp.util.convert_input_to_markdown_lines(out)\n markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines)\n\n local opts = { max_width = 84 }\n local ok, options = pcall(require, "jupynium.options")\n if ok then\n opts = vim.tbl_extend("force", opts, options.opts.kernel_hover.floating_win_opts)\n end\n\n vim.lsp.util.open_floating_preview(markdown_lines, "markdown", opts)\nend\n\nlocal function get_memory_addr(t)\n return string.format("%p", t)\nend\n\n--- Get completion candidates from kernel.\n---@param bufnr integer\n---@param code_line string\n---@param col integer 0-indexed\n---@param callback function nvim-cmp complete callback.\n---@return table | nil\nfunction Jupynium_kernel_complete_async(bufnr, code_line, col, callback)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error {\n [[Cannot get completion through kernel without synchronising.]],\n [[Run :JupyniumStartSync]],\n }\n return\n end\n\n -- We don't want to update the completion menu if there's a newer request.\n -- So we use a callback_id to identify the callback, and only call it if it didn't change.\n local callback_id = get_memory_addr(callback)\n\n -- Store the callback in a global variable so that we can call it from python.\n Jupynium_kernel_complete_async_callback = callback\n vim.g.jupynium_kernel_complete_async_callback_id = callback_id\n\n Jupynium_rpcnotify("kernel_complete_async", bufnr, true, code_line, col, callback_id)\nend\n\nfunction Jupynium_get_kernel_connect_shcmd(bufnr, hostname)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n\n local kernel_id = nil\n if Jupynium_syncing_bufs[bufnr] ~= nil then\n kernel_id = Jupynium_rpcrequest("kernel_connect_info", bufnr, true)\n end\n if kernel_id == nil then\n kernel_id = ""\n end\n local jupyter_command = "jupyter"\n local ok, options = pcall(require, "jupynium.options")\n if ok then\n if type(options.opts.jupyter_command) == "string" then\n jupyter_command = options.opts.jupyter_command\n elseif type(options.opts.jupyter_command) == "table" then\n jupyter_command = table.concat(options.opts.jupyter_command, " ")\n else\n Jupynium_notify.error { "Invalid jupyter_command type." }\n end\n end\n if hostname ~= "" then\n jupyter_command = "ssh " .. hostname .. " -t " .. jupyter_command\n end\n Jupynium_notify.info { "Connecting to kernel " .. kernel_id }\n local cmd = jupyter_command .. " console --existing " .. kernel_id\n return cmd\nend\n\nfunction Jupynium_kernel_connect_cmd(args)\n local hostname = args.args\n local buf = vim.api.nvim_get_current_buf()\n local cmd = Jupynium_get_kernel_connect_shcmd(buf, hostname)\n vim.cmd([[split | terminal ]] .. cmd)\n vim.cmd [[normal! G]]\nend\n', [])]
2023-09-01 10:50:17,567 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x94\x00\x05\xb0nvim_execute_lua\x92\xdac\xc9vim.g.jupynium_message_bloated = false\n\n-- This number is not strictly accurate. We only use this to detect blockage (bloated)\nvim.g.jupynium_num_pending_msgs = 0\n\n-- Remove syncing without sending stop message.\n-- Use when initialising or no Jupynium server is running.\nfunction Jupynium_reset_sync()\n for bufnr, _ in pairs(Jupynium_syncing_bufs) do\n -- This will clear autocmds if there are any\n vim.api.nvim_create_augroup(string.format("jupynium_buf
%d", bufnr), { clear = true })\n end\nend\n\nif Jupynium_syncing_bufs ~= nil then\n Jupynium_reset_sync()\nend\n\nJupynium_syncing_bufs = {} -- key = bufnr, value = 1\n\nfunction Jupynium_reset_channel()\n vim.g.jupynium_channel_id = -1\n vim.g.jupynium_message_bloated = false\n vim.g.jupynium_num_pending_msgs = 0\n Jupynium_reset_sync()\nend\n\nlocal function get_line_count_all_buffers()\n local line_count = 0\n for buf_id, _ in pairs(Jupynium_syncing_bufs) do\n line_count = line_count + vim.api.nvim_buf_line_count(buf_id)\n end\n return line_count\nend\n\nget_line_count_all_buffers()\n\nlocal function get_num_max_events()\n return math.max(vim.g.jupynium_num_max_msgs, get_line_count_all_buffers())\nend\n\nlocal function rpc(method, event, buf, ...)\n if vim.g.jupynium_channel_id ~= nil and vim.g.jupynium_channel_id > 0 then\n -- If bloated, wait until the messages are cleared\n -- Jupynium server should detect this and clear the messages\n -- And send grab_entire_buf\n if vim.g.jupynium_message_bloated then\n return\n end\n\n if vim.g.jupynium_num_pending_msgs < get_num_max_events() then\n vim.g.jupynium_num_pending_msgs = vim.g.jupynium_num_pending_msgs + 1\n local status, res = pcall(method, vim.g.jupynium_channel_id, event, buf, ...)\n if not status then\n print "Jupynium: RPC channel closed. Stop sending all notifications."\n Jupynium_reset_channel()\n else\n return res\n end\n else\n vim.g.jupynium_message_bloated = true\n end\n else\n Jupynium_reset_channel()\n end\nend\n\nfunction Jupynium_rpcnotify(event, buf, ensure_syncing, ...)\n -- check if it's already syncing\n if ensure_syncing then\n if Jupynium_syncing_bufs[buf] == nil then\n return\n end\n end\n rpc(vim.rpcnotify, event, buf, ...)\nend\n\n-- block until jupynium responds to the message\nfunction Jupynium_rpcrequest(event, buf, ensure_syncing, ...)\n if ensure_syncing then\n if Jupynium_syncing_bufs[buf] == nil then\n if event ~= "start_sync" then\n return\n end\n end\n end\n\n local response = rpc(vim.rpcrequest, event, buf, ...)\n return response\nend\n\n--- API: Execute javascript in the browser. It will switch to the correct tab before executing.\n---@param bufnr integer | nil If given, before executing the code it will switch to the tab of this buffer. Requires syncing in advance.\n---@param code string Javascript code\n---@return boolean, object: Success, response\nfunction Jupynium_execute_javascript(bufnr, code)\n local ensure_syncing = true\n if bufnr == nil then\n ensure_syncing = false\n elseif bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n\n if ensure_syncing and Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error {\n [[Cannot execute javascript because it's not synchronised]],\n [[Run :JupyniumStartSync or set bufnr=nil in Jupynium_execute_javascript()]],\n }\n return false, nil\n end\n\n -- set ensure_syncing to false, because we checked that already.\n return true, Jupynium_rpcrequest("execute_javascript", bufnr, false, code)\nend\n\nfunction Jupynium_grab_entire_buffer(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot grab buffer without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local entire_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)\n Jupynium_rpcnotify("grab_entire_buf", bufnr, true, entire_buf)\nend\n\nfunction Jupynium_load_from_ipynb_tab_cmd(args)\n local is_number = args.args:match "^%d+$"\n if is_number == nil then\n Jupynium_notify.error { "Tab index should be a number but got: " .. args.args }\n return\n end\n local tab_idx = tonumber(args.args)\n local buf = vim.api.nvim_get_current_buf()\n Jupynium_load_from_ipynb_tab(buf, tab_idx)\nend\n\nfunction Jupynium_load_from_ipynb_tab(bufnr, tab_idx)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n local response = Jupynium_rpcrequest("load_from_ipynb_tab", bufnr, false, tab_idx)\n\n if response ~= "OK" then\n Jupynium_notify.error { "Failed to load from ipynb tab" }\n end\nend\n\nfunction Jupynium_load_from_ipynb_tab_and_start_sync_cmd(args)\n local is_number = args.args:match "^%d+$"\n if is_number == nil then\n Jupynium_notify.error { "Tab index should be a number but got: " .. args.args }\n return\n end\n local tab_idx = tonumber(args.args)\n local buf = vim.api.nvim_get_current_buf()\n Jupynium_load_from_ipynb_tab_and_start_sync(buf, tab_idx)\nend\n\nfunction Jupynium_load_from_ipynb_tab_and_start_sync(bufnr, tab_idx)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n local response = Jupynium_rpcrequest("load_from_ipynb_tab", bufnr, false, tab_idx)\n\n if response == "OK" then\n -- start sync with no content copying from nvim and no asking.\n Jupynium_start_sync(bufnr, tostring(tab_idx), false)\n else\n Jupynium_notify.error { "Failed to load from ipynb tab" }\n end\nend\n\nfunction Jupynium_start_sync_cmd(args)\n local filename = args.args\n local buf = vim.api.nvim_get_current_buf()\n Jupynium_start_sync(buf, filename)\nend\n\n---Start synchronising the buffer with the ipynb file\n---@param bufnr integer buffer number\n---@param ipynb_filename string name of the ipynb file\n---@param ask boolean whether to ask for confirmation\nfunction Jupynium_start_sync(bufnr, ipynb_filename, ask)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if ask == nil then\n ask = true\n end\n\n -- This will clear autocmds if there are any\n local augroup = vim.api.nvim_create_augroup(string.format("jupynium_buf
%d", bufnr), { clear = true })\n\n if Jupynium_syncing_bufs[bufnr] ~= nil then\n Jupynium_notify.error { "Already syncing this buffer.", ":JupyniumStopSync to stop." }\n return\n end\n\n local content = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)\n\n -- Used for choosing the correct kernel\n local buf_filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")\n local conda_or_venv_path = vim.env.CONDA_PREFIX or vim.env.VIRTUAL_ENV\n\n local response =\n Jupynium_rpcrequest("start_sync", bufnr, false, ipynb_filename, ask, content, buf_filetype, conda_or_venv_path)\n if response ~= "OK" then\n Jupynium_notify.info { "Cancelling sync.." }\n return\n end\n\n Jupynium_syncing_bufs[bufnr] = 1\n\n vim.api.nvim_create_autocmd({ "CursorMoved" }, {\n buffer = bufnr,\n callback = function()\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n local cursor_pos_row = cursor_pos[1] - 1\n local visual_start_row = vim.fn.getpos("v")[2] - 1\n Jupynium_rpcnotify("CursorMoved", bufnr, true, cursor_pos_row, visual_start_row)\n end,\n group = augroup,\n })\n\n vim.api.nvim_create_autocmd({ "CursorMovedI" }, {\n buffer = bufnr,\n callback = function()\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n local cursor_pos_row = cursor_pos[1] - 1\n Jupynium_rpcnotify("CursorMovedI", bufnr, true, cursor_pos_row, cursor_pos_row)\n end,\n group = augroup,\n })\n\n -- Load completion items when cursor hold\n -- vim.api.nvim_create_autocmd({ "CursorHoldI" }, {\n -- buffer = bufnr,\n -- callback = function()\n -- local winid = vim.call("bufwinid", bufnr)\n -- -- (1, 0)-indexed\n -- local row, col = unpack(vim.api.nvim_win_get_cursor(winid))\n -- -- 0-indexed\n -- local code_line = vim.api.nvim_buf_get_lines(bufnr, row - 1, row, false)[1]\n -- local completion = Jupynium_kernel_complete(bufnr, code_line, col)\n -- vim.pretty_print(completion)\n -- end,\n -- group = augroup,\n -- })\n\n vim.api.nvim_create_autocmd({ "ModeChanged" }, {\n buffer = bufnr,\n callback = function()\n local old_mode = vim.api.nvim_get_vvar("event")["old_mode"]\n local new_mode = vim.api.nvim_get_vvar("event")["new_mode"]\n if new_mode == "V" or new_mode == "v" or new_mode == "\x16" then\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n local cursor_pos_row = cursor_pos[1] - 1\n local visual_start_row = vim.fn.getpos("v")[2] - 1\n Jupynium_rpcnotify("visual_enter", bufnr, true, cursor_pos_row, visual_start_row)\n elseif\n (old_mode == "v" or old_mode == "V" or old_mode == "\x16")\n and (new_mode ~= "v" and new_mode ~= "V" and new_mode ~= "\x16")\n then\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n local cursor_pos_row = cursor_pos[1] - 1\n Jupynium_rpcnotify("visual_leave", bufnr, true, cursor_pos_row, cursor_pos_row)\n end\n end,\n group = augroup,\n })\n\n vim.api.nvim_create_autocmd({ "BufWritePre" }, {\n buffer = bufnr,\n callback = function()\n local buf_filepath = vim.api.nvim_buf_get_name(bufnr)\n Jupynium_rpcnotify("BufWritePre", bufnr, true, buf_filepath)\n end,\n group = augroup,\n })\n\n vim.api.nvim_create_autocmd({ "BufUnload" }, {\n buffer = bufnr,\n callback = function()\n Jupynium_rpcnotify("BufUnload", bufnr, true)\n Jupynium_stop_sync(bufnr)\n end,\n group = augroup,\n })\n\n vim.api.nvim_buf_attach(bufnr, false, {\n on_lines = function(
, _, _, start_row, old_end_row, new_end_row, )\n if Jupynium_syncing_bufs[bufnr] == nil then\n return\n end\n\n local lines = vim.api.nvim_buf_get_lines(bufnr, start_row, new_end_row, false)\n Jupynium_rpcnotify("on_lines", bufnr, true, lines, start_row, old_end_row, new_end_row)\n end,\n })\nend\n\nfunction Jupynium_stop_sync(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n Jupynium_rpcnotify("stop_sync", bufnr, true)\n -- This will clear autocmds if there are any\n vim.api.nvim_create_augroup(string.format("jupynium_buf%d", bufnr), { clear = true })\n Jupynium_syncing_bufs[bufnr] = nil\n\n -- detach doesn't work. We just disable the on_lines callback by looking at Jupynium_syncing_bufs\n -- vim.api.nvim_buf_detach(buf)\nend\n\nfunction Jupynium_execute_selected_cells(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot execute cells without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("execute_selected_cells", bufnr, true)\nend\n\nfunction Jupynium_toggle_selected_cells_outputs_scroll(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot toggle output cell without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("toggle_selected_cells_outputs_scroll", bufnr, true)\nend\n\nfunction Jupynium_scroll_to_cell(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot scroll to cell without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local winid = vim.call("bufwinid", bufnr)\n local cursor_pos = vim.api.nvim_win_get_cursor(winid)\n Jupynium_rpcnotify("scroll_to_cell", bufnr, true, cursor_pos[1] - 1)\nend\n\nfunction Jupynium_save_ipynb(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot save notebook without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("save_ipynb", bufnr, true)\nend\n\nfunction Jupynium_download_ipynb(bufnr, output_name)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n -- get winnr from bufnr\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot download ipynb without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local buf_filepath = vim.api.nvim_buf_get_name(bufnr)\n if buf_filepath == "" then\n Jupynium_notify.error { [[Cannot download ipynb without having the filename for the buffer.]] }\n return\n end\n\n Jupynium_rpcnotify("download_ipynb", bufnr, true, buf_filepath, output_name)\nend\n\nfunction Jupynium_download_ipynb_cmd(args)\n local output_name = args.args\n Jupynium_download_ipynb(nil, output_name)\nend\n\nfunction Jupynium_auto_download_ipynb_toggle()\n vim.g.jupynium_autodownload_ipynb = 1 - vim.g.jupynium_auto_download_ipynb\n Jupynium_notify.info { "Auto download ipynb is now ", vim.g.jupynium_auto_download_ipynb == 1 and "on" or "off" }\nend\n\nfunction Jupynium_scroll_up(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot scroll notebook without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local scroll_page = vim.g.jupynium_scroll_page or 0.5\n Jupynium_rpcnotify("scroll_ipynb", bufnr, true, -scroll_page)\nend\n\nfunction Jupynium_scroll_down(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot scroll notebook without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local scroll_page = vim.g.jupynium_scroll_page or 0.5\n Jupynium_rpcnotify("scroll_ipynb", bufnr, true, scroll_page)\nend\n\nfunction Jupynium_autoscroll_toggle()\n vim.g.jupynium_autoscroll = 1 - vim.g.jupynium_autoscroll\n Jupynium_notify.info { "Autoscroll is now ", vim.g.jupynium_autoscroll == 1 and "on" or "off" }\nend\n\nfunction Jupynium_clear_selected_cells_outputs(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot clear outputs without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("clear_selected_cells_outputs", bufnr, true)\nend\n\nfunction Jupynium_kernel_get_spec(bufnr)\n -- Users shouldn't have to call this function directly, and thus it won't be available as a command.\n -- returns a table\n -- ret[1] = current kernel name\n -- ret[2] = table of kernel names to spec\n -- ret[2].python3.spec.display_name\n -- ret[2].python3.spec.language\n -- ret[2].python3.spec.metadata.conda_env_name\n -- ret[2].python3.spec.metadata.conda_env_path\n\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot get kernel list without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local kernel_spec = Jupynium_rpcrequest("kernel_get_spec", bufnr, true)\n return kernel_spec\nend\n\nfunction Jupynium_kernel_change(bufnr, kernel_name)\n -- note that the kernel name is different from the display name in the kernel list in Jupyter Notebook.\n -- Users shouldn't have to call this function directly, and thus it won't be available as a command.\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot change kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("kernel_change", bufnr, true, kernel_name)\nend\n\nfunction Jupynium_restart_kernel(bufnr)\n Jupynium_notify.warn { [[Sorry! Command name changed.]], [[Please use :JupyniumKernelRestart]] }\n return Jupynium_kernel_restart(bufnr)\nend\n\nfunction Jupynium_kernel_restart(bufnr)\n -- note that the kernel name is different from the display name in the kernel list in Jupyter Notebook.\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot restart kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("kernel_restart", bufnr, true)\nend\n\nfunction Jupynium_kernel_interrupt(bufnr)\n -- note that the kernel name is different from the display name in the kernel list in Jupyter Notebook.\n -- Users shouldn't have to call this function directly, and thus it won't be available as a command.\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot interrupt kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n Jupynium_rpcnotify("kernel_interrupt", bufnr, true)\nend\n\nfunction Jupynium_select_kernel(bufnr)\n Jupynium_notify.warn { [[Sorry! Command name changed.]], [[Please use :JupyniumKernelSelect]] }\n return Jupynium_kernel_select(bufnr)\nend\n\nfunction Jupynium_kernel_select(bufnr)\n -- note that the kernel name is different from the display name in the kernel list in Jupyter Notebook.\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot select kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n\n local jupynium_kernel_name_and_spec = Jupynium_kernel_get_spec(bufnr)\n local current_kernel_name = jupynium_kernel_name_and_spec[1]\n local kernel_spec = jupynium_kernel_name_and_spec[2]\n local kernel_display_names, kernel_dispname_to_name = {}, {}\n for kernel_name, kern in pairs(kernel_spec) do\n -- filter by language\n if kern.spec.language:lower() == vim.bo.filetype then\n if kernel_name ~= current_kernel_name then\n table.insert(kernel_display_names, kern.spec.display_name)\n else\n -- current kernel is always first (default)\n table.insert(kernel_display_names, 1, kern.spec.display_name)\n end\n kernel_dispname_to_name[kern.spec.display_name] = kernel_name\n end\n end\n\n if kernel_dispname_to_name[kernel_display_names[1]] ~= current_kernel_name then\n -- by applying filtering, we dropped the current kernel.\n -- cancel the filtering and include everything.\n kernel_display_names = {}\n kernel_dispname_to_name = {}\n for kernel_name, kern in pairs(kernel_spec) do\n if kernel_name ~= current_kernel_name then\n table.insert(kernel_display_names, kern.spec.display_name)\n else\n -- current kernel is always first (default)\n table.insert(kernel_display_names, 1, kern.spec.display_name)\n end\n kernel_dispname_to_name[kern.spec.display_name] = kernel_name\n end\n end\n\n -- Use dressing.nvim to use Telescope, fzf-lua etc.\n vim.ui.select(kernel_display_names, {\n prompt = "Select a kernel for Jupynium (Jupyter Notebook)",\n }, function(selected)\n if selected == nil then\n return\n end\n Jupynium_kernel_change(bufnr, kernel_dispname_to_name[selected])\n end)\nend\n\n--- Inspect kernel and return the response.\n---@param bufnr integer\n---@param code_line string\n---@param col integer 0-indexed\n---@return table | nil\nfunction Jupynium_kernel_inspect(bufnr, code_line, col)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot inspect kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n return Jupynium_rpcrequest("kernel_inspect", bufnr, true, code_line, col)\nend\n\n--- Inspect kernel at cursor and display the response on a floating window.\n--- Just like vim.lsp.buf.hover().\n--- Code mainly from https://github.com/lkhphuc/jupyter-kernel.nvim\n---@param bufnr integer\nfunction Jupynium_kernel_hover(bufnr)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error { [[Cannot inspect kernel without synchronising.]], [[Run :JupyniumStartSync]] }\n return\n end\n -- (1, 0)-indexed\n local winid = vim.call("bufwinid", bufnr)\n local row, col = unpack(vim.api.nvim_win_get_cursor(winid))\n -- 0-indexed\n local code_line = vim.api.nvim_buf_get_lines(bufnr, row - 1, row, false)[1]\n local inspect = Jupynium_kernel_inspect(bufnr, code_line, col)\n local out = ""\n\n if inspect == nil or inspect == vim.NIL then\n out = "Failed to inspect kernel. Maybe the kernel has timed out."\n elseif inspect.status ~= "ok" then\n out = inspect.status\n elseif inspect.found == false then\n out = "No information from kernel"\n elseif inspect.found == true then\n local sections = vim.split(inspect.data["text/plain"], "\x1b%[0;31m")\n for _, section in ipairs(sections) do\n section = section\n -- Strip ANSI Escape code: https://stackoverflow.com/a/55324681\n -- \x1b is the escape character\n -- %[%d+; is the ANSI escape code for a digit color\n :gsub(\n "\x1b%[%d+;%d+;%d+;%d+;%d+m",\n ""\n )\n :gsub("\x1b%[%d+;%d+;%d+;%d+m", "")\n :gsub("\x1b%[%d+;%d+;%d+m", "")\n :gsub("\x1b%[%d+;%d+m", "")\n :gsub("\x1b%[%d+m", "")\n :gsub("\x1b%[H", "\t")\n -- Groups: name, 0 or more new line, content till end\n -- TODO: Fix for non-python kernel\n :gsub(\n "^(Call signature):(%s*)(.-)\n$",\n "python\\n%3 # %1\\n"\n )\n :gsub("^(Init signature):(%s*)(.-)\n$", "python\\n%3 # %1\\n")\n :gsub("^(Signature):(%s*)(.-)\n$", "python\\n%3 # %1\\n")\n :gsub("^(String form):(%s*)(.-)\n$", "python\\n%3 # %1\\n")\n :gsub("^(Docstring):(%s*)(.-)$", "\n---\nrst\\n%3\\n")\n :gsub("^(Class docstring):(%s*)(.-)$", "\n---\nrst\\n%3\\n")\n :gsub("^(File):(%s*)(.-)\n$", "%1: %3\n")\n :gsub("^(Type):(%s*)(.-)\n$", "%1: %3\n")\n :gsub("^(Length):(%s*)(.-)\n$", "%1: %3\n")\n :gsub("^(Subclasses):(%s*)(.-)\n$", "%1: %3\n")\n if section:match "%S" ~= nil and section:match "%S" ~= "" then\n -- Only add non-empty section\n out = out .. section\n end\n end\n end\n\n local markdown_lines = vim.lsp.util.convert_input_to_markdown_lines(out)\n markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines)\n\n local opts = { max_width = 84 }\n local ok, options = pcall(require, "jupynium.options")\n if ok then\n opts = vim.tbl_extend("force", opts, options.opts.kernel_hover.floating_win_opts)\n end\n\n vim.lsp.util.open_floating_preview(markdown_lines, "markdown", opts)\nend\n\nlocal function get_memory_addr(t)\n return string.format("%p", t)\nend\n\n--- Get completion candidates from kernel.\n---@param bufnr integer\n---@param code_line string\n---@param col integer 0-indexed\n---@param callback function nvim-cmp complete callback.\n---@return table | nil\nfunction Jupynium_kernel_complete_async(bufnr, code_line, col, callback)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n if Jupynium_syncing_bufs[bufnr] == nil then\n Jupynium_notify.error {\n [[Cannot get completion through kernel without synchronising.]],\n [[Run :JupyniumStartSync]],\n }\n return\n end\n\n -- We don't want to update the completion menu if there's a newer request.\n -- So we use a callback_id to identify the callback, and only call it if it didn't change.\n local callback_id = get_memory_addr(callback)\n\n -- Store the callback in a global variable so that we can call it from python.\n Jupynium_kernel_complete_async_callback = callback\n vim.g.jupynium_kernel_complete_async_callback_id = callback_id\n\n Jupynium_rpcnotify("kernel_complete_async", bufnr, true, code_line, col, callback_id)\nend\n\nfunction Jupynium_get_kernel_connect_shcmd(bufnr, hostname)\n if bufnr == nil or bufnr == 0 then\n bufnr = vim.api.nvim_get_current_buf()\n end\n\n local kernel_id = nil\n if Jupynium_syncing_bufs[bufnr] ~= nil then\n kernel_id = Jupynium_rpcrequest("kernel_connect_info", bufnr, true)\n end\n if kernel_id == nil then\n kernel_id = ""\n end\n local jupyter_command = "jupyter"\n local ok, options = pcall(require, "jupynium.options")\n if ok then\n if type(options.opts.jupyter_command) == "string" then\n jupyter_command = options.opts.jupyter_command\n elseif type(options.opts.jupyter_command) == "table" then\n jupyter_command = table.concat(options.opts.jupyter_command, " ")\n else\n Jupynium_notify.error { "Invalid jupyter_command type." }\n end\n end\n if hostname ~= "" then\n jupyter_command = "ssh " .. hostname .. " -t " .. jupyter_command\n end\n Jupynium_notify.info { "Connecting to kernel " .. kernel_id }\n local cmd = jupyter_command .. " console --existing " .. kernel_id\n return cmd\nend\n\nfunction Jupynium_kernel_connect_cmd(args)\n local hostname = args.args\n local buf = vim.api.nvim_get_current_buf()\n local cmd = Jupynium_get_kernel_connect_shcmd(buf, hostname)\n vim.cmd([[split | terminal ]] .. cmd)\n vim.cmd [[normal! G]]\nend\n\x90''
2023-09-01 10:50:17,568 - pynvim.msgpack_rpc.event_loop.base: 143 - DEBUG - Entering event loop
2023-09-01 10:50:17,568 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,568 - pynvim.msgpack_rpc.msgpack_stream: 60 - DEBUG - received message: [1, 5, None, None]
2023-09-01 10:50:17,568 - pynvim.msgpack_rpc.async_session: 100 - DEBUG - received response: None, None
2023-09-01 10:50:17,568 - pynvim.msgpack_rpc.event_loop.base: 154 - DEBUG - Stopped event loop
2023-09-01 10:50:17,568 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,568 - pynvim.msgpack_rpc.msgpack_stream: 63 - DEBUG - unpacker needs more data...
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.event_loop.base: 145 - DEBUG - Exited event loop
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [0, 6, 'nvim_execute_lua', ('local notify_ok, nvim_notify = pcall(require, "notify")\n\nlocal PLUGIN_NAME = notify_ok and "Jupynium" or "Jupynium"\n\nJupynium_notify = {}\n\n---Wraper for vim.notify and nvim-notify\n---@param msg table\n---@param level number vim.levels[level]\n---@vararg string Strings for substitute\nJupynium_notify.notify = function(msg, level)\n level = level or vim.log.levels.INFO\n\n if notify_ok then\n -- Make it possible to use newline within the message table\n lines = {}\n for _, str in ipairs(msg) do\n for s in str:gmatch "[^\\r\\n]+" do\n table.insert(lines, s)\n end\n end\n\n nvim_notify(lines, level, {\n title = PLUGIN_NAME,\n on_open = function(win)\n local buf = vim.api.nvim_win_get_buf(win)\n vim.api.nvim_buf_set_option(buf, "filetype", "markdown")\n end,\n })\n else\n vim.notify(("[%s]: %s"):format(PLUGIN_NAME, table.concat(msg, " ")), level)\n end\nend\n\nJupynium_notify.error = function(msg)\n Jupynium_notify.notify(msg, vim.log.levels.ERROR)\nend\n\nJupynium_notify.warn = function(msg)\n Jupynium_notify.notify(msg, vim.log.levels.WARN)\nend\n\nJupynium_notify.info = function(msg)\n Jupynium_notify.notify(msg, vim.log.levels.INFO)\nend\n', [])]
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x94\x00\x06\xb0nvim_execute_lua\x92\xda\x04\xa6local notify_ok, nvim_notify = pcall(require, "notify")\n\nlocal PLUGIN_NAME = notify_ok and "Jupynium" or "Jupynium"\n\nJupynium_notify = {}\n\n---Wraper for vim.notify and nvim-notify\n---@param msg table\n---@param level number vim.levels[level]\n---@vararg string Strings for substitute\nJupynium_notify.notify = function(msg, level)\n level = level or vim.log.levels.INFO\n\n if notify_ok then\n -- Make it possible to use newline within the message table\n lines = {}\n for _, str in ipairs(msg) do\n for s in str:gmatch "[^\\r\\n]+" do\n table.insert(lines, s)\n end\n end\n\n nvim_notify(lines, level, {\n title = PLUGIN_NAME,\n on_open = function(win)\n local buf = vim.api.nvim_win_get_buf(win)\n vim.api.nvim_buf_set_option(buf, "filetype", "markdown")\n end,\n })\n else\n vim.notify(("[%s]: %s"):format(PLUGIN_NAME, table.concat(msg, " ")), level)\n end\nend\n\nJupynium_notify.error = function(msg)\n Jupynium_notify.notify(msg, vim.log.levels.ERROR)\nend\n\nJupynium_notify.warn = function(msg)\n Jupynium_notify.notify(msg, vim.log.levels.WARN)\nend\n\nJupynium_notify.info = function(msg)\n Jupynium_notify.notify(msg, vim.log.levels.INFO)\nend\n\x90''
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.event_loop.base: 143 - DEBUG - Entering event loop
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.msgpack_stream: 60 - DEBUG - received message: [1, 6, None, None]
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.async_session: 100 - DEBUG - received response: None, None
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.event_loop.base: 154 - DEBUG - Stopped event loop
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.msgpack_stream: 63 - DEBUG - unpacker needs more data...
2023-09-01 10:50:17,569 - pynvim.msgpack_rpc.event_loop.base: 145 - DEBUG - Exited event loop
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [0, 7, 'nvim_execute_lua', ('vim.api.nvim_create_user_command("JupyniumStartSync", Jupynium_start_sync_cmd, { nargs = "?" })\nvim.api.nvim_create_user_command("JupyniumLoadFromIpynbTab", Jupynium_load_from_ipynb_tab_cmd, { nargs = 1 })\nvim.api.nvim_create_user_command(\n "JupyniumLoadFromIpynbTabAndStartSync",\n Jupynium_load_from_ipynb_tab_and_start_sync_cmd,\n { nargs = 1 }\n)\nvim.api.nvim_create_user_command("JupyniumStopSync", "lua Jupynium_stop_sync()", {})\nvim.api.nvim_create_user_command("JupyniumExecuteSelectedCells", "lua Jupynium_execute_selected_cells()", {})\nvim.api.nvim_create_user_command("JupyniumClearSelectedCellsOutputs", "lua Jupynium_clear_selected_cells_outputs()", {})\nvim.api.nvim_create_user_command(\n "JupyniumToggleSelectedCellsOutputsScroll",\n "lua Jupynium_toggle_selected_cells_outputs_scroll()",\n {}\n)\nvim.api.nvim_create_user_command("JupyniumScrollToCell", "lua Jupynium_scroll_to_cell()", {})\nvim.api.nvim_create_user_command("JupyniumSaveIpynb", "lua Jupynium_save_ipynb()", {})\nvim.api.nvim_create_user_command("JupyniumDownloadIpynb", Jupynium_download_ipynb_cmd, { nargs = "?" })\nvim.api.nvim_create_user_command("JupyniumAutoDownloadIpynbToggle", "lua Jupynium_auto_download_ipynb_toggle()", {})\nvim.api.nvim_create_user_command("JupyniumScrollUp", "lua Jupynium_scroll_up()", {})\nvim.api.nvim_create_user_command("JupyniumScrollDown", "lua Jupynium_scroll_down()", {})\nvim.api.nvim_create_user_command("JupyniumAutoscrollToggle", "lua Jupynium_autoscroll_toggle()", {})\n\n---@deprecated\nvim.api.nvim_create_user_command("JupyniumRestartKernel", "lua Jupynium_restart_kernel()", {})\nvim.api.nvim_create_user_command("JupyniumSelectKernel", "lua Jupynium_select_kernel()", {})\n\nvim.api.nvim_create_user_command("JupyniumKernelRestart", "lua Jupynium_kernel_restart()", {})\nvim.api.nvim_create_user_command("JupyniumKernelInterrupt", "lua Jupynium_kernel_interrupt()", {})\nvim.api.nvim_create_user_command("JupyniumKernelSelect", "lua Jupynium_kernel_select()", {})\nvim.api.nvim_create_user_command("JupyniumKernelHover", "lua Jupynium_kernel_hover()", {})\nvim.api.nvim_create_user_command("JupyniumKernelOpenInTerminal", Jupynium_kernel_connect_cmd, { nargs = "?" })\n', [])]
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x94\x00\x07\xb0nvim_execute_lua\x92\xda\x08\x86vim.api.nvim_create_user_command("JupyniumStartSync", Jupynium_start_sync_cmd, { nargs = "?" })\nvim.api.nvim_create_user_command("JupyniumLoadFromIpynbTab", Jupynium_load_from_ipynb_tab_cmd, { nargs = 1 })\nvim.api.nvim_create_user_command(\n "JupyniumLoadFromIpynbTabAndStartSync",\n Jupynium_load_from_ipynb_tab_and_start_sync_cmd,\n { nargs = 1 }\n)\nvim.api.nvim_create_user_command("JupyniumStopSync", "lua Jupynium_stop_sync()", {})\nvim.api.nvim_create_user_command("JupyniumExecuteSelectedCells", "lua Jupynium_execute_selected_cells()", {})\nvim.api.nvim_create_user_command("JupyniumClearSelectedCellsOutputs", "lua Jupynium_clear_selected_cells_outputs()", {})\nvim.api.nvim_create_user_command(\n "JupyniumToggleSelectedCellsOutputsScroll",\n "lua Jupynium_toggle_selected_cells_outputs_scroll()",\n {}\n)\nvim.api.nvim_create_user_command("JupyniumScrollToCell", "lua Jupynium_scroll_to_cell()", {})\nvim.api.nvim_create_user_command("JupyniumSaveIpynb", "lua Jupynium_save_ipynb()", {})\nvim.api.nvim_create_user_command("JupyniumDownloadIpynb", Jupynium_download_ipynb_cmd, { nargs = "?" })\nvim.api.nvim_create_user_command("JupyniumAutoDownloadIpynbToggle", "lua Jupynium_auto_download_ipynb_toggle()", {})\nvim.api.nvim_create_user_command("JupyniumScrollUp", "lua Jupynium_scroll_up()", {})\nvim.api.nvim_create_user_command("JupyniumScrollDown", "lua Jupynium_scroll_down()", {})\nvim.api.nvim_create_user_command("JupyniumAutoscrollToggle", "lua Jupynium_autoscroll_toggle()", {})\n\n---@deprecated\nvim.api.nvim_create_user_command("JupyniumRestartKernel", "lua Jupynium_restart_kernel()", {})\nvim.api.nvim_create_user_command("JupyniumSelectKernel", "lua Jupynium_select_kernel()", {})\n\nvim.api.nvim_create_user_command("JupyniumKernelRestart", "lua Jupynium_kernel_restart()", {})\nvim.api.nvim_create_user_command("JupyniumKernelInterrupt", "lua Jupynium_kernel_interrupt()", {})\nvim.api.nvim_create_user_command("JupyniumKernelSelect", "lua Jupynium_kernel_select()", {})\nvim.api.nvim_create_user_command("JupyniumKernelHover", "lua Jupynium_kernel_hover()", {})\nvim.api.nvim_create_user_command("JupyniumKernelOpenInTerminal", Jupynium_kernel_connect_cmd, { nargs = "?" })\n\x90''
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.event_loop.base: 143 - DEBUG - Entering event loop
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.msgpack_stream: 60 - DEBUG - received message: [1, 7, None, None]
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.async_session: 100 - DEBUG - received response: None, None
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.event_loop.base: 154 - DEBUG - Stopped event loop
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.msgpack_stream: 63 - DEBUG - unpacker needs more data...
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.event_loop.base: 145 - DEBUG - Exited event loop
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [0, 8, 'nvim_execute_lua', ('local augroup = vim.api.nvim_create_augroup("jupynium_global", { clear = true })\nvim.api.nvim_create_autocmd({ "VimLeavePre" }, {\n -- Don't set the buffer. You can leave from another file.\n callback = function()\n if vim.fn.has "win32" == 1 then\n -- On Windows, when the VimLeavePre event is triggered, the rpc is not able to respond to the request.\n Jupynium_rpcnotify("VimLeavePre", 0)\n else\n Jupynium_rpcrequest("VimLeavePre", 0)\n end\n end,\n group = augroup,\n})\n', [])]
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x94\x00\x08\xb0nvim_execute_lua\x92\xda\x01\xeclocal augroup = vim.api.nvim_create_augroup("jupynium_global", { clear = true })\nvim.api.nvim_create_autocmd({ "VimLeavePre" }, {\n -- Don't set the buffer. You can leave from another file.\n callback = function()\n if vim.fn.has "win32" == 1 then\n -- On Windows, when the VimLeavePre event is triggered, the rpc is not able to respond to the request.\n Jupynium_rpcnotify("VimLeavePre", 0)\n else\n Jupynium_rpcrequest("VimLeavePre", 0)\n end\n end,\n group = augroup,\n})\n\x90''
2023-09-01 10:50:17,570 - pynvim.msgpack_rpc.event_loop.base: 143 - DEBUG - Entering event loop
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.msgpack_stream: 60 - DEBUG - received message: [1, 8, None, None]
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.async_session: 100 - DEBUG - received response: None, None
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.event_loop.base: 154 - DEBUG - Stopped event loop
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.msgpack_stream: 63 - DEBUG - unpacker needs more data...
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.event_loop.base: 145 - DEBUG - Exited event loop
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [0, 9, 'nvim_execute_lua', ('local status, cmp = pcall(require, "cmp")\nif not status then\n return\nend\n\nlocal source = {}\n\nsource.new = function()\n local self = setmetatable({}, { __index = source })\n return self\nend\n\n---Return whether this source is available in the current context or not (optional).\n---@return boolean\nfunction source:is_available()\n local bufnr = vim.api.nvim_get_current_buf()\n return Jupynium_syncing_bufs[bufnr] ~= nil\nend\n\nfunction source:get_debug_name()\n return "jupynium"\nend\n\nfunction source:get_trigger_characters()\n if vim.bo.filetype == "julia" then\n return { ".", "[", "'", '"', "%" }\n elseif vim.bo.filetype == "python" then\n return { ".", "[", "'", '"', "%" }\n elseif vim.bo.filetype == "r" then\n return { ".", "[", "'", '"', "%" }\n else\n return { ".", "[", "'", '"', "%" }\n end\nend\n\n---Invoke completion (required).\n---@param params cmp.SourceCompletionApiParams\n---@param callback fun(response: lsp.CompletionResponse|nil)\nfunction source:complete(params, callback)\n -- (1, 0)-indexed\n local row, col = unpack(vim.api.nvim_win_get_cursor(0))\n -- 0-indexed\n local code_line = vim.api.nvim_buf_get_lines(0, row - 1, row, false)[1]\n\n Jupynium_kernel_complete_async(0, code_line, col, callback)\nend\n\n---Resolve completion item (optional). This is called right before the completion is about to be displayed.\n---Useful for setting the text shown in the documentation window (completion_item.documentation).\n---@param completion_item lsp.CompletionItem\n---@param callback fun(completion_item: lsp.CompletionItem|nil)\nfunction source:resolve(completion_item, callback)\n callback(completion_item)\nend\n\n---Executed after the item was selected.\n---@param completion_item lsp.CompletionItem\n---@param callback fun(completion_item: lsp.CompletionItem|nil)\nfunction source:execute(completion_item, callback)\n callback(completion_item)\nend\n\ncmp.register_source("jupynium", source.new())\n', [])]
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x94\x00\t\xb0nvim_execute_lua\x92\xda\x07xlocal status, cmp = pcall(require, "cmp")\nif not status then\n return\nend\n\nlocal source = {}\n\nsource.new = function()\n local self = setmetatable({}, { __index = source })\n return self\nend\n\n---Return whether this source is available in the current context or not (optional).\n---@return boolean\nfunction source:is_available()\n local bufnr = vim.api.nvim_get_current_buf()\n return Jupynium_syncing_bufs[bufnr] ~= nil\nend\n\nfunction source:get_debug_name()\n return "jupynium"\nend\n\nfunction source:get_trigger_characters()\n if vim.bo.filetype == "julia" then\n return { ".", "[", "'", '"', "%" }\n elseif vim.bo.filetype == "python" then\n return { ".", "[", "'", '"', "%" }\n elseif vim.bo.filetype == "r" then\n return { ".", "[", "'", '"', "%" }\n else\n return { ".", "[", "'", '"', "%" }\n end\nend\n\n---Invoke completion (required).\n---@param params cmp.SourceCompletionApiParams\n---@param callback fun(response: lsp.CompletionResponse|nil)\nfunction source:complete(params, callback)\n -- (1, 0)-indexed\n local row, col = unpack(vim.api.nvim_win_get_cursor(0))\n -- 0-indexed\n local code_line = vim.api.nvim_buf_get_lines(0, row - 1, row, false)[1]\n\n Jupynium_kernel_complete_async(0, code_line, col, callback)\nend\n\n---Resolve completion item (optional). This is called right before the completion is about to be displayed.\n---Useful for setting the text shown in the documentation window (completion_item.documentation).\n---@param completion_item lsp.CompletionItem\n---@param callback fun(completion_item: lsp.CompletionItem|nil)\nfunction source:resolve(completion_item, callback)\n callback(completion_item)\nend\n\n---Executed after the item was selected.\n---@param completion_item lsp.CompletionItem\n---@param callback fun(completion_item: lsp.CompletionItem|nil)\nfunction source:execute(completion_item, callback)\n callback(completion_item)\nend\n\ncmp.register_source("jupynium", source.new())\n\x90''
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.event_loop.base: 143 - DEBUG - Entering event loop
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.msgpack_stream: 60 - DEBUG - received message: [1, 9, None, None]
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.async_session: 100 - DEBUG - received response: None, None
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.event_loop.base: 154 - DEBUG - Stopped event loop
2023-09-01 10:50:17,571 - pynvim.msgpack_rpc.msgpack_stream: 58 - DEBUG - waiting for message...
2023-09-01 10:50:17,572 - pynvim.msgpack_rpc.msgpack_stream: 63 - DEBUG - unpacker needs more data...
2023-09-01 10:50:17,572 - pynvim.msgpack_rpc.event_loop.base: 145 - DEBUG - Exited event loop
2023-09-01 10:50:17,572 - pynvim.msgpack_rpc.msgpack_stream: 33 - DEBUG - sent [2, 'nvim_execute_lua', ('Jupynium_notify.info(...)', [['Jupynium successfully attached and initialised.', 'Run :JupyniumStartSync']])]
2023-09-01 10:50:17,572 - pynvim.msgpack_rpc.event_loop.base: 118 - DEBUG - Sending 'b'\x93\x02\xb0nvim_execute_lua\x92\xb9Jupynium_notify.info(...)\x91\x92\xd9/Jupynium successfully attached and initialised.\xb8Run :JupyniumStartSync''
2023-09-01 10:50:17,572 - jupynium.cmds.jupynium: 93 - INFO - Using firefox profile: None
2023-09-01 10:50:17,572 - selenium.webdriver.common.selenium_manager: 59 - DEBUG - Selenium Manager binary found at: /home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/common/linux/selenium-manager
2023-09-01 10:50:17,572 - selenium.webdriver.common.selenium_manager: 116 - DEBUG - Executing process: /home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/common/linux/selenium-manager --browser firefox --output json
2023-09-01 10:50:17,985 - selenium.webdriver.common.selenium_manager: 135 - DEBUG - Driver path: /snap/bin/geckodriver
2023-09-01 10:50:17,985 - selenium.webdriver.common.selenium_manager: 135 - DEBUG - Browser path: /usr/bin/firefox
2023-09-01 10:50:17,985 - selenium.webdriver.common.selenium_manager: 94 - DEBUG - Using driver at: /snap/bin/geckodriver
2023-09-01 10:50:17,986 - selenium.webdriver.common.service: 216 - DEBUG - Started executable: /snap/bin/geckodriver in a child process with pid: 49438
2023-09-01 10:50:18,489 - selenium.webdriver.remote.remote_connection: 304 - DEBUG - POST http://localhost:58293/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts": true, "moz:debuggerAddress": true, "pageLoadStrategy": "normal", "browserVersion": null, "moz:firefoxOptions": {"binary": "/usr/bin/firefox", "prefs": {"browser.link.open_newwindow": 3, "browser.link.open_newwindow.restriction": 0}, "profile": "UEsDBBQAAAAIAElWIVfrmRmacgMAAJoMAAAHAAAAdXNlci5qc6VWTW/UMBC98ytQTyCx1rbABU6lFAkJUcSq4mg59mTjrmMbe7zp/nvGyaYsbb6AWz7e89hvZt44RQjcByhfnBXBNfTGlKtZo61yDVOp9gysKAyos1fPMSR4+f5ZesoxAiGEZE/ApTBxBG2hQVGwFAzhzkThEr4rjLC7sym8F1tYtn5EETB5lhmEXE+jKlfDEblgL49Z3O3p5FoBqyM6266it9YFGFmAPqkb+6MVOJ6vmbYY3O33L9Phc1Jqcc9lFSgwjzJoj5wU56jrHPT1epiwDBnAu4BcGMPvIod7CR61s3Ew6XdiL7plmetgLFau+Wyv6NEZGCRZwMaFHZOCKHtY5XjCrAiw13ImrxFkChoPTMa+HEeAj5PTgJFZr9lSm2IyoZTO5xQzizRQqECHC1zIrCBPlNsUERSXEHBYzRNSjClHfCBp+gBhkCW8Z8krajsmErphOU5Ai/pG6eiNOIC6Pl9vvjqkxBDhzQjYNdY4oajKLAkW2hr4UYHdZCm13U7Hur79csn63pn0lhb5mnWSzvmQtjsqSrBUw+RIXcYu5rDkL53hjYNdWRJ+pOx6UAChsjKAIGmnn3SIeElayJGeePAUUUL7TKotdLhTRi1MI8JSbwQRZHUsizmoKWPyuVN7rx4zRYgx+wCS7ZEKbRmXZFRcBhGrmSgVGMNkBXL3EUqRDH7o/kzTaCBERse2N/bKuDhzlBP0DWV8GEyKiM4Is6oVCINV984W2dQEP/ncKtf/yO6jl7mgvqe/375x223+KDuD/ot9eGe0PLD8cZOKWrd5/l/+t/bj5e+GHloG9uiciYwcwoXjxifvInmOkYNlAG/bWtHQsFuelR+OkT3CtoXbmujHjryRxM5efb4ehRfGyZ3REacr4oTRFviVq71AXWiTp5nV2wrNYZa6xMKfwi35d3m4HW2kkyk+pWo/tzuXXx19cEXzElMcXrmnVIh0B6t0rA6r/NvTgFsZsFvMlnDx9u2ftH5pmlqUD2Ncw4sDV50nDO7Nk8V4jLm7ee2UMAuvEaU2QE/MBU1twbsazTejGXzEoCXyx7ShUPkKaMkKa6gLCJv2dUSuXOY7jewoWz9Oj6U8ePCegmAoAoYD66RoT34xh50U6Sk8wF07zgZ3cu812T5li+UjU02Q+xPjZ9JhLMJvSlNpCpO7aIDxC1BLAQIUAxQAAAAIAElWIVfrmRmacgMAAJoMAAAHAAAAAAAAAAAAAACkgQAAAAB1c2VyLmpzUEsFBgAAAAABAAEANQAAAJcDAAAAAA=="}}}}
2023-09-01 10:50:18,490 - urllib3.connectionpool: 245 - DEBUG - Starting new HTTP connection (1): localhost:58293
2023-09-01 10:50:18,492 - urllib3.connectionpool: 473 - DEBUG - http://localhost:58293 "POST /session HTTP/1.1" 400 101
2023-09-01 10:50:18,492 - selenium.webdriver.remote.remote_connection: 320 - DEBUG - Remote response: status=400 | data={"value":{"error":"invalid argument","message":"binary is not a Firefox executable","stacktrace":""}} | headers=HTTPHeaderDict({'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-cache', 'content-length': '101', 'date': 'Fri, 01 Sep 2023 02:50:18 GMT'})
2023-09-01 10:50:18,492 - selenium.webdriver.remote.remote_connection: 347 - DEBUG - Finished Request
2023-09-01 10:50:18,493 - jupynium.cmds.jupynium: 580 - ERROR - Exception occurred
Traceback (most recent call last):
File "/home/will/miniconda3/lib/python3.11/site-packages/jupynium/cmds/jupynium.py", line 488, in main
with webdriver_firefox(
^^^^^^^^^^^^^^^^^^
File "/home/will/miniconda3/lib/python3.11/site-packages/jupynium/cmds/jupynium.py", line 102, in webdriver_firefox
return webdriver.Firefox(options=options, service=service)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/firefox/webdriver.py", line 67, in init
super().init(command_executor=executor, options=options)
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 206, in init
self.start_session(capabilities)
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 290, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 345, in execute
self.error_handler.check_response(response)
File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executable

@kiyoon
Copy link
Owner

kiyoon commented Sep 1, 2023

Can you make sure you can run Selenium in WSL? You probably didn't install firefox inside WSL.

@SupercoolBD
Copy link
Author

somehow I just can not make selenium work in my machine...
I later use driver manager and it seems to be working but then another error occurs for missing profiles. I created a new one but the error persists...

from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.service import Service as FirefoxService
from selenium.webdriver.firefox.options import Options

options = Options()
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
# put the root directory your default profile path here, you can check it by opening Firefox and then pasting 'about:profiles' into the url field
# options.add_argument("--profile")
# options.add_argument("/home/will/i0prnpnh.nitro5willU")
service = FirefoxService(
    executable_path="/snap/bin/geckodriver"
)  # specify the path to your geckodriver

driver = webdriver.Firefox(
    service=FirefoxService(GeckoDriverManager().install()), options=options
)
# driver = webdriver.Firefox(service=service, options=options)
# driver = webdriver.Firefox()
driver.get("https://www.selenium.dev/selenium/web/web-form.html")

@kiyoon
Copy link
Owner

kiyoon commented Sep 1, 2023

I don't think you're required to set up the profile.

Do you use WSL2? I think it won't work on the WSL1.

@SupercoolBD
Copy link
Author

SupercoolBD commented Sep 1, 2023

I'm using WSL2. I got selenium to work finally in WSL2 Ubuntu ... but not your code. I have to modify the code with the following: (first I delete the profile.ini and all files in ~/snap/firefox/common/.mozilla/firefox and let it regenerate everything by running firefox in my terminal)

from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.service import Service as FirefoxService
from selenium.webdriver.firefox.options import Options

options = Options()
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
# put the root directory your default profile path here, you can check it by opening Firefox and then pasting 'about:profiles' into the url field
options.add_argument("--profile")
options.add_argument(
    "/home/will/snap/firefox/common/.cache/mozilla/firefox/oz07y7iv.default"
)
service = FirefoxService(
    executable_path="/snap/bin/geckodriver"
)  # specify the path to your geckodriver

driver = webdriver.Firefox(
    service=FirefoxService(GeckoDriverManager().install()), options=options
)
# driver = webdriver.Firefox(service=service, options=options)
# driver = webdriver.Firefox()
driver.get("https://www.selenium.dev/selenium/web/web-form.html")

@SupercoolBD
Copy link
Author

Now the selenium is working but not the default one... I'm not sure how to make this setting in Jupynium... The original question still remains....
However, when I run the code you specified. It still throws binary is not a Firefox executable error at me...

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://www.selenium.dev/selenium/web/web-form.html")

@kiyoon
Copy link
Owner

kiyoon commented Sep 1, 2023

I just tested on WSL2 and the sample script works for me.

I installed firefox like this:
https://askubuntu.com/questions/1444962/how-do-i-install-firefox-in-wsl-when-it-requires-snap-but-snap-doesnt-work

I downloaded linux geckodriver and put it in $PATH.
https://github.com/mozilla/geckodriver/releases

And then it works for me.

@SupercoolBD
Copy link
Author

SupercoolBD commented Sep 1, 2023

Thank you. I purged everything and did what you did in that article and now the selenium works and also the simple code of testing selenium works. However, it opens localhost:8888/nbclassic/tree. It returns 404 not found. Then I ignored it and ran :JupyniumStartSync the exact problem shows up (It closed the open window and stopped .)

I add default_notebook_URL = "localhost:8888/", from the readme page but it still shows the default one and 404 out.

The following is the Jupynium.lua file I got.

local opts = { noremap = true, silent = true }
-- local term_opts = { silent = true }
-- Shorten function name
local keymap = vim.keymap.set
-- Press jk fast to exit insert mode
keymap("n", "<F1>", ':JupyniumStartAndAttachToServer<CR>', opts)
keymap("n", "<F2>", ':JupyniumStartSync<CR>', opts)
local M = {
	"kiyoon/jupynium.nvim",
	enabled = true,
	build = "conda run --no-capture-output -n base pip install .",
	cmd = { "JupyniumStartAndAttachToServer", "JupyniumAttachToServer" },
}

function M.config()
	require("jupynium").setup({
		python_host = { "conda", "run", "--no-capture-output", "-n", "base", "python" },
        default_notebook_URL = "localhost:8888",
		jupyter_command = "jupyter",
		auto_start_server = {
			enable = false,
			file_pattern = { "*.ju.*" },
		},
		-- Attach current nvim to the Jupynium server
		-- Without this step, you can't use :JupyniumStartSync
		-- Related command :JupyniumAttachToServer
		auto_attach_to_server = {
			enable = false,
			file_pattern = { "*.ju.*" },
		},
		-- Automatically open an Untitled.ipynb file on Notebook
		-- when you open a .ju.py file on nvim.
		-- Related command :JupyniumStartSync
		auto_start_sync = {
			enable = false,
			file_pattern = { "*.ju.*" },
		},
		-- Automatically keep filename.ipynb copy of filename.ju.py
		-- by downloading from the Jupyter Notebook server.
		-- This will overwrite the file without asking
		-- Related command :JupyniumDownloadIpynb
		auto_download_ipynb = true,
		-- Always scroll to the current cell.
		-- Related command :JupyniumScrollToCell
		autoscroll = {
			enable = true,
			mode = "always", -- "always" or "invisible"
			cell = {
				top_margin_percent = 20,
			},
		},
		use_default_keybindings = false,
		textobjects = {
			use_default_keybindings = false,
		},
		syntax_highlight = {
			enable = true,
		},
		-- Dim all cells except the current one
		-- Related command :JupyniumShortsightedToggle
		shortsighted = false,
	})
end

return M

@kiyoon
Copy link
Owner

kiyoon commented Sep 1, 2023

You should be able to run Jupyter Notebook inside the WSL2. Is that what you want?
If you run Jupyter Notebook manually within the WSL2, it should work.

@SupercoolBD
Copy link
Author

I want to do what this tool is aimed at aka to use nvim to edit/write ipynb files as shown in the video of the read me. When I open test.ju.py and execute :JupyniumStartAndAttachToServer. It should open Jupyter Notebook on the Firefox browser with address http://localhost:8888/nbclassic/tree, which it does but that page does not work. A 404 : Not Found, You are requesting a page that does not exist! error is shown.

And in this situation, :JupyniumStartSync does not create a new .ipynb file... The log is very long so I uploaded it to my onedrive...
The whole log is here https://1drv.ms/u/s!AsXvmecCr4yegZxVHcfYPuUOhVvrbw?e=rI8Ifh

@kiyoon
Copy link
Owner

kiyoon commented Sep 1, 2023

What happens if you run Jupyter Notebook in WSL before starting nvim?

Simply with command.
jupyter notebook

@SupercoolBD
Copy link
Author

Everything works. It connects to the folder tree and I can select the file I want to edit. I notice that if I remove the nbextension from the url, it is working but even though I set that up in the lua file, it's still not working

@kiyoon
Copy link
Owner

kiyoon commented Sep 1, 2023

  1. If Jupynium can connect to the default URL, it will just connect.
  2. Else, it will try to launch the jupyter notebook server. You need to configure where your jupyter binary is in the setup().
  3. Another thing to note is that the localhost:8888/nbclassic URL is there for the Notebook 7. If you install Notebook 7, you can access the classic interface with that URL. Jupynium only works with the classic interface.

What do you mean it is not working when you set the default URL in the lua file? Does it still connect to /nbclassic URL?

@SupercoolBD
Copy link
Author

I retried running jupyter notebook outside of nvim and the browser does not automatically spawned. It complained about not being able to find the terminal. However, The link for accessing the notebook works. Log is provided.

[I 2023-09-02 11:03:19.177 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-09-02 11:03:20.958 ServerApp]

    To access the server, open this file in a browser:
        file:///home/will/.local/share/jupyter/runtime/jpserver-476-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/tree?token=2f74012d563755d848708ed0dddc7a8b82ddda997c91cec6
        http://127.0.0.1:8888/tree?token=2f74012d563755d848708ed0dddc7a8b82ddda997c91cec6
[I 2023-09-02 11:03:22.467 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
gio:  Unable to find terminal required for application

If in nvim, I opened a test.ju.py file and then execute :JupyniumStartAndAttachToServer, browser did spawn but it gave me a 404 error as shown in the image
file:///home/will/.local/share/jupyter/run
2023-09-02_11-13-36
time/jpserver-476-open.html:

@SupercoolBD
Copy link
Author

This is the log I got running :JupyterStartAndAttachToServerInTerminal . It's working pretty well until trying to access /nbextension which resulted in a 302 and a 404

jupynium.pynvim_helpers:   11 - INFO - nvim addr: /run/user/1000//lvim.1263.0
jupynium.pynvim_helpers:   30 - INFO - nvim attached
jupynium.pynvim_helpers:   34 - INFO - Initialising..
jupynium.pynvim_helpers:   35 - INFO - Communicating with channel_id 8
jupynium.cmds.jupynium:   93 - INFO - Using firefox profile: None
jupynium.cmds.jupynium:  392 - INFO - Writing Jupyter Notebook server log to: /tmp/tmp35w97q1m
[I 2023-09-02 11:29:13.248 ServerApp] Package notebook took 0.0000s to import
[I 2023-09-02 11:29:13.253 ServerApp] Package jupyter_lsp took 0.0047s to import
[W 2023-09-02 11:29:13.253 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a
 `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in fut
ure releases of Jupyter Server.
[I 2023-09-02 11:29:13.256 ServerApp] Package jupyter_server_terminals took 0.0030s to import
[I 2023-09-02 11:29:13.256 ServerApp] Package jupyterlab took 0.0000s to import
[I 2023-09-02 11:29:13.439 ServerApp] Package notebook_shim took 0.0000s to import
[W 2023-09-02 11:29:13.439 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead,
 a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in f
uture releases of Jupyter Server.
[I 2023-09-02 11:29:13.439 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2023-09-02 11:29:13.441 ServerApp] jupyter_server_terminals | extension was successfully linked.
[W 2023-09-02 11:29:13.441 LabApp] 'token' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp.
 Be sure to update your config before our next release.
[W 2023-09-02 11:29:13.441 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to Ser
verApp. Be sure to update your config before our next release.
[W 2023-09-02 11:29:13.443 ServerApp] ServerApp.token config is deprecated in 2.0. Use IdentityProvider.token.
[W 2023-09-02 11:29:13.443 ServerApp] notebook_dir is deprecated, use root_dir
[I 2023-09-02 11:29:13.443 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-09-02 11:29:13.445 ServerApp] notebook | extension was successfully linked.
[I 2023-09-02 11:29:13.539 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-09-02 11:29:13.546 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-09-02 11:29:13.547 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2023-09-02 11:29:13.548 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2023-09-02 11:29:13.548 LabApp] JupyterLab extension loaded from /home/will/miniconda3/lib/python3.11/site-packages/jupyt
erlab
[I 2023-09-02 11:29:13.548 LabApp] JupyterLab application directory is /home/will/miniconda3/share/jupyter/lab
[I 2023-09-02 11:29:13.549 LabApp] Extension Manager is 'pypi'.
[I 2023-09-02 11:29:13.550 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-09-02 11:29:13.551 ServerApp] notebook | extension was successfully loaded.
[I 2023-09-02 11:29:13.551 ServerApp] Serving notebooks from local directory: /home/will/Python_Projects
[I 2023-09-02 11:29:13.551 ServerApp] Jupyter Server 2.7.3 is running at:
[I 2023-09-02 11:29:13.551 ServerApp] http://localhost:8888/tree?token=...
[I 2023-09-02 11:29:13.551 ServerApp]     http://127.0.0.1:8888/tree?token=...
[I 2023-09-02 11:29:13.551 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmatio
n).
[I 2023-09-02 11:29:13.911 ServerApp] 302 GET /nbclassic/tree/?token=[secret] (@127.0.0.1) 0.31ms
[W 2023-09-02 11:29:13.921 ServerApp] 404 GET /nbclassic/tree?token=[secret] ([email protected]) 8.
07ms referer=None
[I 2023-09-02 11:29:14.989 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-node
js, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-l
sp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-la
nguageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server

@kiyoon
Copy link
Owner

kiyoon commented Sep 2, 2023

What version is your jupyter notebook?

@SupercoolBD
Copy link
Author

What version is your jupyter notebook?

6.1.5

@kiyoon
Copy link
Owner

kiyoon commented Sep 2, 2023

Can you upgrade your notebook to v7 and install nbclassic?

pip install --upgrade notebook nbclassic

@SupercoolBD
Copy link
Author

  1. If Jupynium can connect to the default URL, it will just connect.
  2. Else, it will try to launch the jupyter notebook server. You need to configure where your jupyter binary is in the setup().
  3. Another thing to note is that the localhost:8888/nbclassic URL is there for the Notebook 7. If you install Notebook 7, you can access the classic interface with that URL. Jupynium only works with the classic interface.

What do you mean it is not working when you set the default URL in the lua file? Does it still connect to /nbclassic URL?

In the lua setting (as shown in previous messages) I set the default URL to localhost:8888 without /nbextension because as the previous message shown, it resulted in errors. I manually checked if I delete the nbextension part, it can connect to the file explorer so I changed the defaut URL but it still opens the default one with /nbextension.

I also checked (the notebook version is not 7)

(base) will@Will-Nitro5:~$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.14.0
ipykernel        : 6.25.1
ipywidgets       : not installed
jupyter_client   : 8.3.1
jupyter_core     : 5.3.1
jupyter_server   : 2.7.3
jupyterlab       : 4.0.5
nbclient         : 0.8.0
nbconvert        : 7.8.0
nbformat         : 5.9.2
notebook         : 6.1.5
qtconsole        : not installed
traitlets        : 5.9.0

@SupercoolBD
Copy link
Author

I uploaded to jupyter notebook 7. It still does not work. For example, following quick start
Open a *.ju.py file.
Execute :JupyniumStartAndAttachToServer. This will open Jupyter Notebook on the Firefox browser. (it does and still 404. http://localhost:8888/nbclassic/ However, later it will automoatically redirect to http://localhost:8888/nbclassic/tree and it can show the file tree.)
Execute :JupyniumStartSync. This will create an Untitled.ipynb file on the browser. Yes it does create that but then the kernel lost connection. Then the browser window closes itself.
d

The log file is here https://1drv.ms/u/s!AsXvmecCr4yegZ0QXVB_k8goxSUo9g?e=Tsp4A2

@kiyoon
Copy link
Owner

kiyoon commented Sep 2, 2023

Now your notebook works, but it errors when attaching to the kernel. Check these two.

  1. Check if you can use notebook normally without jupynium. To do so, launch jupyter notebook manually. jupyter notebook. Open firefox within WSL using firefox. Then go to the URL localhost:8888/nbclassic. Create a notebook and see if the kernel works.
  2. If above works, then maybe try :JupyniumStartAndAttachToServerInTerminal instead of :JupyniumStartAndAttachToServer. Sometimes, people told me that it works with terminal but not without it.

@SupercoolBD
Copy link
Author

When using terminal to spawn firefox, it works with 2 warnings.
[GFX1-]: glxtest: libEGL missing
[GFX1-]: glxtest: libGL.so.1 missing

When running jupyter notebook in the terminal without jupynium, it does not auto open the browser and has an error :
gio: file:///home/will/.local/share/jupyter/runtime/jpserver-13306-open.html: Unable to find terminal required for application
However, the link https://localhost:8888/tree?token=sometoken works in my host machin (windows 11 pro) and it also works if I open another WSL2 terminal and run firefox and go to http://localhost:8888/tree?token=sometoken

Using Jupynium, :JupyniumStartAndAttachToServerInTerminal renders a hanging(nonresponsive) nvim. The nvim buffer executing the command just hangs... can only be forcefully shut down. However, the firefox instance that was spawned by :JupyniumStartAndAttachToServerInTerminal lives and works normally

@SupercoolBD
Copy link
Author

In that hanging situation, if I close the firefox window. Everything back to normal. Here are the log I think it's relevant.

jupynium.events_control:  195 - INFO - Event from nvim: ['request', 'start_sync', [13, '', True, [''], 'python', '/home/will
/miniconda3'], <pynvim.msgpack_rpc.async_session.Response object at 0x7f1630e2d5d0>]
[I 2023-09-02 22:30:32.529 ServerApp] Creating new notebook in 
[W 2023-09-02 22:30:33.121 ServerApp] 404 GET /nbextensions/nbextensions_configurator/config_menu/main.js?v=20230902143007 (
[email protected]) 0.81ms referer=http://localhost:8888/nbclassic/notebooks/Untitled2.ipynb?kernel_
name=python3
[I 2023-09-02 22:30:33.161 ServerApp] Kernel started: 3ae55895-b282-4d7f-aaab-7fff80ca1b21
[W 2023-09-02 22:30:33.163 ServerApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20230902143007 (766d6772db6e4
[email protected]) 0.83ms referer=http://localhost:8888/nbclassic/notebooks/Untitled2.ipynb?kernel_name=python3
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[I 2023-09-02 22:30:33.515 ServerApp] Connecting to kernel 3ae55895-b282-4d7f-aaab-7fff80ca1b21.
jupynium.cmds.jupynium:  548 - ERROR - Uncaught exception occurred while processing events. Detaching nvim.
Traceback (most recent call last):
  File "/home/will/miniconda3/lib/python3.11/site-packages/jupynium/cmds/jupynium.py", line 543, in main
    status, rpcrequest_event = process_events(nvim_info, driver)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/will/miniconda3/lib/python3.11/site-packages/jupynium/events_control.py", line 205, in process_events
    status, request_event = process_request_event(nvim_info, driver, event)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/will/miniconda3/lib/python3.11/site-packages/jupynium/events_control.py", line 429, in process_request_event
    start_sync_with_filename(
  File "/home/will/miniconda3/lib/python3.11/site-packages/jupynium/events_control.py", line 317, in start_sync_with_filenam
e
    sele.wait_until_notebook_loaded(driver)
  File "/home/will/miniconda3/lib/python3.11/site-packages/jupynium/selenium_helpers.py", line 32, in wait_until_notebook_lo
aded
    WebDriverWait(driver, timeout).until(
  File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/support/wait.py", line 86, in until
    value = method(self._driver)
            ^^^^^^^^^^^^^^^^^^^^
  File "/home/will/miniconda3/lib/python3.11/site-packages/jupynium/selenium_helpers.py", line 34, in <lambda>
    lambda d: d.execute_script("return Jupyter.notebook.kernel.is_connected()")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 405, in execute_scr
ipt
    return self.execute(command, {"script": script, "args": converted_args})["value"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 345, in execute
    self.error_handler.check_response(response)
  File "/home/will/miniconda3/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 228, in check_re
sponse
    raise exception_class(message, screen, stacktrace, alert_text)  # type: ignore[call-arg]  # mypy is not smart enough her
e
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
Message: Dismissed user prompt dialog: [autopep8]
 Error loading library for python:
ModuleNotFoundErrorNo module named 'autopep8'

Check that the appropriate library/module is correctly installed (read autopep8's documentation for details)
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:188:5
UnexpectedAlertOpenError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:720:5
GeckoDriver.prototype._handleUserPrompts@chrome://remote/content/marionette/driver.sys.mjs:2831:13

[I 2023-09-02 22:32:33.154 ServerApp] Saving file at /Untitled2.ipynb
/home/will/miniconda3/lib/python3.11/site-packages/nbformat/__init__.py:129: MissingIDFieldWarning: Code cell is missing an 
id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks bef
ore validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and wil
l stop doing so in the future.
  validate(nb)
[I 2023-09-02 22:34:33.153 ServerApp] Saving file at /Untitled2.ipynb
[I 2023-09-02 22:36:33.157 ServerApp] Saving file at /Untitled2.ipynb
[I 2023-09-02 22:36:41.159 ServerApp] Starting buffering for 3ae55895-b282-4d7f-aaab-7fff80ca1b21:bb8e69100fea4b7d8f8e7395e2
f4472e
jupynium.cmds.jupynium:  577 - INFO - Browser disconnected. Quitting Jupynium.
jupynium.cmds.jupynium:  161 - SUCCESS - Piecefully closed as the browser is closed.
[I 2023-09-02 22:36:42.150 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), keep random ports
jupynium.cmds.jupynium:  339 - INFO - Jupyter Notebook server (pid=14336) has been killed.
prj0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
iiiiiiiiiiiiiiiiiiii
[Process exited 0]

@kiyoon
Copy link
Owner

kiyoon commented Sep 2, 2023

If I understand correctly, the kernel works with normal firefox. And it works if you open Jupynium with terminal. That's a good news.

The problem only occurs when you run without terminal right?

Can you install pip install autopep8 and try again?

@SupercoolBD
Copy link
Author

No. With terminal, the hanging problem occurs. Without terminal, the connecting error problem is encountered.

@kiyoon
Copy link
Owner

kiyoon commented Sep 3, 2023

However, the link https://localhost:8888/tree?token=sometoken works in my host machin (windows 11 pro) and it also works if I open another WSL2 terminal and run firefox and go to http://localhost:8888/tree?token=sometoken

From here, can you open a notebook to see if the kernel gets connected? I feel like your Notebook installation is broken and you're not able to use the kernel.

@SupercoolBD
Copy link
Author

If I just type jupyter notebook, it's working.
Snag_137bbf48
Snag_137c0837

Not automatically open a browser window but the link works and I can connect to a kernel without problems.

@kiyoon
Copy link
Owner

kiyoon commented Sep 3, 2023

This is very strange. But as a last resort, you can leave your notebook open with jupyter notebook, then use Jupynium. If you open notebook server manually, it will work. If you let Jupynium to open it for you, it doesn't work.

I think you probably have a different environment (conda, venv etc.) that has a broken jupyter notebook installed.

@Georgebobby
Copy link

@WillWang8216 I have this problem very similar to yours. Did you manage to solve this?

@kiyoon
Copy link
Owner

kiyoon commented Sep 25, 2023

@Georgebobby Which OS are you using?

Can you follow the steps described in this thread?

  1. Make sure selenium runs with the simple code
  2. Look at logs to identify where the problem occurs

@Georgebobby
Copy link

Wow. Soo fast. Thank you for this wonderful project ❤️❤️❤️ I was using oracle linux on oracle VPS and use ssh port forwarding to do some work locally... I'm not sure whether it's the problem of selenium on oracle linux so I deployed another machine running Ubuntu. Still the same....
Selenium does not run with simple code... so I guess that's the problem. I don't have a physical Linux machine at hand.... I'll try in on WSL later.

@kiyoon
Copy link
Owner

kiyoon commented Sep 25, 2023

If you want to use remote server, you can port forward the Jupyter Notebook and use it. You need to first open Jupyter Notebook (let's say you can connect it at localhost:8888, with port forwarding).

Second, you set up Jupynium locally on Windows, Mac or Linux.

Note that you can also connect to the remote neovim. You can choose to use neovim locally, or connect remotely in the server. However Jupynium must be run locally, so that it will show you the browser locally.

@ziontee113
Copy link

This is only my speculation, I think the problem is due to the version of the notebook package being <7.0
I'm on Arch Linux, and I'm running everything in a venv.
I fiddled with using Jupyter Notebook without Jupynium for a while, so I install Jupyter Notebook 6 so I can use some extensions that can't be used in Jupyter version 7.
Then I went back to trying Jupynium and ran into the same 404 error like @WillWang8216 encountered.

I simply pip uninstall notebook and pip install notebook, and Jupynium seems to work as expected again.

@kiyoon
Copy link
Owner

kiyoon commented Dec 11, 2023

@ziontee113 It works on both 6 and 7 but you need to change the URL accordingly, because of the fact that Notebook 7 uses /nbclassic suffix in the URL.

@strikoder
Copy link

strikoder commented Jan 7, 2024

Thank you for leaving this issue open, it helped a lot!
I went exactly through what @SupercoolBD went, I use ubuntu 22.04 with AwesomeWM, I had to launch jupyter notebook by myself and to change the route in the file from executing "notebook" to "jupyter notebook" and everything worked!

Edit: I had the same error when I installed firefox from snap store, I fixed it by downloading and installing from their official website with geckodriver.

@EGmux
Copy link

EGmux commented Feb 4, 2024

Jupynium properly starts the server when I call "JupyniumStartAndAttachToServer/ToServerInTerminal" however I got error 404 after accesing the url, but I've noticed that jupyter notebook uses "localhost:8890/tree" as URL, so after changing the default_notebook_URL line in my config to the one below :

default_notebook_URL = "localhost:8890/nbclassic",

I got rid of the dreaded 404 😄

@devilunraveled
Copy link

devilunraveled commented Feb 13, 2024

I might be a late to the party, but I am getting this issue on my system as well, the one in the title, Jupynium: RPC channel closed. Stop sending all notifications.. I am also using Manjaro.

Bit of a context that I think might be relevant :
The entire setup was running nicely for me before, then I started to notice that using :JupyniumStartSync command alone was taking some considerable time for me (>5 s). So I used :JupyniumStartSync <filename>, which interestingly ran much faster. Then, I simply used the command with the filename, and things were working fine. Unfortunately, my laptop crashed midway and I could not save my final .ju.py file or run :JupyniumStopSync. After reboot, when I opened my file again, I ran :JupyniumStartAndAttachToServer and then :JupyniumStartSync, (without the file name). Since it was taking some time, I closed the terminal itself, hoping to run it again with the filename.

When I opened the file , attached to the server and ran :JupyniumStartSync <filename>, it too didn't run quickly, instead, it didn't show any progress at all, until I notiiced that 70% of my RAM had been consumed. When I retried the process, I simply ran out of RAM. Now, I have a 16GB RAM, and I have tried to do this multiple times, and with the same result, I have no changes in the config files except for these lines :

    -- Write jupyter command but without "notebook"
    -- When you call :JupyniumStartAndAttachToServer and no notebook is open,
    -- then Jupynium will open the server for you using this command. (only when notebook_URL is localhost)
    jupyter_command = "jupyter",
    --- For Conda, maybe use base environment
    --- then you can `conda install -n base nb_conda_kernels` to switch environment in Jupyter Notebook
    -- jupyter_command = { "conda", "run", "--no-capture-output", "-n", "base", "jupyter" },

    -- Used when notebook is launched by using jupyter_command.
    -- If nil or "", it will open at the git directory of the current buffer,
    -- but still navigate to the directory of the current buffer. (e.g. localhost:8888/nbclassic/tree/path/to/buffer)
    notebook_dir = nil,

    -- Used to remember the last session (password etc.).
    -- e.g. '~/.mozilla/firefox/profiles.ini'
    -- or '~/snap/firefox/common/.mozilla/firefox/profiles.ini'
    firefox_profiles_ini_path = '~/.mozilla/firefox/profiles.ini',
    -- nil means the profile with Default=1
    -- or set to something like 'default-release'
    firefox_profile_name = 'default-release',

@devilunraveled
Copy link

So I restarted my system, deleted the file and created a new one with a new name and same data, and it works again, although I am still suspicious about the RAM thing because it peaked at around 65% this time, without any browser opening at all from the command, and once it opened, it dropped back to around 5% eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants