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:
dalu 2022-05-02 05:51:27 +08:00 committed by GitHub
parent b7251e54a0
commit 50da8cd1a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 0 deletions

View file

@ -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

View file

@ -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)

View 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/

View 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;
}

View 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;
}