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

Move args and run settings to lint.args and lint.run #255

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

charliermarsh
Copy link
Member

Summary

This PR moves the args and run settings under a lint namespace, in a backwards-compatible way, such that we continue to respect existing configurations.

These settings only affect the linter and not the formatter. In particular, this will enable us to add format.args in the future, for ruff format command-line arguments.

@@ -2,16 +2,15 @@

from typing_extensions import Literal, TypedDict

Run = Literal["onSave", "onType"]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe RunOn or RunTrigger or something else less generic

@charliermarsh charliermarsh force-pushed the charlie/lint-settings branch from 3588ca2 to 9b3b32c Compare October 2, 2023 14:00
charliermarsh added a commit to astral-sh/ruff-vscode that referenced this pull request Oct 2, 2023
## Summary

This is the peer PR to astral-sh/ruff-lsp#255,
adding `ruff.lint.args` and `ruff.lint.run` to the VS Code settings.
Again, these changes are backwards-compatible, and the deprecations are
also visible in the VS Code UI. (Specifically, according to the [VS Code
documentation](https://code.visualstudio.com/api/references/contribution-points),
these settings _won't_ show up in the VS Code UI.)
@charliermarsh charliermarsh merged commit 10acf3f into main Oct 2, 2023
@charliermarsh charliermarsh deleted the charlie/lint-settings branch October 2, 2023 15:05
charliermarsh added a commit to astral-sh/ruff-vscode that referenced this pull request Oct 2, 2023
## Summary

This is the peer PR to astral-sh/ruff-lsp#255,
which adds `lint.args` and `lint.run` to the VS Code extension, and
deprecates `args` and `run`:

<img width="582" alt="Screen Shot 2023-10-02 at 3 07 32 PM"
src="https://github.com/astral-sh/ruff-vscode/assets/1309177/68188078-ada1-4060-a8bb-3a734183f5e3">

The behavior is as follows:

- If you have `lint.run` defined in your settings, we will respect it
and ignore `run`.
- Otherwise, if you have `run` defined in your settings, we will respect
it.
- Otherwise, we fall back to the default value.

Confusingly, if you set `run`, VS Code _still_ doesn't show it in the
visual settings UI, which is unfortunate, as one edge case here is:

- You have `run` defined.
- You set `lint.run` in the visual UI.
- (`run` is still defined in your `settings.json`, but not visible in
the UI.)
- You unset `lint.run` in the visual UI.
- (VS Code then removes `lint.run` from your `settings.json`, since it
now matches the default value and is unnecessary.)
- Now, you're using the old `run` setting even though it's not visible
in the UI.

I'm not sure if there's a great way around this. We could consider
showing a warning, but that might be somewhat intrusive?

## Test Plan

Extensive local testing 😅
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants