-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
[enhancement] Support codeActionsOnSave source.fixAll #135
Comments
Hello! Thanks for feature request, I currently haven't implemented this code action kind so I don't think it will work without doing so. I don't think it's too hard as I have already implemented the quick fix code actions for when you hover over an error. So I think basically when I can definitely implement this but I am not exactly sure when I will get around to it and I just haven't had a personal need for it. If you are interested in taking a stab, look here for the code actions handlers: You might also want to look at an extension like this https://marketplace.visualstudio.com/items?itemName=Jota0222.multi-formatter that will allow you to use both xo and prettier as a formatter at the same time, which should work just fine as long as you extend the eslint-prettier-config package to make sure formatting rules get turned off in xo. I'll leave this open as a feature request until I can get around to it. |
Cool thanks for the quick reply and the leads on an implementation approach! I might dig into it, but will give the multi-formatter extension a try first. (I had been trying out vscode-run-on-save, but it seemed a bit shaky sometimes.) |
source.fixAll code actions are now supported as of v3.18 {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
}
} |
Hi, thanks for all the effort that has gone into this extension.
I'm trying to configure things in such a way that xo handles lint fixes, and prettier handles formatting. (I don't want to run prettier through xo / ESLint, both to avoid red-squiggly noise and to separate the concern / consolidate the process of formatting files that don't fall under xo's purview.)
My VSCode
settings.json
looks roughly like:This approach works great with the ESLint plugin (in that case passing
"source.fixAll": "explicit"
instead of"xo.fix": "explicit"
toeditor.codeActionsOnSave
), but it never seems to triggerxo.fix
on save.I can invoke the action manually through the VSCode command palette
> xo.fix
, and it works great.Tried a bunch of permutations in
settings.json
, with no luck. I added some tracing to the extension and it looks like thefixAllProblems
function isn't failing, it's simply never invoked.Also tried explicitly specifying
xo.runtime
, but that wasn't it.When using
xo
as the formatter, fixes are correctly applied viaeditor.formatOnSave
.Not sure where to start with this one. Maybe something about hooking into the code that runs on
source.fixAll
(Providing an action forCodeActionKind.SourceFixAll
), so xo fixes are aggregated with changes provided by other extensions and are therefore invoked viasource.fixAll
?Thanks for any insights.
The text was updated successfully, but these errors were encountered: