Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect errors while building up the settings index #12781

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Aug 9, 2024

Summary

Related to astral-sh/ruff-vscode#571, this PR updates the settings index builder to trace all the errors it encountered. Without this, there's no way for user to know that something failed and some of the capability might not work as expected. For example, in the linked PR, the settings were invalid which means notebooks weren't included and there were no log messages for it.

Test Plan

Create an invalid ruff.toml file:

[tool.ruff]
extend-exclude = ["*.ipynb"]

Logs:

2024-08-12 18:33:09.873 [info] [Trace - 6:33:09 PM]   12.217043000s ERROR ruff:main ruff_server::session::index::ruff_settings: Failed to parse /Users/dhruv/playground/ruff/pyproject.toml

Notification Preview:

Screenshot 2024-08-12 at 18 33 20

Another way to trigger is to provide an invalid cache-dir value:

[tool.ruff]
cache-dir = "$UNKNOWN"

Same notification preview but different log message:

2024-08-12 18:41:37.571 [info] [Trace - 6:41:37 PM]   21.700112208s ERROR ThreadId(30) ruff_server::session::index::ruff_settings: Error while resolving settings from /Users/dhruv/playground/ruff/pyproject.toml: Invalid `cache-dir` value: error looking key 'UNKNOWN' up: environment variable not found

With multiple pyproject.toml file:

2024-08-12 18:41:15.887 [info] [Trace - 6:41:15 PM]    0.016636833s ERROR ThreadId(04) ruff_server::session::index::ruff_settings: Error while resolving settings from /Users/dhruv/playground/ruff/pyproject.toml: Invalid `cache-dir` value: error looking key 'UNKNOWN' up: environment variable not found

2024-08-12 18:41:15.888 [info] [Trace - 6:41:15 PM]    0.017378833s ERROR ThreadId(13) ruff_server::session::index::ruff_settings: Failed to parse /Users/dhruv/playground/ruff/tools/pyproject.toml

@dhruvmanila dhruvmanila added the server Related to the LSP server label Aug 9, 2024
Copy link
Contributor

github-actions bot commented Aug 9, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dhruvmanila dhruvmanila marked this pull request as draft August 9, 2024 13:09
Copy link

codspeed-hq bot commented Aug 12, 2024

CodSpeed Performance Report

Merging #12781 will not alter performance

Comparing dhruv/settings-index-error (2004c6a) with main (2ea7957)

Summary

✅ 32 untouched benchmarks

@dhruvmanila dhruvmanila marked this pull request as ready for review August 12, 2024 13:12
@MichaReiser
Copy link
Member

Thanks. This is a great addition!

@dhruvmanila dhruvmanila enabled auto-merge (squash) August 12, 2024 15:38
@dhruvmanila dhruvmanila merged commit 5400232 into main Aug 12, 2024
17 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/settings-index-error branch August 12, 2024 15:42
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