Skip to content

Display context for ruff.configuration errors - #15452

Merged
dhruvmanila merged 1 commit into
mainfrom
dhruv/display-err-context
Jan 13, 2025
Merged

Display context for ruff.configuration errors#15452
dhruvmanila merged 1 commit into
mainfrom
dhruv/display-err-context

Conversation

@dhruvmanila

Copy link
Copy Markdown
Member

Summary

I noticed this while trying out astral-sh/ruff-vscode#665 that we use the Display implementation to show the error which hides the context. This PR changes it to use the Debug implementation and adds the message as a context.

Test Plan

Before:

   0.001228084s ERROR main ruff_server::session::index::ruff_settings: Unable to find editor-specified configuration file: Failed to parse /private/tmp/hatch-test/ruff.toml

After:

   0.002348750s ERROR main ruff_server::session::index::ruff_settings: Unable to load editor-specified configuration file

Caused by:
    0: Failed to parse /private/tmp/hatch-test/ruff.toml
    1: TOML parse error at line 2, column 18
         |
       2 | extend-select = ["ASYNC101"]
         |                  ^^^^^^^^^^
       Unknown rule selector: `ASYNC101`

@dhruvmanila dhruvmanila added the server Related to the LSP server label Jan 13, 2025
@github-actions

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhruvmanila
dhruvmanila merged commit 56b1445 into main Jan 13, 2025
@dhruvmanila
dhruvmanila deleted the dhruv/display-err-context branch January 13, 2025 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Related to the LSP server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants