Skip to content

notfy: give ack. when isort formatter runs #5

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

Merged
merged 3 commits into from
Oct 11, 2024
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