Jupyter_contrib_nbextensions: Hinterland: disable autocomplete when I try to run the cell [Shift+Enter]

Created on 19 Mar 2019  路  5Comments  路  Source: ipython-contrib/jupyter_contrib_nbextensions

Is there a way NOT to get autocompletion from hints if I just want to run the cell after typing code?

This is very annoying, especially when I put some index for a list/dict/dataframe and hit "Shift+Enter", only to find out that instead of the program starting, hinterland just autocompleted my index with "and".

Most helpful comment

Actually, I can't reproduce the issues you mention.
For avoiding completion after digits, use \:[0-9] for exclude_regexp and remove them from include_regexp [\(%A-Za-z._/\\~-]; though I don't have completion after digits myself.

Provide an example if I misunderstand

All 5 comments

In hindsight, what could alleviate my problem even more, is the ability to configure hinterland to edit out automatic hints after inputting numerical values.
Having "and/if/in..." being proposed every time a user writes any integer seems to be more of an annoyance than a way to increase productivity, in my perspective. Is there a way to disable it?

Perhaps could you use the configuration options as mentioned in the documentation?

hinterland.exclude_regexp: A regular expression tested against the character before the cursor, which, if a match occurs, prevents autocompletion from being triggered. This is useful, for example, to prevent triggering autocomplete on a colon, which is included by the default Completer.reinvoke pattern. If blank, no test is performed. Note that the regex will be created without any flags, making it case sensitive.

hinterland.include_regexp: A regular expression tested against the character before the cursor, which must match in order for autocompletion to be triggered. If left blank, the value of the notebook's Completer.reinvoke_re parameter is used, which can be modified by kernels, but defaults to /[%0-9a-z._/\:~-]/i. Note that although the Completer.reinvoke_re default is case insensitive by virtue of its /i flag, any regex specified by the user will be created without any flags, making it case sensitive.

Thank you. I tried playing with configuration options before but made the mistake of not restarting notebook after changes, so they proved ineffective. This certainly potentially solves at least part of my problems once I master regex.

What about the original question, though? I can't see any option that would suppress the autocompletion feature when using keyboard shortcut to run the cell.
I could use other extension to change the hotkey itself for something not including [Enter], but that would be very confusing for other people using my notebooks who are used to running cells with [Shift+Enter].

Actually, I can't reproduce the issues you mention.
For avoiding completion after digits, use \:[0-9] for exclude_regexp and remove them from include_regexp [\(%A-Za-z._/\\~-]; though I don't have completion after digits myself.

Provide an example if I misunderstand

I honestly see the same problem as the OP mentions. When writing an index of an array, Hinterland quickly prompts the most basic autocomplete keywords like and, if, or and so on. I always need to move the cursor or press any other key to toggle the prompt. I would otherwise insert the autocomplete keyword into my code when pressing Shift + Enter or Ctrl + Enter to run the cell.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skabbe picture skabbe  路  6Comments

echosori picture echosori  路  3Comments

serjtroshin picture serjtroshin  路  4Comments

slowkow picture slowkow  路  3Comments

reedv picture reedv  路  6Comments