From 484159663afae74114c0e022bb8bb1d4a20ec418 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele <54978337+jpthiele@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:47:13 +0100 Subject: [PATCH 1/6] Add Runic.jl as formatter for julia --- apheleia-formatters.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apheleia-formatters.el b/apheleia-formatters.el index bef7aa0..01e195c 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -177,6 +177,7 @@ "--fix" "--fix-only" "--stdin-filename" filepath "-")) + (runic . ("julia" "--project=@runic" "-e" "using Runic; exit(Runic.main(ARGS))" "--")) (snakefmt . ("snakefmt" (apheleia-formatters-fill-column "--line-length") "-")) @@ -340,6 +341,7 @@ rather than using this system." (js-ts-mode . prettier-javascript) (json-mode . prettier-json) (json-ts-mode . prettier-json) + (julia-mode . runic) (kotlin-mode . ktlint) (kotlin-ts-mode . ktlint) (latex-mode . latexindent) From c50ce9f899abc5297e90dd3fa754a3d43bf9a257 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Tue, 12 Nov 2024 13:45:43 +0100 Subject: [PATCH 2/6] Add changelog entry for Runic.jl --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58a159e..a84f0a6 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 +* [Runic.jl](https://github.com/fredrikekre/Runic.jl) for + [Julia](https://julialang.org) ([#331]) * `vfmt` for [vlang](https://vlang.io/) ([#324]). * [`typstyle`](https://github.com/Enter-tainer/typstyle) for @@ -59,6 +61,7 @@ The format is based on [Keep a Changelog]. [#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 +[#331]: https://github.com/radian-software/apheleia/pull/331 ## 4.2 (released 2024-08-03) ### Changes From e024d3be574f646e0db5277d9d0d4d971cbed8ef Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Tue, 12 Nov 2024 13:50:23 +0100 Subject: [PATCH 3/6] Add install script for Runic.jl --- test/formatters/installers/runic.bash | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test/formatters/installers/runic.bash diff --git a/test/formatters/installers/runic.bash b/test/formatters/installers/runic.bash new file mode 100644 index 0000000..bcbe2f0 --- /dev/null +++ b/test/formatters/installers/runic.bash @@ -0,0 +1,5 @@ +# install recent julia through JuliaUp +curl -fsSL https://install.julialang.org | sh -s -- --yes +ln -s /root/.juliaup/bin/julia /usr/bin/julia +# install Runic.jl in @runic shared project +julia --project=@runic -e 'using Pkg; Pkg.add("Runic")' \ No newline at end of file From ae52920f44f1fe2a11f288aae6430c135bc616fc Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Tue, 12 Nov 2024 15:55:17 +0100 Subject: [PATCH 4/6] Add samplecode for Runic.jl --- test/formatters/samplecode/runic/in.jl | 7 +++++++ test/formatters/samplecode/runic/out.jl | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 test/formatters/samplecode/runic/in.jl create mode 100644 test/formatters/samplecode/runic/out.jl diff --git a/test/formatters/samplecode/runic/in.jl b/test/formatters/samplecode/runic/in.jl new file mode 100644 index 0000000..a86af2e --- /dev/null +++ b/test/formatters/samplecode/runic/in.jl @@ -0,0 +1,7 @@ + +dist(p1,p2)=sqrt((p1[1]-p2[1])^2+(p1[2]-p2[2]^2)) + +function main(a,b) + return c = + magicalfunction(dist(a,b)) +end \ No newline at end of file diff --git a/test/formatters/samplecode/runic/out.jl b/test/formatters/samplecode/runic/out.jl new file mode 100644 index 0000000..55e9dfa --- /dev/null +++ b/test/formatters/samplecode/runic/out.jl @@ -0,0 +1,6 @@ +dist(p1, p2) = sqrt((p1[1] - p2[1])^2 + (p1[2] - p2[2]^2)) + +function main(a, b) + return c = + magicalfunction(dist(a, b)) +end From 4b0e82e393001a971c8e5630cfe33ec477965d51 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Tue, 12 Nov 2024 16:09:45 +0100 Subject: [PATCH 5/6] Fix indentation for runic --- apheleia-formatters.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apheleia-formatters.el b/apheleia-formatters.el index 01e195c..9def06b 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -177,7 +177,8 @@ "--fix" "--fix-only" "--stdin-filename" filepath "-")) - (runic . ("julia" "--project=@runic" "-e" "using Runic; exit(Runic.main(ARGS))" "--")) + (runic . ("julia" "--project=@runic" "-e" + "using Runic; exit(Runic.main(ARGS))" "--")) (snakefmt . ("snakefmt" (apheleia-formatters-fill-column "--line-length") "-")) From afcf104d99036cb3e0a87b163c717429df3d5b07 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Tue, 12 Nov 2024 16:15:54 +0100 Subject: [PATCH 6/6] chmod julia for Runic.jl --- test/formatters/installers/runic.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/test/formatters/installers/runic.bash b/test/formatters/installers/runic.bash index bcbe2f0..e56ea3e 100644 --- a/test/formatters/installers/runic.bash +++ b/test/formatters/installers/runic.bash @@ -1,5 +1,6 @@ # install recent julia through JuliaUp curl -fsSL https://install.julialang.org | sh -s -- --yes ln -s /root/.juliaup/bin/julia /usr/bin/julia +chmod +x /usr/bin/julia # install Runic.jl in @runic shared project julia --project=@runic -e 'using Pkg; Pkg.add("Runic")' \ No newline at end of file