koxudaxi / ruff-pycharm-plugin

PyCharm plugin for ruff. This plugin provides reformat code using ruff.
MIT License
173 stars 6 forks source link

Display Documentation/Link to Rules #425

Open stevin-wilson opened 2 months ago

stevin-wilson commented 2 months ago

Is your feature request related to a problem? Please describe. First of all, Thanks for the wonderful tool!

Is there a way to show the documentation (preferred) or link for the rule along with the tooltip?

For example, could the documentation for rule T201 be accessed from the tooltip in the attached screenshot?

Screenshot 2024-04-17 at 10 24 28 AM

Describe the solution you'd like

It would be very helpful if the documentation (including "use instead" information) can be displayed in the tooltip.

Screenshot 2024-04-17 at 12 17 26 PM

Another option is to include a link to webpage containing the documentation for the rule as described in https://github.com/astral-sh/ruff-lsp/pull/163#issue-1764225194

Additional context

koxudaxi commented 2 months ago

Thank you for creating the issue. We should implement it. We can show the document in the tooltips like this. https://github.com/JetBrains/intellij-community/blob/dc4c2e27c42e2a2dce8714d8da19e6ef6493ae13/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibDocumentationLinkProvider.java#L976-L995

Also, I put the link in the tail of the tooltips in the pydantic plugin. https://github.com/koxudaxi/pydantic-pycharm-plugin/blob/1b52d2eb2e51fba0653e011ccb8baaaec5c2a64d/src/com/koxudaxi/pydantic/PydanticDocumentationLinkProvider.kt#L34-L43