Open lensvol opened 10 months ago
@lensvol Thank you for creating the issue and sponsoring me 🙇
If you agree that this is a valid issue but don't have time to work on it, I can make a PR for that.
I agree with your observation. It would be great if you could create a PR to address this. However, before that, I have one concern. How would the plugin behave if the user is in the middle of editing the toml file and ruff gets executed, resulting in an error? Would it not become a nuisance alert for the user?
I do not see how that specific scenario is possible when editing TOML in the IDE, honestly. As far as I can see, Ruff binary will only get called in the following situations:
Run Ruff
Cases 2 and 3 have safeguards in the form of isApplicableTo
, which will prevent Ruff execution due to the file not being a Python one.
Case 1 probably will not annoy the user, since the appearance of that pop-up is caused by their own hands.
Speaking more broadly, Ruff execution errors could also be reported via notification balloon instead of a modal pop-up.
@lensvol
Sorry, I did not consider that isApplicableTo
.
Please ignore my concern.
Speaking more broadly, Ruff execution errors could also be reported via notification balloon instead of a modal pop-up.
I prefer a notificaiton ballon :)
How would the plugin behave if the user is in the middle of editing the toml file and ruff gets executed, resulting in an error? Would it not become a nuisance alert for the user?
This would actually be highly based if the plugin could run on pyproject.toml
[tool.ruff]
target-version = "py312"
asdf = true
> ruff check
ruff failed
Cause: Failed to parse C:\Users\AMONGUS\projects\test-python\pyproject.toml
Cause: TOML parse error at line 521, column 1
|
521 | [tool.ruff]
| ^^^^^^^^^^^
unknown field `asdf`
So we could show the error in the toml file:
[tool.ruff] # ruff failed: unknown field `asdf`
target-version = "py312"
asdf = true
Could I suggest a file level banner error over a balloon notification, I fell it would be better suited.
Describe the bug When the plugin calls ruff binary and it exits with an unexpected error (e.g. there is a typo in
ruff.toml
), the user will not get notified about that, but instead, an IDE exception is being raised. Since those are not easy to find (small red icon in the right corner) and require you to parse Kotlin traceback message with your eyes it is difficult to debug the exact cause of an error.To Reproduce Steps to reproduce the behavior:
ruff.toml
with the following contents:Expected behavior A pop-up that relays the exact error message produced by failed ruff run.
Environments (please complete the following information):
If you agree that this is a valid issue but don't have time to work on it, I can make a PR for that.