n-riesco / jp-kernel

Generic Node.js kernel for the Jupyter notebook
Other
21 stars 15 forks source link

Plase fix bug #12

Open yanite opened 1 year ago

yanite commented 1 year ago

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... `

Konubinix commented 2 months ago

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