ale icon indicating copy to clipboard operation
ale copied to clipboard

Make `astyle` under `:ALEFix` operate on buffer

Open ankitpati opened this issue 3 years ago • 3 comments

Previously, :ALEFix made astyle operate on the disk file, and populated the buffer with the results, potentially losing work.

This PR regresses #3257, but that appears to be a bug with astyle itself, not with ale, so it should be fixed there anyways. I feel avoiding data-loss should be a higher goal than working around astyle bugs.

Thanks for your awesome work!

ankitpati avatar Aug 28 '22 02:08 ankitpati

@jhlink Steps to reproduce:

  1. Ensure astyle is the only ALE fixer defined for C.
  2. Open a .c file with valid C code.
  3. Add a line of valid C code anywhere in the file.
  4. Run :ALEFix
  5. Observe that the added line has vanished.

ankitpati avatar Sep 11 '22 03:09 ankitpati

Took some time to re-read the related discussions and test this PR and unfortunately applying this PR reverts the initial issue. If we do not use the --stdin flag then astyle fails to find and use any .astylerc or _astylerc configuration files within the project. This would be a breaking change so I cannot approve this PR unless alternative solution for the .astylerc/_astylerc file issue is also included.

hsanson avatar Sep 11 '22 10:09 hsanson

Thanks for helping with the analysis @hsanson !

jhlink avatar Sep 11 '22 16:09 jhlink

This pull request has been automatically marked as stale because it has not been updated recently. Make sure to write tests and document your changes. See :help ale-dev for information on writing tests. If your pull request is good to merge, bother w0rp or another maintainer again, and get them to merge it.

stale[bot] avatar Nov 09 '22 09:11 stale[bot]