Skip to content

Commit

Permalink
Add vfmt (#324)
Browse files Browse the repository at this point in the history
https://github.com/vlang/v

---------

Co-authored-by: Raphael Nahoum <[email protected]>
Co-authored-by: Radon Rosborough <[email protected]>
  • Loading branch information
3 people authored Oct 18, 2024
1 parent b9cd808 commit 429daf5
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The format is based on [Keep a Changelog].
[Ocaml](https://ocaml.org/) ([#306]).

### Formatters
* `vfmt` for
[vlang](https://vlang.io/) ([#324]).
* [`typstyle`](https://github.com/Enter-tainer/typstyle) for
[typst](https://typst.app/) ([#313]).
* [`rubocop`](https://github.com/rubocop/rubocop) changed to use `-a`
Expand Down Expand Up @@ -53,6 +55,7 @@ The format is based on [Keep a Changelog].
[#316]: https://github.com/radian-software/apheleia/pull/316
[#317]: https://github.com/radian-software/apheleia/issues/317
[#319]: https://github.com/radian-software/apheleia/pull/319
[#324]: https://github.com/radian-software/apheleia/pull/324
[#325]: https://github.com/radian-software/apheleia/pull/325
[#326]: https://github.com/radian-software/apheleia/pull/326
[#327]: https://github.com/radian-software/apheleia/pull/327
Expand Down
2 changes: 2 additions & 0 deletions apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
(terraform . ("terraform" "fmt" "-"))
(treefmt . ("treefmt" "--stdin" filepath))
(typstyle . ("typstyle"))
(vfmt . ("v" "fmt"))
(xmllint . ("xmllint" "--format" "-"))
(yapf . ("yapf"))
(yq-csv . ("yq" "--prettyPrint" "--no-colors"
Expand Down Expand Up @@ -375,6 +376,7 @@ rather than using this system."
(typescript-ts-mode . prettier-typescript)
(typst-mode . typstyle)
(typst-ts-mode . typstyle)
(v-mode . vfmt)
(web-mode . prettier)
(yaml-mode . prettier-yaml)
(yaml-ts-mode . prettier-yaml)
Expand Down
15 changes: 15 additions & 0 deletions test/formatters/installers/vfmt.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ver="$(latest_release vlang/v)"

apt-get install -y gcc libx11-dev

wget -nv "https://github.com/vlang/v/releases/download/${ver}/v_linux.zip" -O v.zip
unzip -q v.zip

sudo mkdir /opt/vlang
sudo cp -R v/. /opt/vlang/.
sudo /opt/vlang/v symlink

sudo v build-tools

# thx https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=vlang
sudo touch /opt/vlang/cmd/tools/.disable_autorecompilation
21 changes: 21 additions & 0 deletions test/formatters/samplecode/vfmt/in.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
fn
main() {
areas:= ['game',

'web', 'tools',

'science',


'systems',
'embedded', 'drivers', 'GUI', 'mobile']
for area in areas
{





println('Hello, ${area} developers!')
}
}
6 changes: 6 additions & 0 deletions test/formatters/samplecode/vfmt/out.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn main() {
areas := ['game', 'web', 'tools', 'science', 'systems', 'embedded', 'drivers', 'GUI', 'mobile']
for area in areas {
println('Hello, ${area} developers!')
}
}

0 comments on commit 429daf5

Please sign in to comment.