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

Eval plugin: output difff when there's trailing newline #4410

Open
jakio6 opened this issue Sep 28, 2024 · 2 comments
Open

Eval plugin: output difff when there's trailing newline #4410

jakio6 opened this issue Sep 28, 2024 · 2 comments
Labels
component: hls-eval-plugin Hackathon This issue is suitable for hackathon sessions type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@jakio6
Copy link

jakio6 commented Sep 28, 2024

Your environment

Which OS do you use?
Linux

Which version of GHC do you use and how did you install it?
9.8.2, ghcup

How is your project built (alternative: link to the project)?
single file

Which LSP client (editor/plugin) do you use?
neovim builtin

Which version of HLS do you use and how did you install it?
2.7.0.0, ghcup

Have you configured HLS in any way (especially: a hie.yaml file)?
no

Steps to reproduce

Evaluate twice

-- |
-- >>> import Prettyprinter
--
-- >>> pretty "foo"
--
-- >>> pretty "foo\n"
--
-- >>> pretty "foo\n\n"
--

Expected behaviour

No diff for the last two test.

Actual behaviour

First evaluate:

-- |
-- >>> import Prettyprinter
--
-- >>> pretty "foo"
-- foo
--
-- >>> pretty "foo\n"
-- foo
--
-- >>> pretty "foo\n\n"
-- foo
-- <BLANKLINE>
--

Second evaluate:

-- |
-- >>> import Prettyprinter
--
-- >>> pretty "foo"
-- foo
--
-- >>> pretty "foo\n"
-- WAS foo
-- NOW foo
--
-- >>> pretty "foo\n\n"
-- WAS foo
-- WAS <BLANKLINE>
-- NOW foo
-- <BLANKLINE>
--

Debug information

@jakio6 jakio6 added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Sep 28, 2024
@fendor fendor added component: hls-eval-plugin Hackathon This issue is suitable for hackathon sessions and removed status: needs triage labels Sep 28, 2024
@fendor
Copy link
Collaborator

fendor commented Sep 28, 2024

Hi, thank you for the bug report!

I feel like the reason why this is difficult to do correctly is that it is impossible to tell when the expected output ends... We would need a terminating character, or another identifier for multi line outputs. Or, we might want to forbid multi-line outputs altogether.

Maybe we can take inspiration from cabal-docspec and see how it behaves in this situation?

@jakio6
Copy link
Author

jakio6 commented Sep 28, 2024

Append an extra <BLANKLINE> to the last two case would be enough to pass doctest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-eval-plugin Hackathon This issue is suitable for hackathon sessions type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants