techrah / jupyterext-text-shortcuts

A Jupyter Lab extension for keyboard text shortcuts
MIT License
50 stars 11 forks source link

Failed to save shortcuts user preferences #2

Closed felihong closed 4 years ago

felihong commented 4 years ago

Hi there,

first of all, thanks for providing such a useful toolkit.

I now have a small question regarding saving the shortcuts user preferences. After installing and enabling the extension, I add some test shortcuts and want to save it as described in the document. However the icon stays unresponsive (grey color) and I can't save the modifications.

Screenshot 2020-01-29 at 10 21 22

Environments

Thanks for your help!

felihong commented 4 years ago

Hi again, I guess I just found the answer. I originally copied the sample customization from the document, it seems like I have to add a comma symbol at the end of shortcuts to make this json format work.

{
    "shortcuts": [
        {
            "command": "text-shortcuts:insert-text",
            "args": {
                "text": "%>%",
                "autoPad": true
            },
            "keys": [
                "Accel Shift M"
            ],
            "selector": "body"
        },
        {
            "command": "text-shortcuts:insert-text",
            "args": {
                "text": "<-",
                "autoPad": true
            },
            "keys": [
                "Alt -"
            ],
            "selector": "body"
        },
    ]
}
techrah commented 4 years ago

That's weird. I do not have to add the extra , in order to save. In fact, that extra comma technically makes it invalid JSON.

Anyway, glad you got it to work! 👍