-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Add Jupyter action for CodeMirror indentAuto command #3175
Conversation
How confident are we that this shortcut is not already used for anything in some browser? Generally, whenever we add a Ctrl- shortcut, we get complaints that it overrides some other shortcut that people like. |
Similar sentiment expressed by @Carreau at #2591 (comment):
|
Would it be possible to add some of these "nice to have but not necessary" CodeMirror commands to the notebook actions, allowing people to access // Get selected cell
var selected_cell = notebook.get_selected_cell();
// Execute a CM command
selected_cell.code_mirror.execCommand('indentAuto'); |
I think that makes sense, yep. :-) |
notebook/static/edit/js/editor.js
Outdated
}, | ||
indentUnit: 4, | ||
theme: "ipython", | ||
theme: "default", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this change is part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, the intent was to make the CodeMirror config (shortcuts, theme, etc.) consistent between code cells in the notebook and the file editor. The code cells use the "default" theme and the editor uses the "ipython" theme. Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. I don't have any particular objection if you think it's the right thing to do, but I think it would have been better to do it as a separate PR so it could be discussed separately.
Git blame shows @minrk set it to use the IPython theme three years ago in 0efd335 . Min, do you have any recollection whether there was a need for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, that's asking a lot of my foggy memory. Maybe it had to do with how magics were highlighted? Try highlighting some IPython-specific syntax and see if it works the same. If it looks fine, I've no objection.
@gnestor if you want to get rid of the editor theme change, I think it's fine to merge this PR for 5.3. |
Ok, I'm moving the syntax stuff to another PR. This is ready to merge 👍 |
Thanks :-) |
Closes #2591
Adds a shortcut for CodeMirror’s
indentAuto
command that doesn’t collide with special characters on French/German keyboards (#2535) and also adds it to both the cell editor and text/file editor.