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

add support for pyang #282

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ The format is based on [Keep a Changelog].
clojurescript, edn files. ([#271])
* Stylua is used now in `lua-ts-mode` as well as just `lua-mode`, by
default ([#275]).
* [`treefmt`](https://numtide.github.io/treefmt) for project configured formatters ([#280]).
* [`treefmt`](https://numtide.github.io/treefmt) for project
configured formatters ([#280]).
* [`pyang`](https://github.com/mbj4668/pyang) for
[YANG](https://www.rfc-editor.org/rfc/rfc7950.html) ([#282]).

### Bugs fixed
* Apheleia sometimes failed to determine indent level from Emacs
Expand All @@ -53,6 +56,7 @@ The format is based on [Keep a Changelog].
[#274]: https://github.com/radian-software/apheleia/issues/274
[#275]: https://github.com/radian-software/apheleia/pull/275
[#279]: https://github.com/radian-software/apheleia/pull/279
[#282]: https://github.com/radian-software/apheleia/pull/282

## 4.0 (released 2023-11-23)
### Breaking changes
Expand Down
4 changes: 3 additions & 1 deletion apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"--parser=yaml"
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(purs-tidy . ("apheleia-npx" "purs-tidy" "format"))
(pyang . ("pyang" "--ignore-errors" "-f" "yang"))
(robotidy . ("robotidy" "--no-color" "-"
(apheleia-formatters-indent nil "--indent")
(apheleia-formatters-fill-column "--line-length")))
Expand Down Expand Up @@ -370,7 +371,8 @@ rather than using this system."
(typescript-ts-mode . prettier-typescript)
(web-mode . prettier)
(yaml-mode . prettier-yaml)
(yaml-ts-mode . prettier-yaml))
(yaml-ts-mode . prettier-yaml)
(yang-mode . pyang))
"Alist mapping major mode names to formatters to use in those modes.
This determines what formatter to use in buffers without a
setting for `apheleia-formatter'. The keys are major mode
Expand Down
2 changes: 2 additions & 0 deletions test/formatters/installers/pyang.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apt-get install -y python3-pip
pip install pyang
10 changes: 10 additions & 0 deletions test/formatters/samplecode/pyang/in.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module in { namespace "http://com/in/in";
prefix
in ;

list example { key "name";
leaf name {
type string;
}
}
}
11 changes: 11 additions & 0 deletions test/formatters/samplecode/pyang/out.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module in {
namespace "http://com/in/in";
prefix in;

list example {
key "name";
leaf name {
type string;
}
}
}