Skip to content

Commit

Permalink
Preserve compatibility with format settings
Browse files Browse the repository at this point in the history
Codes listed in this setting should be included in fixes performed as
part of a formatting pass.
  • Loading branch information
mmcshane committed Nov 10, 2023
1 parent 582a1a1 commit 077f739
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pylsp_ruff/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
from pathlib import PurePath
from subprocess import PIPE, Popen
from typing import Dict, Generator, List, Optional
from typing import Dict, Final, Generator, List, Optional

if sys.version_info >= (3, 11):
import tomllib
Expand Down Expand Up @@ -62,7 +62,7 @@
"H": DiagnosticSeverity.Hint,
}

ISORT_FIXES = "I"
ISORT_FIXES: Final = "I"


class Subcommand(str, enum.Enum):
Expand Down Expand Up @@ -130,7 +130,9 @@ def pylsp_format_document(workspace: Workspace, document: Document) -> Generator
settings=settings, document_path=document.path, document_source=source
)

settings.select = [ISORT_FIXES] # clobber to just run import sorting
settings.select = [ISORT_FIXES]
if settings.format:
settings.select.extend(settings.format)
new_text = run_ruff(
settings=settings,
document_path=document.path,
Expand Down

0 comments on commit 077f739

Please sign in to comment.