Skip to content

Commit

Permalink
fix: ruff format message is shown even when it is disabled (my bad)
Browse files Browse the repository at this point in the history
  • Loading branch information
KMohZaid committed Aug 19, 2024
1 parent 3c02ff0 commit e5236cb
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pylsp_ruff/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit e5236cb

Please sign in to comment.