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

Evaluate lens only comments the first line of multiline output #2907

Closed
konsumlamm opened this issue May 14, 2022 · 1 comment · Fixed by #2910
Closed

Evaluate lens only comments the first line of multiline output #2907

konsumlamm opened this issue May 14, 2022 · 1 comment · Fixed by #2910
Labels
component: hls-eval-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@konsumlamm
Copy link

Steps to reproduce

Code:

module Lib where

data MultiLine = MultiLine

instance Show MultiLine where
    show MultiLine = "Multi\nLine"

-- >>> MultiLine

Click Evaluate...:

multiline1

Expected behaviour

multiline3

Actual behaviour

multiline2

Versions

GHC: 9.2.2, 9.0.2, 8.10.7
HLS: 1.7.0.0

@konsumlamm konsumlamm added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels May 14, 2022
xsebek added a commit to xsebek/haskell-language-server that referenced this issue May 16, 2022
- add test for multiline show instance

See haskell#2907
xsebek added a commit to xsebek/haskell-language-server that referenced this issue May 16, 2022
xsebek added a commit to xsebek/haskell-language-server that referenced this issue May 16, 2022
@xsebek
Copy link
Contributor

xsebek commented May 16, 2022

Hi @konsumlamm and thanks for the bug report. Indeed we were not prefixing the multi-line show results. 😅

Luckily the fix is a one-liner concatMap lines and I even added a test case for this, though slightly different from yours:

data Multiline = M {l1 :: String, l2 :: String} deriving Read

instance Show Multiline where
  show m = "M {\n  l1=" <> show (l1 m) <> ",\n  l2=" <> show (l2 m) <> "\n}"

-- >>> M "first line" "second line"
-- M {
--   l1="first line",
--   l2="second line"
-- }

@mergify mergify bot closed this as completed in #2910 May 17, 2022
mergify bot pushed a commit that referenced this issue May 17, 2022
* Test multiline eval results

- add test for multiline show instance

See #2907

* Fix multiline eval padding

See #2907
sloorush pushed a commit to sloorush/haskell-language-server that referenced this issue May 21, 2022
* Test multiline eval results

- add test for multiline show instance

See haskell#2907

* Fix multiline eval padding

See haskell#2907
hololeap pushed a commit to hololeap/haskell-language-server that referenced this issue Aug 26, 2022
* Test multiline eval results

- add test for multiline show instance

See haskell#2907

* Fix multiline eval padding

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

Successfully merging a pull request may close this issue.

3 participants