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

ruff server: Code action for re-enabling rules when cursor is on noqa comments #11382

Open
T-256 opened this issue May 12, 2024 · 4 comments
Open
Assignees
Labels
server Related to the LSP server

Comments

@T-256
Copy link
Contributor

T-256 commented May 12, 2024

Could it possible instead of clearing noqa by hand, add code action when moving cursor on noqa code comments?
For example, moving cursor on # noqa:, show these code actions:

  • Ruff (ANN201): Re-enable for this line.
  • Ruff (D103): Re-enable for this line.
  • Re-enable all disabled rules for this line.

Originally posted by @T-256 in #11276 (comment)

@AlexWaygood AlexWaygood added the server Related to the LSP server label May 12, 2024
@T-256
Copy link
Contributor Author

T-256 commented May 24, 2024

Closing as it's not possible with today LSP specification to determine the cursor position.

@T-256 T-256 closed this as completed May 24, 2024
@MichaReiser
Copy link
Member

Would it be possible to implement this as a potential refactor? I'm not that familiar with the LSP spec but there must be a way to publish code actions based on the current position (e.g. refactors)

@MichaReiser
Copy link
Member

Actually, this is supported by the code action request. It sends an optional range field that can be used to provide additional code actions.

@T-256 T-256 reopened this May 27, 2024
@snowsignal
Copy link
Contributor

I think we could do this! (And it would be a nice feature to have)

@snowsignal snowsignal self-assigned this Jun 3, 2024
@snowsignal snowsignal added this to the Ruff Server: Post-Stable milestone Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Related to the LSP server
Projects
None yet
Development

No branches or pull requests

4 participants