Commit graph

246 commits

Author SHA1 Message Date
dalu
c8d9ad43ba
Add denofmt (#264) 2023-11-29 19:25:11 +00:00
Ville Skyttä
56651724ad
Add support for Robot Framework files with robotidy (#263) 2023-11-28 22:50:25 +00:00
Ville Skyttä
5e894a270b
Changelog and obsoletion marker fixes (#262) 2023-11-28 20:53:53 +00:00
Mohsin Kaleem
01ca22bcd7
Add js-beautify based formatters (#229) 2023-11-26 10:49:21 +00:00
Radon Rosborough
731edd2954 Release version 4.0 2023-11-23 14:11:15 -08:00
Abdelhak Bougouffa
515ee18092
Add support for SQL using pgformatter (#247)
Add support for [`pgFormatter`](https://github.com/darold/pgFormatter)
for `sql-mode`.

<!--

To expedite the pull request process, please see the contributor guide
for my projects:

  <https://github.com/raxod502/contributor-guide>

-->
2023-11-23 14:03:37 -08:00
Anders Kaseorg
fb8842b731
Always supply --stdin-filepath to Prettier (#253)
This is required for Prettier to pick up the correct settings from its
config files.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2023-11-23 21:14:20 +00:00
Radon Rosborough
e080558495
Add note about markdown-mode (#256) 2023-11-23 12:57:12 -08:00
Ville Skyttä
7adc80a310
Spelling and grammar fixes (#248) 2023-11-23 12:57:05 -08:00
Ville Skyttä
732efe4261
Add support for xmllint (#251)
<!--

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>
2023-11-23 12:34:41 -08:00
Radon Rosborough
317fe75906
Test against Emacs 29 instead of master (#255)
<!--

To expedite the pull request process, please see the contributor guide
for my projects:

  <https://github.com/raxod502/contributor-guide>

-->
2023-11-23 12:30:41 -08:00
Radon Rosborough
d966a24115
Add missing changelog entry (#254) 2023-11-23 12:29:10 -08:00
Anders Kaseorg
14e88bfde8
Respect typescript-indent-level, typescript-ts-mode-indent-offset (#252)
https://github.com/emacs-typescript/typescript.el/blob/v0.4/typescript-mode.el#L635-L639

https://github.com/emacs-mirror/emacs/blob/emacs-29.1/lisp/progmodes/typescript-ts-mode.el#L38-L43

---------

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2023-11-23 12:28:50 -08:00
Ville Skyttä
2b354f405b
Add support for yq (#250)
<!--

To expedite the pull request process, please see the contributor guide
for my projects:

  <https://github.com/raxod502/contributor-guide>

-->
2023-11-23 12:19:04 -08:00
Sohum Banerjea
615b0f5591
Preserve marks as well as points (#198)
Marks are processed in almost exactly the same way as point; in
particular going through exactly the same `apheleia--align-point`
function. This works with minimal changes because markers act like
numbers, but also can be passed to `set-marker` to mutate their state.

---------

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-11-17 16:53:07 -08:00
Radon Rosborough
49701675a8 Add note to changelog 2023-11-17 16:18:12 -08:00
Radon Rosborough
0e9a838bdd
Apply some code review suggestions from MELPA (#246)
https://github.com/melpa/melpa/pull/8809#issuecomment-1807218549
2023-11-17 16:17:08 -08:00
Radon Rosborough
ddea9bea70
[#232] Format from elixir project dir (#239)
Make it so that if there is a `.formatter.exs` file somewhere in the
parent directories, then Apheleia will run `mix format` from there
instead of the current directory.

Close #232
2023-11-11 16:32:40 -08:00
Radon Rosborough
598ef3c7cb
Small fixes (#245)
Some things I noticed from
https://github.com/radian-software/apheleia/pull/242 but didn't want to
patch in place because CI had passed already.
2023-11-11 16:28:17 -08:00
Ed Slocomb
f884d1d611
Bump test environment to Ubuntu 22.04 (#242)
This also fixes a few test installers:

- rustfmt is available via apt-get in 22.04, use that instead of tarball
that's no longer available
- brittany now installs cleanly in the default haskell ghc/cabal in
22.04, so just use that
- perltidy in 22.04 has slightly different output
- nixfmt download url changed (now includes OS/arch). There was
initially no binary available when nixfmt was updated,
but the devs there were kind enough to provide one:
https://github.com/serokell/nixfmt/issues/139

This runs a full `make fmt-build` without errors, though it takes a
while ;). All tests pass, too.
2023-11-11 16:24:28 -08:00
Ed Slocomb
314af56e8d
move pnp-bin.js into formatters dir for simpler melpa recipe (#243)
Gets all non-elisp dependencies into a single directory,
`scripts/formatters`

<!--

To expedite the pull request process, please see the contributor guide
for my projects:

  <https://github.com/raxod502/contributor-guide>

-->
2023-11-06 18:02:09 -08:00
Ed Slocomb
54a192c345
Add support for formatters locally installed via yarn 2+ pnp mode (#200)
This adds support for formatters installed locally in project
directories via yarn 2's "zero install" [pnp
mode](https://yarnpkg.com/features/pnp).

It's quite similar to the support for formatters installed locally in a
project's `node_modules` via npm, and leverages the `npx` symbol, so
existing formatter definitions should work without modification.

This checks for a `.pnp.cjs` file (expected in the project root for yarn
pnp projects), then looks for a yarn executable, and checks the version
of yarn to make sure it supports pnp. If that works, we just push
`"yarn"` onto the front of `command`.

I've only tested this with a locally installed `prettier.js`. It's very
much a works-for-me draft, I'm putting in a PR to make sure this is a
workable approach before going any further with it.

---------

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-11-05 12:08:58 -08:00
Radon Rosborough
47547ea694
Fix byte-compilation order (#240)
This fixes one compilation issue, for another, see
https://github.com/radian-software/apheleia/pull/237#issuecomment-1793531728
2023-11-04 12:18:02 -07:00
Chris Rose
392028d823
Add support for the ruff python formatter (#236)
This adds support, but does not make it the default
Fixes: #233

---------

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-11-04 18:23:00 +00:00
Radon Rosborough
4178439d43
[#226] Add debug logs (#235)
Adds a way to properly diagnose performance issues like those reported
in https://github.com/radian-software/apheleia/issues/226.
2023-10-29 16:25:04 -07:00
Radon Rosborough
7d3b061e3e
[#226] Use lexical variable for saved buffer hash (#234)
Should help with https://github.com/radian-software/apheleia/issues/226
although there is a second problem related to performance also reported
in that thread, which would not be helped with this.

Mostly indentation changes.
2023-10-29 15:39:42 -07:00
Dhananjay Balan
5bade7a734
Use hclfmt to format hashicorp HCL files. (#231)
Add formatter `hclfmt` for Hashicorp Configuration Langauge (HCL).
2023-10-29 15:17:34 -07:00
Ed Slocomb
f4157e8c39
Use lisp-indent formatter in emacs-lisp-mode (#223)
What it says in the subject :)

Apheleia is opinionated about using a formatter, and which to use as a
default, in every other mode it supports, so it seems it should have an
opinion about emacs-lisp-mode, too?

---------

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-10-21 18:41:15 +00:00
Mohsin Kaleem
8cccf12df2
[#225] Fix incorrect replq usage (#227)
Closes #225.

<!--

To expedite the pull request process, please see the contributor guide
for my projects:

  <https://github.com/raxod502/contributor-guide>

-->
2023-10-18 20:01:51 +01:00
Mohsin Kaleem
51b8a796b6
Restructure and refactor apheleia package (#215)
CLOSES #212 

PR to restructure apheleia to make it more modular and improve some of
the separation of concerns. Before merging we should make sure that we
don't reintroduce the issues from #181.
2023-10-17 21:20:38 +01:00
Radon Rosborough
f57d21ef1f
[#208] Allow ignoring Emacs indentation settings (#211)
For
https://github.com/radian-software/apheleia/discussions/208#discussioncomment-7086819
2023-10-12 20:19:14 -07:00
Radon Rosborough
4ebc10b623
[#203] Clarify how lisp functions format (#216)
Help alleviate confusion like
https://github.com/radian-software/apheleia/issues/203.

---------

Co-authored-by: Mohsin Kaleem <mohkale@kisara.moe>
2023-10-12 20:04:59 -07:00
Radon Rosborough
791346cd3a
Fix brittany formatter & misc improvements (#222)
* Fix brittany installation, needed the `--reorder-goals` argument to be
added so that a version that was not the latest version could be
installed so that it was compatible with the base lib version shipped
with Ubuntu 20.04. We'll upgrade to 22.04 eventually (before it falls
out of LTS). Ref: https://github.com/radian-software/apheleia/pull/221
* Add a `make fmt-build-common` target which allows tagging a docker
image containing just the base software and not any formatters, to make
it easy to debug formatter installation manually.
* Update `apheleia-ft` to also run formatter tests when any files
affecting a formatter are changed, which includes the installation
script, the sample input/output, and also any scripts (e.g.
`apheleia-phpcs`) that it uses. We don't have any logic that will run
all formatter tests at once, because that is unwieldy. That can be done
manually if making a big change.
* Update to actions/checkout@v4 from v2 because the older one was listed
as deprecated.
* Print full stacktraces when `apheleia-ft` fails with an Elisp error.
2023-10-06 22:01:38 -07:00
Ed Slocomb
35f72f6fbe
use up-to-date golang (#218)
While running a full `make fmt-build`, I got some failures with
installer scripts for golang formatters. This fixes the problem by
installing an up-to-date golang instead of the version available in
ubuntu 20.04.

The ppa used here, `longsleep/golang-backports` is
[recommended](https://github.com/golang/go/wiki/Ubuntu) by the Go
project.

---------

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-10-06 21:47:52 -07:00
Ed Slocomb
afa0e54e43
Add ormolu and fourmolu, remove brittany (#221)
Found while trying to `make fmt-build` that the installer for `brittany`
was broken, and couldn't fix it.

This removes brittany, and adds the ormolu and fourmolu formatters for
haskell, and sets ormolu as the default for haskell-mode.

---------

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-10-06 21:39:38 -07:00
Radon Rosborough
970b331171 Update changelog 2023-09-30 21:40:48 -07:00
realazy
1fae320aae
Use prettier-json for js-json-mode (#209)
By default Emacs 29 uses `js-json-mode` for JSON file (correct me if I'm
wrong), this pr enables the right formatter for this mode.
2023-09-30 21:40:04 -07:00
Mohsin Kaleem
bac7277ed0
Run jq without colorization (#213)
Set the -M flag to jq:

```text
λ jq --help                                                                                  mohkale@mk-desktop ~
jq - commandline JSON processor [version 1.7]

Usage:  jq [options] <jq filter> [file...]
        jq [options] --args <jq filter> [strings...]
        jq [options] --jsonargs <jq filter> [JSON_TEXTS...]

jq is a tool for processing JSON inputs, applying the given filter to
its JSON text inputs and producing the filter's results as JSON on
standard output.

The simplest filter is ., which copies jq's input to its output
unmodified except for formatting. For more advanced filters see
the jq(1) manpage ("man jq") and/or https://jqlang.github.io/jq/.

Example:

        $ echo '{"foo": 0}' | jq .
        {
          "foo": 0
        }

Command options:
  -n, --null-input          use `null` as the single input value;
  -R, --raw-input           read each line as string instead of JSON;
  -s, --slurp               read all inputs into an array and use it as
                            the single input value;
  -c, --compact-output      compact instead of pretty-printed output;
  -r, --raw-output          output strings without escapes and quotes;
      --raw-output0         implies -r and output NUL after each output;
  -j, --join-output         implies -r and output without newline after
                            each output;
  -a, --ascii-output        output strings by only ASCII characters
                            using escape sequences;
  -S, --sort-keys           sort keys of each object on output;
  -C, --color-output        colorize JSON output;
  -M, --monochrome-output   disable colored output;
      --tab                 use tabs for indentation;
      --indent n            use n spaces for indentation (max 7 spaces);
      --unbuffered          flush output stream after each output;
      --stream              parse the input value in streaming fashion;
      --stream-errors       implies --stream and report parse error as
                            an array;
      --seq                 parse input/output as application/json-seq;
  -f, --from-file file      load filter from the file;
  -L directory              search modules from the directory;
      --arg name value      set $name to the string value;
      --argjson name value  set $name to the JSON value;
      --slurpfile name file set $name to an array of JSON values read
                            from the file;
      --rawfile name file   set $name to string contents of file;
      --args                consume remaining arguments as positional
                            string values;
      --jsonargs            consume remaining arguments as positional
                            JSON values;
  -e, --exit-status         set exit status code based on the output;
  -V, --version             show the version;
  --build-configuration     show jq's build configuration;
  -h, --help                show the help;
  --                        terminates argument processing;

Named arguments are also available as $ARGS.named[], while
positional arguments are available as $ARGS.positional[].
```
2023-09-30 16:40:18 -07:00
Mohsin Kaleem
c7e41940ca Update changelog for last commit 2023-09-30 09:37:20 +01:00
Andreas Kurth
da31e1b7f3
Remove go-mod-ts-mode from apheleia-mode-alist (#214)
go-mod-ts-mode is used with go.mod files. These cannot be formatted with
gofmt; attempting to do so will lead to an error anyway. Note that also
the goimports tool won’t work with go.mod files.

Co-authored-by: Andreas Kurth <andreas.kurth@ionos.com>
2023-09-30 09:32:06 +01:00
Radon Rosborough
e944e24584
Make apheleia-mode-alist order-independent(-ish) (#207)
Solves https://github.com/radian-software/apheleia/issues/206
2023-09-09 16:13:13 -07:00
Radon Rosborough
937fe9a940 Fix CI triggers 2023-08-26 10:18:51 -07:00
Radon Rosborough
108176abe5 Update links 2023-08-26 09:05:35 -07:00
Radon Rosborough
5b287a9426 Fix compilation order 2023-08-26 09:05:29 -07:00
Ed Slocomb
706d6bd347
Add ruby-standard formatter (#201)
There are *so many* opinionated no-config ruby formatters ;)
2023-08-11 17:25:58 -07:00
Radon Rosborough
881b5e80a8 [#199] Autoload apheleia-formatter 2023-08-11 17:25:11 -07:00
Radon Rosborough
c222927f70 Add notes on .dir-locals.el to README
Closes #190
2023-07-19 17:21:07 -07:00
Semen
f85b48e2ee
Add yapf formatter (#196)
<!--

To expedite the pull request process, please see the contributor guide
for my projects:

  <https://github.com/raxod502/contributor-guide>

-->
2023-05-27 10:55:56 -07:00
dalu
d4a5965d29
Add more tree-sitter based modes (#191) 2023-05-12 17:48:33 -07:00
Radon Rosborough
01f2f0da56 Fix safe-local-variable for apheleia-formatter 2023-05-06 15:26:17 -07:00