-
-
Notifications
You must be signed in to change notification settings - Fork 389
Add diff option for eval plugin #2622
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
Conversation
3506b13
to
5aca051
Compare
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. It would be better to add a test for this feature.
I would prefer a feature fix for the plugin behaviour. Is it possible to identify and delete old
|
@pepeiborra, Actually, I am personally more inclined to remove this feature, but just not sure whether there is a user who "uses" this feature. @tittoassini may have some opinion? |
Is this because the feature is not useful, or because it gets in the way due to the current behaviour? In other words, if the feature didn't duplicate WAS lines, would you find it useful? |
For me, even if "WAS" duplication was not there, it's more like an OK behavior than good. In other words, it is at least personally not useful. It feels like leaving dynamic information obtained during development as static comments. |
There is already a mechanism to disable the diff, just use a plain comment {- rather than a doc comment {- | The reason for this difference in behaviour is that while you develop a function you expect the results of the function you are writing to change and might not bother about the diff (though removing all WAS/NOW is as simple as CTRL-Z). But as soon as the code is finished the test results should be 'frozen' or at least it should be obvious when a change in the function implementation changes the test results as the tests are now part of the function definition. A test that doesn't check its result is fairly useless. |
Unfortunately, that mechanism doesn't help me much when I use both doctest and eval (I need to remove and add
so yes, if you think it is an useful (or even important) feature of eval plugin, I think this PR is a good compromise, i.e., introducing an option to turn it off completely. |
I have nothing against in additional option but yes, I would say that is quite important that a test actually checks its output and that this should be the default behaviour. So you are running doctest in the background and at the same time you are using eval? How do the two interfere with each other? |
5aca051
to
ec969da
Compare
@@ -1,120 +1,120 @@ | |||
{-# LANGUAGE LambdaCase #-} |
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.
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.
Oh, that’s really bad. The pre-commit hook should not change semantics. This is a stylish-haskell
bug, I think.
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.
@bradrn It didn't change the semantics. It just added \r
on each line, which gives this "huge" git diff. (As my setting auto-removes \r
s)
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.
Thanks for clarifying — I had thought you meant something different by ‘completely altered’.
I’m a bit confused, though. What exactly changed the file? My unrelated PR (merged after this one was submitted) shouldn’t affect this code, unless you merge it… in which case it shouldn’t show up in this commit. Did you run the pre-commit hook by any chance?
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.
@bradrn I always rebase my PR even after its submission, so this PR is indeed after your PR. (the last was 8 hours ago: #2622 (comment))
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.
OK, makes sense, thanks!
Other than |
Ok, i also for reduce config options as much as possible but it seems it is needed here, thoughts @pepeiborra? |
For me, using git seems like a strictly better way of getting a diff. If you've added the old version to the git index, you will see a diff in your git-aware editor, if not, you don't. No extra effort or config from hls needed. |
@anka-213 TBH, I completely agree with you. |
If there is no other comments, let me merge this PR. |
Eval plugin gains new configuration options in haskell/haskell-language-server#2622 (diff) and haskell/haskell-language-server#2775 (exception).
This PR adds an option to disable the diff behaviour of the eval plugin. Current eval plugin generates output like
when "refreshed". This itself is fine, I think. However, this becomes quickly unwieldy as it recursively generates
and so on.
This PR provides an option to disable this diff entirely, so that if users (like me) want to disable it completely, they do.