-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Adding multi-line block comments for Python #1372
Comments
I wasn't aware Python has block comments. What exactly do you mean? |
To clarify, this has nothing to do with keyboard layouts. The problem is that the block comment command is no-op in languages where the block comment tokens are not defined. The first question is whether you would consider having block comment syntax using string literals ( Currently On JupyterLab repo a frequent request is to make the block comment work for Python. Naively, this would be a small change: - commentTokens: {line: "#"}
+ commentTokens: {line: "#", block: {open: '"""', close: '"""'}} but I am not sure if having the same opening and closing syntax for block comments is supported. An alternative idea would be to fallback from the block comment command to use line comment if block comment is not defined. |
I don't want to set string syntax as comment syntax (though you could do so locally if you want, using |
Neat, thank you for the hint!
Users often use both Python and JavaScript and another language in the same notebook (Python for computation, JS for visualisation), so they do want to have separate shortcuts for different kinds of comments. We could write a command which decides based on the language to use one or the other (or more specifically to do that based on whether language data at a given position includes |
I agree. Given that there's already toggle comment commands for block, line, and any type, I don't want to make the comment-type-specific commands also generic. You'll have to write a custom command, but it can be pretty simple, just running the commands from @codemirror/command in the order you prefer until one returns true. |
Describe the issue
Currently, it's not possible to toggle multi line block-comments in JupyterLab on non-US keyboard layouts.
It would be amazing if this feature could be added to codemirror, as this would help a lot of people all around the world to quickly comment/uncomment their code blocks in JuyterLab.
Here is the corresponding comment in JupyterLab:
jupyterlab/jupyterlab#16186 (comment)
Thanks for considering this issue!
cc. @krassowski
Browser and platform
JupyterLab
Reproduction link
No response
The text was updated successfully, but these errors were encountered: