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

Consider unsafe-fixes settings for code actions #15666

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

dhruvmanila
Copy link
Member

Summary

Closes: #13960

Test Plan

Using the example from astral-sh/ruff-vscode#672:

Screen.Recording.2025-01-22.at.11.27.23.AM.mov

@dhruvmanila dhruvmanila added bug Something isn't working server Related to the LSP server labels Jan 22, 2025
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@@ -143,6 +152,7 @@ impl RuffSettingsIndex {
directory.to_path_buf(),
Arc::new(RuffSettings {
path: Some(pyproject),
unsafe_fixes: settings.unsafe_fixes,
Copy link
Member

Choose a reason for hiding this comment

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

Do you remember what's the reason for only storing parts of the settings instead of the entire settings struct with accessors for the linter/formatter settings?

Copy link
Member Author

@dhruvmanila dhruvmanila Jan 22, 2025

Choose a reason for hiding this comment

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

I think it started out with just having LinterSettings and FormatterSettings (#10950) but later on we realized (via bug reports) that exclusions weren't being considered by the server which led to adding the FileResolverSettings (#11551).

It makes me wonder if we should simply store the entire Settings struct in RuffSettings. It seems like we eventually will need all of them anyway?

Yeah, I agree. I can do that as a follow-up.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thanks. This looks good. It makes me wonder if we should simply store the entire Settings struct in RuffSettings. It seems like we eventually will need all of them anyway?

@dhruvmanila dhruvmanila merged commit 043ff61 into main Jan 22, 2025
21 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/server-unsafe-fixes branch January 22, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server Related to the LSP server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider unsafe-fixes config value for code action / command
2 participants