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

nrepl.middleware.print/print printer garbles lazy output into the result #903

Open
PEZ opened this issue Oct 9, 2024 · 2 comments
Open
Labels

Comments

@PEZ
Copy link

PEZ commented Oct 9, 2024

Hi!

With nrepl.middleware.print/print, evaluating:

(for [[type amount] {:wood 2 :iron 2}]
  (println "\n--------\n" (str type " " amount)))

Gives a garbled result value, and no output.

With cider.nrepl.pprint/pr, it works fine.

Expected behavior

The output as out messages, and the result as value message.

Actual behavior

The output and result come garbled in a value message.

Steps to reproduce the problem

Calva's nrepl messages log:

1727018467380 -> sent 
{
  id: '124',
  op: 'eval',
  ns: 'mini.playground',
  session: 'bd20ade5-ce08-42c1-91d4-cfd96548d22b',
  code: '(for [[type amount] {:wood 2 :iron 2}]\n' +
    '  (println "\\n--------\\n" (str type " " amount)))',
  'nrepl.middleware.print/options': { 'right-margin': 120, length: 200 },
  'nrepl.middleware.print/print': 'cider.nrepl.pprint/pprint',
  file: '/Users/pez/Projects/teasers/src/mini/playground.clj',
  line: 16,
  column: 1,
  pprint: true
}

1727018467399 <- received 19ms
{
  id: '124',
  ns: 'mini.playground',
  session: 'bd20ade5-ce08-42c1-91d4-cfd96548d22b',
  value: '\n--------\n :wood 2\n(nil\n--------\n :iron 2\n nil)'
}

1727018467399 <- received 0ms
{
  id: '124',
  session: 'bd20ade5-ce08-42c1-91d4-cfd96548d22b',
  status: [ 'done' ]
}

Environment & Version information

cider-nrepl version

I'm using whatever Calva is using, but @alexander-yakushev has reproduced it with the latest snapshot.

Java version

openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Zulu21.30+15-CA (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Zulu21.30+15-CA (build 21.0.1+12-LTS, mixed mode, sharing)

Operating system

MacOS Sonoma 14.5

@bbatsov
Copy link
Member

bbatsov commented Oct 9, 2024

@alexander-yakushev Can you take a look at this?

@alexander-yakushev
Copy link
Member

I did and couldn't find the culprit immediately. Will look again later.

@bbatsov bbatsov added the bug label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants