There is a configuration conflict between the ruff.lint.extendSelect and ruff.format.args settings.
gfourdx opened this issue · 3 comments
vscode settings.sjon:
{
"python.defaultInterpreterPath": "/home/toor/venvs/dispatch-api/bin/python3",
"python.languageServer": "Pylance",
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"terminal.integrated.tabs.enabled": true,
"explorer.autoReveal": true,
"editor.fontSize": 14,
"editor.guides.bracketPairs": true,
"outline.showVariables": false,
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports.ruff": "explicit",
"source.fixAll.ruff": "explicit",
},
"ruff.lineLength": 88,
"ruff.lint.select": ["E", "F", "W", "Q", "UP", "I", "N"],
"ruff.lint.extendSelect": ["TCH"],
"ruff.format.args": ["--config", "format.quote-style='preserve'"],
}
vscode verion: v1.92.0
ruff extension version: v2024.36.0
environment: wsl2(Debian)
python: 3.9.2
I have enabled the setting "ruff.format.args": ["--config", "format.quote-style='preserve'"]
The configuration "ruff.lint.extendSelect": ["TCH"] will become ineffective
If the "ruff.format.args": ["--config", "format.quote-style='preserve'"] is commented out
then "ruff.lint.extendSelect": ["TCH"] will become effective
as shown in the image below:
Yes, that is expected. For context,
ruff.format.args
is going to be deprecated and is not read by the native server as mentioned in the documentation for that setting:
While, ruff.lint.extendSelect
is a new setting which is only relevant when the native server is being used (ruff.nativeServer
is "on"
) and is also mentioned in the documentation:
In your config, the following settings are only relevant to the native server:
"ruff.lineLength": 88,
"ruff.lint.select": ["E", "F", "W", "Q", "UP", "I", "N"],
"ruff.lint.extendSelect": ["TCH"],
But, as you have set the ruff.format.args
setting, the extension will use the old server (ruff-lsp
) which doesn't know about the above settings.
Currently, to migrate this config, you'd need to include the formatter setting in your local config file. If you want to use a common config for all your projects in an editor, you can use the ruff.configuration
option.
Does this help? Feel free to ask any other questions that you might have.
Same as astral-sh/ruff#11228, I think makes sense to have native options for these settings.
Since it's not possible to implement single exclusive settings, we should consider adding them one by one.
Yes, that is expected. For context,
While, [`ruff.lint.extendSelect`](https://docs.astral.sh/ruff/editors/settings/#extendselect) is a new setting which is only relevant when the native server is being used (`ruff.nativeServer` is `"on"`) and is also mentioned in the documentation: In your config, the following settings are only relevant to the native server:
ruff.format.args
is going to be deprecated and is not read by the native server as mentioned in the documentation for that setting:"ruff.lineLength": 88, "ruff.lint.select": ["E", "F", "W", "Q", "UP", "I", "N"], "ruff.lint.extendSelect": ["TCH"],But, as you have set the
ruff.format.args
setting, the extension will use the old server (ruff-lsp
) which doesn't know about the above settings.Currently, to migrate this config, you'd need to include the formatter setting in your local config file. If you want to use a common config for all your projects in an editor, you can use the
ruff.configuration
option.Does this help? Feel free to ask any other questions that you might have.
thank you