can't disable autoclose brackets - I swear those extra closing brackets are stalking me!
codeisnotcode opened this issue ยท 21 comments
On Jupyter 4.0.6 on Kubuntu 14.04, with any of the config.js shown below, autoclose brackets won't stop autoclosing. This has to be the most annoying 'helpful feature', especially since its idea of where to autoclose is almost always wrong. It frequently causes brackets to appear and disappear unexpectedly, including turning ( into (]), turning )) into ), etc. Rather than fixing the (obscure) method of disabling the 'feature", why not kill the autoclose feature once and for all? Burn all copies of the code that enabled it. You'll be a hero!
By the way, aside from this one item, Jupyter absolutely rocks!
--
require(['notebook/js/codecell'], function (codecell) {
codecell.CodeCell.options_default.cm_config.autoCloseBrackets = false;
})
IPython.CodeCell.options_default.cm_config.autoCloseBrackets = false;
if (IPython.CodeCell) {
IPython.CodeCell.options_default.cm_config.autoCloseBrackets = false;
}
I agree that autoclosing brackets can be tricky, but not that it should be removed entirely.
Here's how you can set it in frontend config with the current code:
# Run this in Python once, it should take effect permanently
from notebook.services.config import ConfigManager
c = ConfigManager()
c.update('notebook', {"CodeCell": {"cm_config": {"autoCloseBrackets": False}}})
To restore the default, do the same with None
in place of False.
Outstanding! Thanks!
Would it be possible to have this as a menu option or off by default? It would be nice if it worked like almost every other editor does (by default).
What I absolutely loathe about the Auto-Close feature is that it not only generates matching parentheses but sometimes swallows a closing parenthesis based on what the algorithm's thinks you are trying to do. It is too "intelligent" by half. I want control over parentheses.
Another option for those who want auto close brackets disabled:
Add the following to your custom.js
:
define([
'base/js/namespace',
], function(Jupyter) {
Jupyter.CodeCell.options_default.cm_config.autoCloseBrackets = false;
})
This will make it disabled by default for your environment.
What is the reference of Markdown type cells? I tried running this code with MarkdownCell instead of CodeCell. However, this does not seem to work.
I don't think that Markdown cells use autoCloseBracket
. If I type an opening bracket in a Markdown cell, it doesn't auto-close (and yes, this is after confirming that the Code cells are auto-closing).
The following works for me (for code cells):
Add the following snippet into ~/.jupyter/nbconfig/notebook.json
,"CodeCell": { "cm_config": { "autoCloseBrackets": false } }
@gnestor
My version of jupyter is 4.4.0 and ipython 6.2.1 and when I am in markdown mode it does autoclose brackets for me. Not sure if this can be fixed in Nbextensions.
@cvanelteren What version of jupyter notebook?
jupyter notebook --version
jupyter --version = 4.4.0 jupyter notebook --version = 5.2.1
Hmmm ๐ค What browser are you using? And to confirm, you are seeing automatic bracket closing in Markdown cells vs. code cells?
@gnestor In code cells i turned the feature off. However, in markdown cells the same feature does not work. I tried in 2 different browsers; chrome, firefox [quantum]
Autoclosing brackets hands-down the most annoying thing about Jupyter. Pretty much 100% of the time jupyter messes with my parentheses, it's wrong - not only because it makes the wrong decisions, but because it's completely different from any reasonable text editing environment.
I think subjecting new programmers to automatic parentheses is evil and wrong. It's like giving a child cigarettes: sure, they should be able to choose to partake in a harmful activity when they're old enough to know what they're doing, but when you start them on it at a young age, they're dependent for life, and completely helpless when they can't get their fix.
It should be disabled by default, or for god's sake at least provide an easy way to turn it off.
Or as OP suggested: remove the feature altogether and make the world a better place.
Anyways, rant over. Autoclosing brackets aside, Jupyter is absolutely amazing and thank you for your hard work.
The following js snippet worked for me in Chrome to turn off autoclose in both code cells and markdown cells.
// This turns off the autoclose brackets
// <ctrl><shift>J opens the javascript console. cut and paste there
// and hit return. You will only have to do this once
var cell = Jupyter.notebook.get_selected_cell();
var config = cell.config;
var patch = {
CodeCell:{
cm_config:{autoCloseBrackets:{pairs: ""}}
}
}
config.update(patch)
Since several people here seem to hate this feature, y'all might be interested in avoiding the same pain in JupyterLab. Please add your opinion there: jupyterlab/jupyterlab#5741.
It would be nice if there was a button in the default toolbar to toggle auto-completion of brackets. My vote would be for the default to be off (but this default should depend on custom.js
)
Is there still no easy way of disabling this? Why must one go edit obscure JS files to fix this? 99% of the time when I write a close parents is because I need one, but 99% of that time, Jupyter just swallows it and seems to audibly laugh at me.
This is an infuriating anti-feature. It's wrong much more often than correct. It took like and hour of searching around to find a way to turn it off, and a dozen more ways that didn't because of non-existent config files or programs like JupyterLab which seems to be a Windows only thing.
This should absolutely default to off... Very few text editors do this, and the ones that do at least make it easy to turn off.
What is the current way of turning it off? I've tried everything listed above to no avail. This is just such an anti-feature.
I believe devs no longer receive notifications for this issue.