You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow arbitrary config keys in ruff.configuration (#702)
## Summary
Closes: #6
This PR adds support for astral-sh/ruff#16296
for the VS Code extension by allowing any arbitrary object in
`ruff.configuration`
Additionally, it will provide a warning message to the user if they're
using inline configuration but the Ruff version does not support it.
It has one disadvantage that the user will see two popups where the
error one is coming from the server because it cannot deserialize the
options. We could not show the warning popup if this is too much. I'm
worried that it might go unnoticed because the "Show Logs" in the below
popup will open the server logs while the message would be in the client
logs.
<img width="491" alt="Screenshot 2025-02-25 at 1 24 15 PM"
src="https://github.com/user-attachments/assets/8bafbd69-f8fa-4604-8ab3-1f6efa745045"
/>
We'll still log it on the console (client log channel):
```
2025-02-25 13:24:10.067 [warning] Inline configuration support was added in Ruff 0.9.8 (current version is 0.9.7). Please update your Ruff version to use this feature.
```
I haven't provided more details in the warning message based on the
assumption that if the user is using inline configuration then they're
aware of it but it's just that the Ruff version is too old.
## Test Plan
Refer to the test plan in astral-sh/ruff#16296
Copy file name to clipboardexpand all lines: package.json
+15-2
Original file line number
Diff line number
Diff line change
@@ -102,9 +102,22 @@
102
102
},
103
103
"ruff.configuration": {
104
104
"default": null,
105
-
"markdownDescription": "Path to a `ruff.toml` or `pyproject.toml` file to use for configuration. By default, Ruff will discover configuration for each project from the filesystem, mirroring the behavior of the Ruff CLI.\n\n**This setting is used only by the native server.**",
105
+
"markdownDescription": "Configuration overrides for Ruff. See [the documentation](https://docs.astral.sh/ruff/editors/settings/#configuration) for more details.\n\n**This setting is used only by the native server.**",
106
106
"scope": "window",
107
-
"type": "string"
107
+
"type": [
108
+
"string",
109
+
"object"
110
+
],
111
+
"oneOf": [
112
+
{
113
+
"type": "string",
114
+
"markdownDescription": "Path to a `ruff.toml` or `pyproject.toml` file to use for configuration."
115
+
},
116
+
{
117
+
"type": "object",
118
+
"markdownDescription": "Inline JSON configuration for Ruff settings (e.g., `{ \"line-length\": 100 }`). *Added in Ruff 0.9.8.*"
0 commit comments