n-riesco/jp-kernel

complete_reply: missing metadata

Opened this issue · 1 comments

yanite commented

handles.js
function complete_request
add metadata

    function onSuccess(result) {
        var content = {
            matches: result.completion.list,
            cursor_start: result.completion.cursorStart,
            cursor_end: result.completion.cursorEnd,
            status: "ok",
                        metadata: {
                _jupyter_types_experimental: [
                    { start: result.completion.cursorStart
                    , end: result.completion.cursorEnd
                    , text: result.completion.list
                    , type: 'keyword'
                    , signature: ''}
                ]
            }
        };
        request.respond(this.shellSocket, "complete_reply", content);
    }

fix
`Jupyter console 6.6.3

IJavascript v5.2.1
https://github.com/n-riesco/ijavascript

Unhandled exception in event loop:
File "D:\Python\lib\site-packages\prompt_toolkit\buffer.py", line 1933, in new_coroutine
await coroutine(*a, **kw)
File "D:\Python\lib\site-packages\prompt_toolkit\buffer.py", line 1757, in async_completer
async for completion in async_generator:
File "D:\Python\lib\site-packages\prompt_toolkit\completion\base.py", line 323, in get_completions_async
async for completion in completer.get_completions_async(
File "D:\Python\lib\site-packages\prompt_toolkit\completion\base.py", line 199, in get_completions_async
for item in self.get_completions(document, complete_event):
File "D:\Python\lib\site-packages\jupyter_console\ptshell.py", line 154, in get_completions
meta = content["metadata"]

Exception 'metadata'
Press ENTER to continue...
`

I also stumbled into this issue.
Indeed ptshell expects the metadata field, as described by the documentation of the protocol.