vscode-format-code-action icon indicating copy to clipboard operation
vscode-format-code-action copied to clipboard

Please check 'CodeActionContext.only' to only return requested code actions.

Open Airkro opened this issue 4 years ago • 7 comments

Version: 0.1.0

Settings:

{
  "editor.codeActionsOnSave": [
    "source.organizeimports", // put anything before format
    "source.formatDocument",
    "source.fixAll.eslint"
  ]
}

Output panel:

[exthost] [warning] rohit-gohri.format-code-action - Code actions of kind 'source.fixAll.format'
requested but returned code action is of kind 'source.formatModified'. Code action will be dropped.
Please check 'CodeActionContext.only' to only return requested code actions.

[exthost] [warning] rohit-gohri.format-code-action - Code actions of kind 'source.formatDocument'
requested but returned code action is of kind 'source.formatModified'. Code action will be dropped.
Please check 'CodeActionContext.only' to only return requested code actions.

Airkro avatar Feb 19 '21 10:02 Airkro

Does anyone know what the underlying cause is, or if there's a work-around? This extension had been working for me, then stopped with this error presenting in the log any time I save.

Edit: In my case, the behavior went away when I restarted the ESLint server (command palette: ESLint: Restart ESLint Server).

maslade avatar Aug 16 '21 14:08 maslade

I'm just having this issue. For me, it starts formatting back and forth between prettier formatting and eslint fixing. I'm only hitting save once. The extension has been working fine for me with the same settings for years, but suddenly this has started happening.

Does anyone know how to fix this or workaround it? Or wheter there's any alternative? Repeating actions

sergioadimedia avatar Nov 04 '22 09:11 sergioadimedia

Actually, I've found that this particular issue may be caused by vscode itself. Here's the issue: https://github.com/microsoft/vscode/issues/165326

sergioadimedia avatar Nov 04 '22 12:11 sergioadimedia

For me, it starts formatting back and forth between prettier formatting and eslint fixing. I'm only hitting save once.

Are you using codeActionsOnSave as an array or an object?

rohit-gohri avatar Nov 04 '22 13:11 rohit-gohri

I'm using it as an array:

"editor.codeActionsOnSave": ["source.formatDocument", "source.fixAll.eslint"],
"editor.defaultFormatter": "esbenp.prettier-vscode"

After I rolled back to the previous version of vscode (v1.72,2) it's working fine again.

sergioadimedia avatar Nov 07 '22 07:11 sergioadimedia

I'm just having this issue. For me, it starts formatting back and forth between prettier formatting and eslint fixing. I'm only hitting save once. The extension has been working fine for me with the same settings for years, but suddenly this has started happening.

Does anyone know how to fix this or workaround it? Or wheter there's any alternative? Repeating actions Repeating actions

i am now stuck here, been digging for anything on the topic. thanks for the references.

steven87vt avatar Nov 08 '22 17:11 steven87vt

Please see this comment - https://github.com/rohit-gohri/vscode-format-code-action/issues/13#issuecomment-1307403778

If it's still not solved then please open a new issue, this problem is not related to the original issue.

rohit-gohri avatar Nov 08 '22 17:11 rohit-gohri