fix(error): Don't highlight 'similar'

This commit is contained in:
Ed Page 2023-03-28 10:00:30 -05:00
parent 8f45d2f95a
commit 58615a1306
2 changed files with 9 additions and 5 deletions

View file

@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
<!-- next-header -->
## [Unreleased] - ReleaseDate
### Fixes
- Don't highlight uninteresting parts of the error message
## [4.2.0] - 2023-03-28
### Compatibility

View file

@ -427,21 +427,21 @@ fn try_help(styled: &mut StyledStr, help: Option<&str>) {
#[cfg(feature = "error-context")]
fn did_you_mean(styled: &mut StyledStr, context: &str, valid: &ContextValue) {
styled.none(TAB);
styled.good("tip:");
if let ContextValue::String(valid) = valid {
styled.none(TAB);
styled.good("tip: a similar ");
styled.none(" a similar ");
styled.none(context);
styled.none(" exists: '");
styled.good(valid);
styled.none("'");
} else if let ContextValue::Strings(valid) = valid {
styled.none(TAB);
if valid.len() == 1 {
styled.good("tip: a similar ");
styled.none(" a similar ");
styled.none(context);
styled.none(" exists: ");
} else {
styled.good("tip: some similar ");
styled.none(" some similar ");
styled.none(context);
styled.none("s exist: ");
}