1
0
mirror of https://github.com/golang/go synced 2024-11-18 13:44:48 -07:00

internal/lsp: fail test if command cannot be applied

In the previous implementation, a test would pass if the given
command could not be applied to the given range.

Change-Id: I2e63972472cbd146cb5f27a3e27c878387222cb6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/246517
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Josh Baum 2020-08-03 15:35:09 -04:00
parent d73700863c
commit b2519014df

View File

@ -486,7 +486,7 @@ func commandToEdits(ctx context.Context, snapshot source.Snapshot, fh source.Ver
return nil, fmt.Errorf("no known command for %s", cmd)
}
if !command.Applies(ctx, snapshot, fh, rng) {
return nil, nil
return nil, fmt.Errorf("cannot apply %v", command.Name)
}
return command.SuggestedFix(ctx, snapshot, fh, rng)
}