From 2867a45eca0362390d54b184fbf519c7ac268a52 Mon Sep 17 00:00:00 2001 From: KMohZaid <68484509+KMohZaid@users.noreply.github.com> Date: Mon, 7 Oct 2024 08:54:17 +0000 Subject: [PATCH 1/3] notfy: give ack. when isort formatter runs --- pylsp_isort/plugin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pylsp_isort/plugin.py b/pylsp_isort/plugin.py index 10e75e9..a0f9d7f 100644 --- a/pylsp_isort/plugin.py +++ b/pylsp_isort/plugin.py @@ -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__) @@ -34,8 +34,12 @@ 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 + with workspace.report_progress("format: isort"): + _format(outcome, config, document) _format(outcome, config, document) From 66fd3a4780efd9fc3a0002dbdf4a0b4febcac4cd Mon Sep 17 00:00:00 2001 From: KMohZaid <68484509+KMohZaid@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:05:56 +0000 Subject: [PATCH 2/3] notify: ack. when range format runs --- pylsp_isort/plugin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pylsp_isort/plugin.py b/pylsp_isort/plugin.py index a0f9d7f..ad2e331 100644 --- a/pylsp_isort/plugin.py +++ b/pylsp_isort/plugin.py @@ -44,9 +44,12 @@ def pylsp_format_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( From af97b9ceb551dc33f1061a0eb6df61d8a0e82cfb Mon Sep 17 00:00:00 2001 From: KMohZaid <68484509+KMohZaid@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:27:28 +0530 Subject: [PATCH 3/3] remove 2nd _format() call (forgot to remove T_T) --- pylsp_isort/plugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pylsp_isort/plugin.py b/pylsp_isort/plugin.py index ad2e331..87f4b92 100644 --- a/pylsp_isort/plugin.py +++ b/pylsp_isort/plugin.py @@ -40,7 +40,6 @@ def pylsp_format_document( outcome = yield with workspace.report_progress("format: isort"): _format(outcome, config, document) - _format(outcome, config, document) @hookimpl(hookwrapper=True)