Skip to content

Do not use the active text editor for running organize imports code actions #2137

Description

@mjbvz

Problem
Python's organize import code actions currently only work if you have an active text editor: https://github.com/Microsoft/vscode-python/blob/f7b5c4fa6f58d9c8997df2c88fef2e97a308a385/src/client/sortImports.ts#L8

This means that we can not apply the organize imports action to background files. This breaks this extension and may also break liveshare scenarios

Proposed fix
The code action could pass the document uri to this comment so that the active editor is not required. (may also require switching to using WorkspaceEdit)

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions