1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-08-01 21:17:45 +00:00

Merge pull request #51 from kamadorueda/kamadorueda

feat: key-value without max-width
This commit is contained in:
Kevin Amado 2022-02-09 20:05:04 -05:00 committed by GitHub
commit f179b2e855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 104 additions and 71 deletions

View file

@ -1,9 +1,9 @@
steps: steps:
- label: build - label: build
command: command:
- nix3 build - nix3 build
- label: cache - label: cache
if: build.branch == "main" if: build.branch == "main"
command: command:
- echo +++ - echo +++
@ -13,7 +13,7 @@ steps:
- nix3 develop --profile develop --command true - nix3 develop --profile develop --command true
- cachix push alejandra develop - cachix push alejandra develop
- label: coverage - label: coverage
if: build.branch == "main" if: build.branch == "main"
command: command:
- echo +++ - echo +++
@ -21,7 +21,7 @@ steps:
- eval "$(direnv export bash)" - eval "$(direnv export bash)"
- cargo tarpaulin --coveralls "${COVERALLS_REPO_TOKEN}" - cargo tarpaulin --coveralls "${COVERALLS_REPO_TOKEN}"
- label: diff - label: diff
if: build.branch != "main" if: build.branch != "main"
artifacts: artifacts:
- closure-before.txt - closure-before.txt
@ -59,7 +59,7 @@ steps:
- echo +++ Derivations count - echo +++ Derivations count
- grep -c drvPath= closure-after.txt - grep -c drvPath= closure-after.txt
- label: flake check - label: flake check
command: command:
- echo +++ - echo +++
- nix3 flake check - nix3 flake check

View file

@ -33,8 +33,7 @@
version = version =
let let
commit = inputs.self.shortRev or "dirty"; commit = inputs.self.shortRev or "dirty";
date = date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
in in
"${builtins.substring 0 8 date}_${commit}"; "${builtins.substring 0 8 date}_${commit}";
src = inputs.self.sourceInfo; src = inputs.self.sourceInfo;

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -24,13 +26,17 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
@ -107,10 +113,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Comment(text));
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::Pad);
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// b // b
@ -125,13 +134,17 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);

View file

@ -21,6 +21,13 @@ rec /**/ {
, ... , ...
}: { }; }: { };
a
/*b*/
=
/*c*/
1
/*d*/
;
p = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { } p = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { }
a; a;

View file

@ -101,6 +101,20 @@ rec
}: }:
{ }; { };
a
/*
b
*/
=
/*
c
*/
1
/*
d
*/
;
p = p =
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { } a; aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { } a;
} }