aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelogir <90246794+elogir@users.noreply.github.com>2024-10-18 02:35:32 +0200
committerGitHub <noreply@github.com>2024-10-18 00:35:32 +0000
commit429daf5f28859c265aaf8e0e27682785a3f506a2 (patch)
tree1b6c6b11b3886211284803ed48dc8002ec415378
parentb9cd808a91d0a1372dd86b150eaa6605de6c0ec0 (diff)
Add vfmt (#324)
https://github.com/vlang/v --------- Co-authored-by: Raphael Nahoum <raphaelnahoum@Flrians-MBP.localdomain> Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
-rw-r--r--CHANGELOG.md3
-rw-r--r--apheleia-formatters.el2
-rw-r--r--test/formatters/installers/vfmt.bash15
-rw-r--r--test/formatters/samplecode/vfmt/in.v21
-rw-r--r--test/formatters/samplecode/vfmt/out.v6
5 files changed, 47 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 38e6463..58a159e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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`
@@ -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
diff --git a/apheleia-formatters.el b/apheleia-formatters.el
index 34ee3fc..bef7aa0 100644
--- a/apheleia-formatters.el
+++ b/apheleia-formatters.el
@@ -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"
@@ -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)
diff --git a/test/formatters/installers/vfmt.bash b/test/formatters/installers/vfmt.bash
new file mode 100644
index 0000000..b0c528d
--- /dev/null
+++ b/test/formatters/installers/vfmt.bash
@@ -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
diff --git a/test/formatters/samplecode/vfmt/in.v b/test/formatters/samplecode/vfmt/in.v
new file mode 100644
index 0000000..5cb06c5
--- /dev/null
+++ b/test/formatters/samplecode/vfmt/in.v
@@ -0,0 +1,21 @@
+fn
+main() {
+ areas:= ['game',
+
+ 'web', 'tools',
+
+ 'science',
+
+
+ 'systems',
+ 'embedded', 'drivers', 'GUI', 'mobile']
+ for area in areas
+ {
+
+
+
+
+
+ println('Hello, ${area} developers!')
+ }
+}
diff --git a/test/formatters/samplecode/vfmt/out.v b/test/formatters/samplecode/vfmt/out.v
new file mode 100644
index 0000000..1cbc2c3
--- /dev/null
+++ b/test/formatters/samplecode/vfmt/out.v
@@ -0,0 +1,6 @@
+fn main() {
+ areas := ['game', 'web', 'tools', 'science', 'systems', 'embedded', 'drivers', 'GUI', 'mobile']
+ for area in areas {
+ println('Hello, ${area} developers!')
+ }
+}