-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Block Comment Indentation #954
Comments
The notebook just triggers CodeMirror's toggleComment action. How that's performed is entirely up to CodeMirror, you may want to ask over there if there's a way to influence this. |
Hi @minrk , just to follow up. I can see that CodeMirror devs is saying there is no bug in CodeMirror, and
So, how would I go about changing my notebook's behaviour such that toggleComment is called with indent=true? Is there a configuration setting, or would I have to implement it myself by altering the Jupyter Notebook source code? |
Even if the issue is as simple as providing a configurable option that is then passed to CodeMirror, it still seems like this is a relevant "issue" that should be reopened, no @minrk? |
Hi @lzkelley , I looked at it briefly until I realized it isn't possible to configure Jupyter Notebook to pass arguments when calling CodeMirror functions from the keymap options (or at least, it wasn't obvious to me how to do so). My understanding from a cursory review:
The current Notebook code doesn't seem to anticipate having to pass any arguments/options when calling I see two obvious paths to solving this:
However, I don't have the insight into Jupyter Notebook development to know which approach is preferable. Edit: Just saw that @juhasch has updated jupyter_contrib_nbextensions, updating the toggle_comment function to call |
@scholer: It looked like a simple enough addition. Glad if it helps. |
@juhasch thanks for this! Can you clarify how to enable this? I tried doing:
The errors I get look like:
|
You need to do
or activate the extension using the configurator. The installation docs can be found here. |
Cannot get this to work. Installed and enable those cryptic nbextension (my love for jupyter is crumbling fast), but no cigar. Block comments still start at beginning of line.
Which... to me means the proper indentation should work. |
This may be related to you keyboard shortcut not working with the extension. Did you use |
@juhasch Rather, |
Try using |
Hi, does this fix also works with JupyterLab? |
Is there any update to this? I am using Mac with US keyboard. What works is this: Seems like the either the default setting of standard hotkey can not be overridden or comment-uncomment extension only works with Alt. I think it would be more intuitive to be able to use OS specific key with this extension to do commenting just like what common editor does. |
When trying to comment a line within a block, it seems to make more sense to indent the comment symbol as well.
For example:
When commenting the first line inside the block, I expect the code to look like this:
but notebook defaults to this:
Here is a gif describing the above:
This is the default way of commenting in Sublime Text.
Is this possible to configure in jupyter notebook? Thanks!
The text was updated successfully, but these errors were encountered: