jupyter / jupyter/notebook

New Feature. Intelligent Autocomplete.

Open
#4,098 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

Hello, first of all big thanks to maintainers of the Jupyter project )
I was using Jupyter notebook very often during last year as I like its interactivity and rich html functionality, which default IDLE lacks.

However, it wonders me why, despite project being actively used by a large community (including python/julia programmers and all sorts of AI developers), so little efforts has been spent on bringing to it at least some intelligence. It's year 2018 today and we could expect from widely adopted coding tool to use every mean accessible to increase coder's productivity, right?

But it does not seem to be the case. Let me elaborate.
Automatic bracketing does not count as it's rather annoying and harmful. So many times I have to correct it after it has destroyed my already existing parentheses, it's crazy. Especially given that python is not a compiled language and syntax error at some deep level often becomes evident only after huge mount of wasted execution time. So that feature, in my opinion, clearly needs fixing. Its logic needs to take into account already existing parentheses, and not just dumbly overwrite them. But this is digression.

Another idea that could improve coder's productivity is more intelligent Autocomplete. When I press TAB after typing part of variable's name, a list of matching names is suggested in a popup. But it's always sorted by variable's name and does not take into account what I am actually trying to do with that variable. Why not make this feature local context-aware, by taking into account textual content of current row where I'm requesting autocomplete? This way names more relevant for current row could be placed on top of the list (and rest still remain sorted alphabetically). As a result, it would oftentimes save scrolling through the lists of autocomplete. Logic could be simple at first iteration: if textual similarity (in terms of Levenstein distance, for instance) between current row and some of matching variable's name is significantly higher than the rest, place that variable higher to the top of the autocomplete list.

In future I can envision this getting replaced by even more advanced ML technique where not only textual matching counts but also instructions, types of operands and other meta-information at the disposal of the interpreter. Trained on large corpus of github code, such engine could be issuing high quality recommendations in real time, right as a developer starts typing in his ideas into the notebook :-)

![image](https://user-images.githubusercontent.com/16359856/46910029-bae40980-cf45-11e8-882f-5ade3f2ed286.png)

In the example above, I clearly want **train_group_mean** variable to be on top of the list, as I already have all 3 words "train", "group" and "mean" in my current row.

Maybe someone has already considered implementing this feature? Does anyone agree with me that it could be useful? Or for most people it's not a problem to press 2-4 more keys each time they use autocomplete?

Contributor guide

Open the contributing guide

Research direction

The issue names no file, test, or implementation entry point for autocomplete or parenthesis handling. Start by locating the notebook autocomplete implementation and its existing tests, then define a focused first iteration and acceptance criteria before attempting the broader context-aware or ML-based proposal.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.