New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The `autoClosingBrackets` behavior can't be turned off in Jupyterlab notebook #3358

telamonian opened this Issue Dec 11, 2017 · 4 comments


None yet
4 participants

telamonian commented Dec 11, 2017

I might be missing something, but it seems like it's currently impossible to turn off the auto bracket/quote closing behavior when editing notebook in Jupyterlab. The autoClosingBrackets option in the Text Editor settings seems to only apply when I open a plain text file, but doesn't change anything for notebooks.


This comment has been minimized.


telamonian commented Dec 11, 2017

I hacked around in the code for a little bit trying to find an easy solution, but it turned out to be sort of complicated.

Ultimately, the problem seems to be twofold:

  • There's no notebook equivalent to the autoClosingBrackets option.
  • At the lowest level, auto closing is controlled by the CodeMirror.autoCloseBrackets option. However, regardless of what this option is initially set to, auto closing is always turned on in notebook cells by the following lines in codemirror/src/editor.ts:
    let isCode = (mime !== 'text/plain') && (mime !== 'text/x-ipythongfm');
    editor.setOption('matchBrackets', isCode);
    editor.setOption('autoCloseBrackets', isCode);

The mime type for a python cell is text/x-ipython, so isCode is always true.

@ellisonbg ellisonbg added this to the Beta milestone Dec 12, 2017


This comment has been minimized.


ellisonbg commented Dec 12, 2017

Marking as a beta as this would help us to work out menu structure @ian-r-rose @jasongrout


This comment has been minimized.


jasongrout commented Dec 15, 2017

@ian-r-rose - assigning to you as this may impact the menu structure.


This comment has been minimized.


ian-r-rose commented Dec 15, 2017

The main issue here is that we need to think about editor settings for the notebook overall. Unresolved questions:

  1. Should the notebook and the text editor share settings? I think that they use sufficiently different editing modes that we may want to have separate settings for them.
  2. How should we handle per-view and overall settings? I suspect we may want to have the notebook/text editor draw their settings from the registry upon creation, but then allow those to be overridden on a per-widget basis using the menu UI.
  3. Should there be separate settings for code an markdown cells? Probably...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment