Show rule explanation popup on hover in `pyproject.toml`
I noticed that when I hover my cursor over a # noqa: ABC123 comment in a .py file, it shows a popup explaining what the ABC123 rule is.
My suggestion is to have this popup also on the pyproject.toml file, when you hover over rules in the tool.ruff.[select|ignore|unfixable] sections, for example.
.. Are there any updates on this? This would be really nice to have.
.. Are there any updates on this? This would be really nice to have.
I think this could be better handled in a TOML specific extension like https://github.com/tamasfe/taplo/tree/master/editors/vscode at least in VS Code. The relevant issue seems to be https://github.com/tamasfe/taplo/issues/373 although I'm not sure why it's closed.
I think we could do this by changing how we generate the schema: We can generate a schema for every enum value and use anyOf. This should allow us to set a description.
SchemaStore recommends this approach:
{
"oneOf": [
{ "const": "A001", "description": "# builtin-variable-shadowing (A001)\n\nDerived from..." },
{ "const": "A002", "description": "# builtin-argument-shadowing (A002)\n\nDerived from..." },
...
]
}
A small thing to note is that the descriptions cost a total of ~900KB in size. That's about 6 times the current schema's size when pretty printed using 2-space indentation and 8 or 9 times minified.
I've been using https://github.com/Jannchie/ruff-ignore-explainer, which works great, but it would be lovely to have it folded into the main Ruff extension