Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions pylsp_isort/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from isort.settings import KNOWN_PREFIX
from pylsp import hookimpl
from pylsp.config.config import Config
from pylsp.workspace import Document
from pylsp.workspace import Document, Workspace

logger = logging.getLogger(__name__)

Expand All @@ -34,15 +34,21 @@ def pylsp_settings() -> Dict[str, Any]:


@hookimpl(hookwrapper=True)
def pylsp_format_document(config: Config, document: Document) -> Generator:
def pylsp_format_document(
config: Config, workspace: Workspace, document: Document
) -> Generator:
outcome = yield
_format(outcome, config, document)
with workspace.report_progress("format: isort"):
_format(outcome, config, document)


@hookimpl(hookwrapper=True)
def pylsp_format_range(config: Config, document: Document, range: Range) -> Generator:
def pylsp_format_range(
config: Config, workspace: Workspace, document: Document, range: Range
) -> Generator:
outcome = yield
_format(outcome, config, document, range)
with workspace.report_progress("format: isort"):
_format(outcome, config, document, range)


def _format(
Expand Down