jupytercalpoly / jupyterlab-code-snippets

Save, reuse, and share code snippets using JupyterLab Code Snippets!
https://jupyterlab-code-snippets-documentation.readthedocs.io
Other
164 stars 25 forks source link

Can not add snippet #255

Open Erimus-Koo opened 1 year ago

Erimus-Koo commented 1 year ago

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 year ago

+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"
            ]
        }
    ]
}
dangarciahe commented 4 months ago

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