-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: dprint formatter #3820
feat: dprint formatter #3820
Conversation
Okay, the file matcher was designed like this:
See denoland/std#604 for the defence of this design. |
Thanks for detailed explanation @nayeemrmn - PTAL at the PR, I added basic support for list of globs and formatter uses exact glob you specified above (though it should be limited to |
Edited my above comment with exclude semantics. |
cli/formatter.rs
Outdated
for path in glob_paths { | ||
let files = glob::glob(&path) | ||
.expect("Failed to execute glob.") | ||
.filter_map(Result::ok); | ||
target_files.extend(files); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like:
for path in glob_paths {
let matches = glob::glob(&path)
.expect("Failed to execute glob.")
.filter_map(Result::ok);
for match in matches {
if is_dir(&match) {
let secondary_matches = glob::glob(&format("{}/**/*", &match))
.expect("Failed to execute glob.")
.filter_map(Result::ok);
for secondary_match in secondary_matches {
if !is_dir(&secondary_match) {
target_files.push(secondary_match);
}
}
} else {
target_files.push(match);
}
}
}
@nayeemrmn @ry there are two flags that are not present in this PR that are pretty useful: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //std/prettier
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //prettier
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //prettier
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //prettier
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //prettier
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //prettier
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //prettier
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //prettier
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //prettier
Closes #3818