Skip to content
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

Run Black formatter and Isort in one command in a regular Python file. #295

Open
3h4 opened this issue Mar 7, 2023 · 0 comments
Open

Run Black formatter and Isort in one command in a regular Python file. #295

3h4 opened this issue Mar 7, 2023 · 0 comments

Comments

@3h4
Copy link

3h4 commented Mar 7, 2023

I'm trying to run Jupyterlab_code_formatter in a regular python file in Jupyter Lab. It is not formatted on save. I Can add a shortcut to manually run it:

  {
      "args": {},
      "command": "jupyterlab_code_formatter:black",
      "keys": [
          "Ctrl K",
          "Ctrl M"
      ],
      "selector": ".jp-CodeMirrorEditor"
  },

Can I add a shortcut to run both Isort and Black formatter? The following setting doesn't work:

{
  "shortcuts": [
    {
      "command": "apputils:run-all-enabled",
      "args": {
        "commands": ["jupyterlab_code_formatter:black", "jupyterlab_code_formatter:isort"],
      },
      "keys": [
        "Ctrl K",
        "Ctrl M"
      ],
      "selector": ".jp-CodeMirrorEditor"
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant