From e5236cbdfe83679816142ff6e238005cff704c62 Mon Sep 17 00:00:00 2001 From: KMohZaid <68484509+KMohZaid@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:01:14 +0000 Subject: [PATCH] fix: ruff format message is shown even when it is disabled (my bad) --- pylsp_ruff/plugin.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pylsp_ruff/plugin.py b/pylsp_ruff/plugin.py index c7e9b7c..d494af1 100644 --- a/pylsp_ruff/plugin.py +++ b/pylsp_ruff/plugin.py @@ -117,19 +117,19 @@ def pylsp_format_document(workspace: Workspace, document: Document) -> Generator """ - with workspace.report_progress("format: ruff"): - log.debug(f"textDocument/formatting: {document}") - outcome = yield - result = outcome.get_result() - if result: - source = result[0]["newText"] - else: - source = document.source + log.debug(f"textDocument/formatting: {document}") + outcome = yield + result = outcome.get_result() + if result: + source = result[0]["newText"] + else: + source = document.source - settings = load_settings(workspace=workspace, document_path=document.path) - if not settings.format_enabled: - return + settings = load_settings(workspace=workspace, document_path=document.path) + if not settings.format_enabled: + return + with workspace.report_progress("format: ruff"): new_text = run_ruff_format( settings=settings, document_path=document.path, document_source=source )