| Age | Commit message (Collapse) | Author |
|
|
|
apheleia-indent-lisp-buffer (#393)
apheleia-indent-lisp-buffer copies several buffer-local variables to the
scratch buffer before running indent-region, but lisp-indent-offset and
lisp-body-indent are missing. When either of these is set in the
original
buffer, the scratch buffer falls back to different defaults, producing
indentation that disagrees with what indent-region would produce
interactively.
Reproducer: with lisp-indent-offset set to 2, the following form
(setopt
lsp-inlay-hint-enable t
lsp-log-io nil)
formats to one space of indentation instead of two.
Fix: sync lisp-indent-offset and lisp-body-indent from the original
buffer
to the scratch buffer, the same way the existing code already does for
indent-line-function, lisp-indent-function, and indent-tabs-mode.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
Seems fairly straightforward to me, Terraform is no longer open-source,
OpenTofu is the compatible open-source successor, similar to the
Redis/Valkey situation.
Of course, if someone still prefers to use Terraform instead, they can
easily customize using:
```tf
(setf (alist-get 'terraform-mode apheleia-mode-alist) 'terraform)
```
We don't have a mechanism for allowing multiple formatters to be
registered for the same major mode, where later ones could be used if
earlier ones are not installed. That might be a nice addition.
|
|
Add neocaml-mode and neocaml-interface-mode to the list of modes that
can be formatted with ocamlformat
|
|
In OpenBSD and FreeBSD, `diff` don't have support for `--rcs`. In these
cases, we need to use `gdiff` or `GNU diff` for this support.
This change, fix the use of `diff `or `gdiff` for these OSes and make
apheleia work.
|
|
|
|
The --no-doc argument removes existing document separators (---) from
yaml files. It is perfectly valid and common practice to use multiple
documents within a single file, e.g. in the kubernetes universe.
Formatting such files with --no-doc breaks their validity.
See also the prettier-yaml test, which preserves the document separator,
too.
|
|
Behavior of `aphaleia-npx` currently differs from other formatters by
triggering an error when formatter is missing (causing a message to be
displayed in minibuffer and an error buffer to be created).
This PR adds a test to check if command is on user's PATH before
executing it in order to make `aphaleia-npx` silently ends when the
formatter command is not found at project and system level.
|
|
## Summary
- Add oxfmt (Oxc Formatter) as a new formatter option for JavaScript and
TypeScript files
## Details
[Oxfmt](https://oxc.rs/docs/guide/usage/formatter) is a Rust-powered,
Prettier-compatible code formatter from the Oxc project. It's currently
in alpha but offers significant performance improvements (30x+ faster
than Prettier).
Key points:
- Uses `inplace` mode since oxfmt doesn't support stdin/stdout
- Works with all common JS/TS extensions (.js, .jsx, .mjs, .cjs, .ts,
.tsx, .mts)
- Not added to `apheleia-mode-alist` - users can opt-in by setting
`apheleia-formatter` to `oxfmt`
- Defaults are already sensible: 2-space indent, printWidth 100, no tabs
Example usage:
```elisp
(setf (alist-get 'oxfmt apheleia-formatters)
'("apheleia-npx" "oxfmt" inplace))
;; To use for JS/TS files:
(setq-default apheleia-formatter 'oxfmt)
;; Or per-mode:
(setf (alist-get 'typescript-ts-mode apheleia-mode-alist) 'oxfmt)
```
|
|
This make rubocop obey exclusions from config files. Otherwise, even if
a file is excluded from in .rubocop.yml, apheleia will still format it.
See
https://docs.rubocop.org/rubocop/usage/basic_usage.html#command-line-flags
|
|
The shfmt formatter produced an invalid command invocation. The symptom
was an error: `eval: Invalid function: "-i"`
I couldn't figure out how to splice the list in correctly but
`--indent=` can be passed as one argument.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
Add support for `bibtex-mode` using emacs native function
`bibtex-reformat`.
|
|
Hi,
This adds formatting of Objective-C/C++ files via clang-format. I was
unsure about adding support for Objective-C++ (*.mm) since Emacs doesn't
have a dedicated mode for such files and regexp association in
`apheleia-mode-alist` feels a bit out of place. Please, correct me if
this is wrong.
|
|
|
|
|
|
Hi! My first time adding a formatter, please let me know if I missed
anything.
Some things I'm unclear about:
1. How to fail gracefully when [styleR](https://styler.r-lib.org/)
package is absent from the system
2. Whether the formatter should be named `ess-r` or something more
general like `rlang`
## Test case
FYI, there are loads of tests to pick from on
https://github.com/r-lib/styler/tree/main/tests/testthat.
I picked
[unindention/mixed-in.R](https://github.com/r-lib/styler/blob/main/tests/testthat/unindention/mixed-in.R),
but oddly, the output
[unindention/mixed-out.R](https://github.com/r-lib/styler/blob/main/tests/testthat/unindention/mixed-out.R)
isn't quite the same as we got!
I don't know if that's an upstream issue, or that upstream changed style
since that test was written, or that perhaps the file is meant to be
concatenated into something else.
|
|
Add `js-json-mode` to `apheleia-formatters-indent` with the same
behavior as `json-mode`.
|
|
Taplo is a very popular formatter and linter for TOML.
https://github.com/tamasfe/taplo
|
|
|
|
Unfortunately, I have to write some C#
|
|
Trivial change - other modes include `-ts-mode` variants, but not yaml.
This fix is confirmed to work for me, taking the indent level from
`yaml-indent-offset`.
---------
Co-authored-by: James Ferguson <james@faff.org>
|
|
|
|
This is a more specific formatter than `hclfmt` for nomad files.
|
|
When replacing text, calculate the cursor offset relative to the start
of the replacement, not the end of the text-to-be-added.
* test/integration/apheleia-it.el (supports-inserting-whitespace): New
test case
* apheleia-rcs.el (apheleia--apply-rcs-patch): Go to start of deletion
text before calculating offsets
|
|
|
|
Option was added in Black 21.4b0 so should be relatively widely
available.
|
|
For some reason, GNU diff on Windows (from the MinGW project) fails to
diff the file contents when passed over stdin unless the `--text`
argument is passed. This argument forces diff to treat the inputs as
text, and not binary.
To reproduce this error with Bash on Windows:
```
$ echo foo > foo
$ echo bar > bar
$ cat bar | diff.exe foo -
diff.exe: -: Invalid argument
$ cat bar | diff.exe --text foo -
1c1
< foo
---
> bar
```
It seems like this flag is harmless in this case, since Apheleia will
always be used for diffing text files, and never binary files.
|
|
RCS patches containing a 'a0' instruction are not handled properly.
This pull request fixes the handling of 'a0' instructions and adds an
integration test that fails otherwise.
Fixes #299.
|
|
When formatting Bazel files, buildifier needs to know the concrete file
type which it usually deduces from the file name which is impossible
when operating on stdin.
For example, the order of load statements in a WORKSPACE file is
significant and re-ordering might break it.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
|
|
Hi! Thanks for your work on apheleia, it's great.
An issue I've run into recently is that sometimes my remote executables
aren't immediately in-`$PATH`: I need to resolve them via
`executable-find` - which does find them - before invoking the process.
This should be safe, given that the step is performed at a prior step.
I'm overwriting the `command` variable since I infer that the executable
_name_ is being reused later when you're matching a callback, I think?
I mentioned that `executable-find` happens earlier in the call chain so
I could maybe improve this by removing that and only resolving the
executable once, but I wanted to check in with you to determine whether
the overall problem and solution even make sense to somebody else.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
Fixes #298
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
Co-authored-by: Abhishek Singh <abhisheksingh0x558@proton.me>
|
|
Helps to test #331. No reason that docker should work and podman
shouldn't.

|
|
Add support for [cljstyle](https://github.com/greglook/cljstyle)
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
Add
[gdformat](https://github.com/Scony/godot-gdscript-toolkit?tab=readme-ov-file#formatting-with-gdformat-more)
for godot gdscript files
See
- https://godotengine.org/
-
https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html
- https://github.com/Scony/godot-gdscript-toolkit
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
Adds a new formatter for prettier `prettier-json-stringify` which uses
prettier `json-stringify` parser. `json-stringify` parser is used by
prettier for formatting package.json files
|
|
See https://biomejs.dev/
Alternative formatter to `prettier`
closes https://github.com/radian-software/apheleia/issues/323
|
|
Close https://github.com/radian-software/apheleia/issues/336
|
|
|
|
https://github.com/vlang/v
---------
Co-authored-by: Raphael Nahoum <raphaelnahoum@Flrians-MBP.localdomain>
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
support gleam language
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
With the current way of passing things to aphelia, sometimes compilation
output gets added to the top of the formatted file.
This is because `mix format -` will actually still use
[`Mix.Shell.info/1`](https://hexdocs.pm/mix/1.17.3/Mix.Shell.html#c:info/1)
to output thing like:
```
==> module
Compiling 56 files (.ex)
```
However `info` messages can be silenced when setting `MIX_QUIET`. Docs:
https://hexdocs.pm/mix/1.17.3/Mix.html#module-environment-variables
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
Add support for the zig programming language using `zig fmt` for
`zig-mode` and `zig-ts-mode`.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
https://github.com/snakemake/snakefmt
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
|
|
Fixes #309
The `bean-format` tool reads a file from the filename passed on the
command line, then outputs the formatted file to `STDOUT`. The filename
passed on the command line is a requirement, the `bean-format` tool does
not read from `STDIN` at all. Another option would be to use
`("bean-format" input "-o" output)`, but this way apheleia can avoid an
extra file read that's not strictly necessary.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|
|
Closes #319 because this does the same thing but it transparently works
for all versions of mix-format.
|
|
Closes #312. The installation script was failing due to some Cabal
bullshit that I don't even want to know the reason for, probably
triggered by new package versions coming available, so I switched to
upstream binaries. Applied the suggested fix from #312 for a new
command-line option which has become required. Also set Ormolu as the
default Haskell formatter instead of Brittany because that is what the
Brittany dev recommends (see again #312).
|
|
ocp-indent allows indenting even partially compiling OCaml code, while
ocamlformat requires the code to compile correctly. Also, Doom Emacs
uses ocp-indent when ocamlformat's configuration file is not found, and
not having an ocp-indent formatter gives an error.
<!--
To expedite the pull request process, please see the contributor guide
for my projects:
<https://github.com/raxod502/contributor-guide>
-->
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
|