Vscode-jupyter: Python Interactive window needs intellisense/autocomplete

Created on 28 Jan 2019  路  10Comments  路  Source: microsoft/vscode-jupyter

Input in the Python Interactive window should support auto complete as Jupyter does. We can actually use the live information from the session as well as the language server.

Most helpful comment

Our latest insider's build has this feature partially working.

You should be able to get autocomplete and hover support in the Python Interactive window:

Autocomplete:
image

Hover:
image

We've also forced the input box to always be on the bottom.

If you have any comments, please feel free to leave comments here or enter new issues.

The work is continuing too. I'm currently adding signature help (parameter hints) and fixing some bugs. Next up will be integrating the information Jupyter has at runtime into the autocomplete list.

All 10 comments

I'd highly recommend using Monaco for this, cuz the API would be very similar (however there could be a lot of manual work to hook everything together).
Tips - https://www.npmjs.com/package/monaco-languageclient

Question:

  • Will we be using LS or Jupyter to provide the auto completion, or both?

@DonJayamanne the goal is to use both the LS and Jupyter for auto completion.

Vscode could integrate ipython (not notebook) instead of jupyter. Instead of pythons default REPL, send selected code to ipython repl (by shift + enter) . The only way to using ipython in VSC is closing python repl and enter ipython. selected text will be sent to ipython. But problem is you can't do this for function or class or any block duo to extra indentation vscode add's to each line.
Example of code in ipython. :

In [1]: def foo():
...: a = 1
...: return a
File "<ipython-input-1-c4b7c27db83b>", line 3
return a
^
IndentationError: unexpected indent

What's the benefit to using the IPython console over the Python Interactive window? There's no intellisense there either as far as I can tell.

@rchiodo IPython has its own autocomplete engine, try it out by pressing TAB

Ah okay. It was hard to tell. I don't think we'll be switching to a plain IPython console though. However the fact that it provides tab completion likely means we can leverage it to compute extra data for our autocomplete (like column names on a DataFrame).

Jupyter kernels provide autocompletion too, along with other metadata (which you probably already use in the Variable Explorer, etc.)

Tons of info about how JupyterLab did the communication: https://github.com/jupyterlab/jupyterlab/issues/4876

... and the PR, which uses TypeScript to implement on CodeMirror: https://github.com/jupyterlab/jupyterlab/pull/5049 (Some discussion of future work with Monaco and LSP too, may be useful)

Our latest insider's build has this feature partially working.

You should be able to get autocomplete and hover support in the Python Interactive window:

Autocomplete:
image

Hover:
image

We've also forced the input box to always be on the bottom.

If you have any comments, please feel free to leave comments here or enter new issues.

The work is continuing too. I'm currently adding signature help (parameter hints) and fixing some bugs. Next up will be integrating the information Jupyter has at runtime into the autocomplete list.

Oh awesome news, I just made an issue about this.
Good stuff!!

This shipped in our last release.

Was this page helpful?
0 / 5 - 0 ratings