mirror of
https://github.com/vale981/apheleia
synced 2025-03-04 09:01:42 -05:00
Dart format support (#89)
* Dart format support * fix: different architexture * Update changelog * Improve installation Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
This commit is contained in:
parent
b7251e54a0
commit
50da8cd1a9
5 changed files with 74 additions and 0 deletions
|
@ -13,11 +13,15 @@ The format is based on [Keep a Changelog].
|
|||
`apheleia--run-formatter-function`.
|
||||
* Emacs 25 is no longer supported.
|
||||
|
||||
### Formatters
|
||||
* [dart-format](https://dart.dev/tools/dart-format) for Dart ([#89]).
|
||||
|
||||
### Features
|
||||
* Support remote files and buffers that were opened through TRAMP
|
||||
([#33]).
|
||||
|
||||
[#33]: https://github.com/raxod502/apheleia/issues/33
|
||||
[#89]: https://github.com/raxod502/apheleia/pull/89
|
||||
|
||||
## 2.0
|
||||
### Breaking changes
|
||||
|
|
|
@ -913,6 +913,7 @@ being run, for diagnostic purposes."
|
|||
'((black . ("black" "-"))
|
||||
(brittany . ("brittany"))
|
||||
(clang-format . ("clang-format"))
|
||||
(dart-format . ("dart" "format"))
|
||||
(fish-indent . ("fish_indent"))
|
||||
(gofmt . ("gofmt"))
|
||||
(google-java-format . ("google-java-format" "-"))
|
||||
|
@ -1028,6 +1029,7 @@ function: %s" command)))
|
|||
(c-mode . clang-format)
|
||||
(c++-mode . clang-format)
|
||||
(css-mode . prettier)
|
||||
(dart-mode . dart-format)
|
||||
(elixir-mode . mix-format)
|
||||
(fish-mode . fish-indent)
|
||||
(go-mode . gofmt)
|
||||
|
|
24
test/formatters/installers/dart-format.bash
Normal file
24
test/formatters/installers/dart-format.bash
Normal file
|
@ -0,0 +1,24 @@
|
|||
arch="$(uname -m)"
|
||||
case "${arch}" in
|
||||
"x86_64")
|
||||
arch="x64"
|
||||
;;
|
||||
"i386")
|
||||
arch="ia32"
|
||||
;;
|
||||
"aarch64")
|
||||
arch="arm64"
|
||||
;;
|
||||
*)
|
||||
echo >&2 "unsupported architecture: ${arch}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
wget "https://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-linux-${arch}-release.zip" -O dart.zip
|
||||
unzip dart.zip
|
||||
chmod a=u,go-w -R dart-sdk
|
||||
|
||||
sudo mkdir /opt/dart
|
||||
sudo cp -R dart-sdk/. /opt/dart/.
|
||||
sudo ln -s /opt/dart/bin/dart /usr/local/bin/
|
27
test/formatters/samplecode/dart-format/in.dart
Normal file
27
test/formatters/samplecode/dart-format/in.dart
Normal file
|
@ -0,0 +1,27 @@
|
|||
void main() {
|
||||
Function addNumbers = (
|
||||
a,
|
||||
b
|
||||
) => print(a + b);
|
||||
someOtherFunction("addNumbers",addNumbers);
|
||||
|
||||
var myFunc = taskToPerform();
|
||||
print(myFunc(10));
|
||||
}
|
||||
|
||||
void someOtherFunction(String
|
||||
message,
|
||||
Function myFunction)
|
||||
{
|
||||
print(message);
|
||||
myFunction(
|
||||
2,
|
||||
4
|
||||
);
|
||||
}
|
||||
|
||||
Function taskToPerform() {
|
||||
Function multiplyFour = (int number) => number*4;
|
||||
return
|
||||
multiplyFour;
|
||||
}
|
17
test/formatters/samplecode/dart-format/out.dart
Normal file
17
test/formatters/samplecode/dart-format/out.dart
Normal file
|
@ -0,0 +1,17 @@
|
|||
void main() {
|
||||
Function addNumbers = (a, b) => print(a + b);
|
||||
someOtherFunction("addNumbers", addNumbers);
|
||||
|
||||
var myFunc = taskToPerform();
|
||||
print(myFunc(10));
|
||||
}
|
||||
|
||||
void someOtherFunction(String message, Function myFunction) {
|
||||
print(message);
|
||||
myFunction(2, 4);
|
||||
}
|
||||
|
||||
Function taskToPerform() {
|
||||
Function multiplyFour = (int number) => number * 4;
|
||||
return multiplyFour;
|
||||
}
|
Loading…
Add table
Reference in a new issue