Skip to content
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

Tracking issue for highlighted diffs #41

Open
dtolnay opened this issue Dec 25, 2019 · 7 comments
Open

Tracking issue for highlighted diffs #41

dtolnay opened this issue Dec 25, 2019 · 7 comments

Comments

@dtolnay
Copy link
Owner

dtolnay commented Dec 25, 2019

Requires opt-in for now (cargo test --features trybuild/diff).

Currently unix-only. We will need to look into how to get highlighted background color reliably on Windows terminals, and ideally implement support for it in https://github.com/BurntSushi/termcolor.

Our diff algorithm is backed by https://github.com/dtolnay/dissimilar which is intended to produce human readable diffs with less noise than raw Myers' algorithm.

The intended output looks like:

@dtolnay dtolnay mentioned this issue Dec 25, 2019
@CreepySkeleton
Copy link

@dtolnay Would it be possible to introduce TRYBUILD_DIFF=auto/always/never environment variable? Sometimes (quite often) the diff is not shown but I need it.

@dtolnay
Copy link
Owner Author

dtolnay commented Feb 1, 2020

Can you give an example output when you need a diff but it is not shown? There are heuristics that determine when a diff is worth showing and we can adjust those.

@CreepySkeleton
Copy link

Expected

error: parse must have exactly one argument
  --> $DIR/parse_not_zero_args.rs:14:17
   |
14 |     #[structopt(parse(from_str, from_str))]

Actual

error: `parse` must have exactly one argument
  --> $DIR/parse_not_zero_args.rs:14:17
   |
14 |     #[structopt(parse(from_str, from_str))]

@dtolnay
Copy link
Owner Author

dtolnay commented Feb 2, 2020

Looks fine to me.

@CreepySkeleton
Copy link

Doesn't work in Git Bash for windows
image

trybuild 1.0.21

@dtolnay
Copy link
Owner Author

dtolnay commented Feb 2, 2020

Yep, it says at the top of the issue this is currently unix-only. Termcolor would need a highlighting implementation for windows before I would try to make it work there.

@pksunkara
Copy link

IIRC termcolor has support for windows and we used that for clap. Not sure what the issue here is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants