Skip to content

Commit c5727e1

Browse files
martinaljhossbach
authored andcommitted
fix: don't try to read from dict that has not been initialized when toml parsing failed
1 parent fdc5d69 commit c5727e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pylsp_ruff/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ def load_settings(workspace: Workspace, document_path: str) -> PluginSettings:
567567
try:
568568
with open(pyproject_file[0], "rb") as f:
569569
toml_dict = tomllib.load(f)
570+
if "tool.ruff" in toml_dict:
571+
config_in_pyproject = True
570572
except tomllib.TOMLDecodeError:
571573
log.warn("Error while parsing toml file, ignoring config.")
572-
if "tool.ruff" in toml_dict:
573-
config_in_pyproject = True
574574

575575
ruff_toml = find_parents(
576576
workspace.root_path, document_path, ["ruff.toml", ".ruff.toml"]

0 commit comments

Comments
 (0)