microsoft / vscode-isort

Import sorting for python using the isort library.
https://marketplace.visualstudio.com/items?itemName=ms-python.isort
MIT License
91 stars 22 forks source link

no command in command palette when using notebooks #281

Closed TTTPOB closed 1 year ago

TTTPOB commented 1 year ago

opened a jupyter notebook in python language in vscode, want to sort import, but there is no such command in command palette image

I can confirm this work flawlessly in normal python file

vscode version: 1.79.0-insider (user setup) isort extension version: v2022.8.0

karthiknadig commented 1 year ago

This currently is not supported in notebooks. Waiting on this to be implemented in an underlying library: https://github.com/openlawlibrary/pygls/issues/311

torext commented 1 year ago

This currently is not supported in notebooks. Waiting on this to be implemented in an underlying library: openlawlibrary/pygls#311

Actually, @karthiknadig, this used to work fine in v2022.8.0, it's only as of 2023.10.0 that this doesn't work anymore! So this is a bug and not a feature request...

EDIT: I created the relevant issue here https://github.com/microsoft/vscode-isort/issues/303.

karthiknadig commented 1 year ago

There are two parts to this bug:

  1. The Cell import sorting stopped showing up is a regression.
  2. The full notebook support is still the one I mentioned in my comment above.

@torext thanks for reporting the issue. the fix should be in pre-release.

torext commented 1 year ago

Thanks, will install pre-release!

On Wed, 12 Jul 2023, 21:53 Karthik Nadig, @.***> wrote:

There are two parts to this bug:

  1. The Cell import sorting stopped showing up is a regression.
  2. The full notebook support is still the one I mentioned in my comment above.

@torext https://github.com/torext thanks for reporting the issue. the fix should be in pre-release.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-isort/issues/281#issuecomment-1633121158, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACMMLW2IWBKTVVNU2L6ZRBLXP36DRANCNFSM6AAAAAAYIYSNXA . You are receiving this because you were mentioned.Message ID: @.***>

TTTPOB commented 1 year ago

The Cell import sorting stopped showing up is a regression.

image I've installed pre-release version v2023.11.12711013, but I can't find the sort import command in command palette.

karthiknadig commented 1 year ago

@TTTPOB The command is Organize Imports

image

Previously, python extension contributed a custom command Sort Imports. This did not integrate with VS Code's internal mechanism to fix import organization issues. The isort extension integrates with the Organize Import feature.

TTTPOB commented 1 year ago

@TTTPOB The command is Organize Imports

Thank you! I didn't know that.