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

when autoFixOnSave fails, the file can't be saved #144

Open
vhoyer opened this issue Jan 24, 2024 · 3 comments
Open

when autoFixOnSave fails, the file can't be saved #144

vhoyer opened this issue Jan 24, 2024 · 3 comments

Comments

@vhoyer
Copy link

vhoyer commented Jan 24, 2024

I vote the file to be saved even if i have thrown an error, less disturbing to the flow

@bartels
Copy link

bartels commented Feb 16, 2024

This is a problem for me as well. I have autoFixOnSave enabled since I usually do want to use it. But some projects do not have an eslint configuration because they don't use eslint at all. In these cases not only do I get a loud error message but the file cannot be saved.

I understand that this feature does require an eslint configuration to work, since that's what eslint itself requires. But it should probably not prevent writing files altogether

Error detected while processing BufWritePre Autocommands for "*"..function coc#rpc#request[4]..<SNR>45_request[34]..BufWritePre Autocommands for "*"..function coc#rpc#request[4]..<SNR>45_request:
line   31:
E605: Exception not caught: Error on request: Vim(return):Error invoking 'doAutocmd' on channel 3 (coc):^@Request textDocument/codeAction failed with message: No ESLint configuration found in /home/mrmelve/.dotfiles/vim/.vim.

Maybe there is a way to catch and show the warning message but still allow the autocmd to finish successfully?

@ic-768
Copy link

ic-768 commented Apr 14, 2024

Same issue

@ensia96
Copy link

ensia96 commented Jul 8, 2024

To avoid this error, I think coc-eslint needs default eslint config that can be used when there is no config files in project.

I changed my formatter to prettier to temporarily fix this issue for my own.

I added _ to my old config property "eslint.autoFixOnSave" and add "coc.preferences.formatOnSaveFileTypes": ["*"]

{
  "_eslint.autoFixOnSave": true,
  ...
  "coc.preferences.formatOnSaveFileTypes": ["*"],
  ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants