'line or block comment shortcut in JupyterLab on Mac with german keyboard

So I googled a lot for a solution but nothing I found was working. Only that one, but for Jupyter Notebooks, not JupyterLab: https://stackoverflow.com/a/71480779/7056765

What also sounded promising but didn't work: https://github.com/jupyter/notebook/issues/3753#issuecomment-404928725

Furthermore, I tried to set a keyboard shortcut in the advanced settings in JupyterLab. But I didn't find the right command in the commands. I hoped something like that would work, in the user preferences:

{
    "shortcuts": [
        {
            "command": "notebook:toggle-line-comment",
            "keys": [
                "Ctrl #"
            ],
            "selector": "body"
        },
        {
            "command": "fileeditor:line-comment",
            "keys": [
                "Ctrl #"
            ],
            "selector": "body"
        }
    ]
}

If anyone has a solution, please let me know. :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source