Skip to content

Commit

Permalink
fix: don't try to read from dict that has not been initialized when t…
Browse files Browse the repository at this point in the history
…oml parsing failed
  • Loading branch information
martinal authored and maerteijn committed Sep 24, 2023
1 parent f6707df commit 83c658b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pylsp_ruff/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,10 @@ def load_settings(workspace: Workspace, document_path: str) -> PluginSettings:
try:
with open(pyproject_file[0], "rb") as f:
toml_dict = tomllib.load(f)
if "tool.ruff" in toml_dict:
config_in_pyproject = True
except tomllib.TOMLDecodeError:
log.warn("Error while parsing toml file, ignoring config.")
if "tool.ruff" in toml_dict:
config_in_pyproject = True

ruff_toml = find_parents(
workspace.root_path, document_path, ["ruff.toml", ".ruff.toml"]
Expand Down

0 comments on commit 83c658b

Please sign in to comment.