Skip to content

Commit cb6bb60

Browse files
committed
Preserve compatibility with format settings
Codes listed in this setting should be included in fixes performed as part of a formatting pass.
1 parent 582a1a1 commit cb6bb60

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pylsp_ruff/plugin.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
from pathlib import PurePath
77
from subprocess import PIPE, Popen
8-
from typing import Dict, Generator, List, Optional
8+
from typing import Dict, Final, Generator, List, Optional
99

1010
if sys.version_info >= (3, 11):
1111
import tomllib
@@ -62,7 +62,7 @@
6262
"H": DiagnosticSeverity.Hint,
6363
}
6464

65-
ISORT_FIXES = "I"
65+
ISORT_FIXES: Final = "I001"
6666

6767

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

133-
settings.select = [ISORT_FIXES] # clobber to just run import sorting
133+
settings.select = [ISORT_FIXES]
134+
if settings.format:
135+
settings.select.extend(settings.format)
134136
new_text = run_ruff(
135137
settings=settings,
136138
document_path=document.path,

0 commit comments

Comments
 (0)