jupytercalpoly/jupyterlab-code-snippets

Can not add snippet

Opened this issue · 2 comments

Describe the bug
Add snippet by creating new or dragging, console raise an error:
image

  1. Installed in Extension Manager, get a blank panel.
  2. Remove the Extension Manager version
  3. Installed by pip
  4. Panel appears, but can not add.
genzj commented

+1, same problem here. I think it has something to do with the setting initialization but not sure. Here is a workaround at least making the plugin usable: editing ~/.jupyter/lab/user-settings/jupyterlab-code-snippets/snippets.jupyterlab-settings and manually add at least one snippet to the snippets key of the config. The edited file may look like:

{
    // Code Snippet Manager
    // jupyterlab-code-snippets:snippets
    // Code Snippet Manager Settings
    // *********************************

    // Font Size of Preview
    // Change the font size of preview to see its content
    "snippetPreviewFontSize": 3,

    // List of code snippets
    // A snippet is defined by a 'id', 'name', and 'language'
    "snippets": [
        {
            "name": "placeholder",
            "description": "placeholder",
            "language": "python",
            "code": "nothing",
            "id": 0,
            "tags": [
                "nothing"
            ]
        }
    ]
}

Thanks, this workaround still works as of Jupyterlab Version 4.2.0.