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

Filenames of evaluated forms are incorrect #1425

Open
marcomorain opened this issue Dec 7, 2021 · 0 comments
Open

Filenames of evaluated forms are incorrect #1425

marcomorain opened this issue Dec 7, 2021 · 0 comments
Labels

Comments

@marcomorain
Copy link
Contributor

marcomorain commented Dec 7, 2021

I don't think this is a Calva issue per se, but I'm not sure where in the stack the problem lies, so I'll start with an issue on Calva, and we can move to cider-nrepl, nrepl or Clojure Core as appropriate.

This is a continuation of #329 from two years back.

When I evaluate code in Calva, the line number is set correctly, but the filename has never been correct. I can re-create the isue with REPLs started with deps.edn and leiningen, and when starting the REPL on the terminal or with a Jack In command.

Here is an example.

; This file is /Users/marc/dev/marcomorain/advent-2021/src/core.clj
; This is line 294, the `is` form is on line 295
(is (= 0 1)) ; <- I eval this form

The result in the REPL window is this:

clj꞉core꞉> 

FAIL in () (NO_SOURCE_FILE:295)
expected: (= 0 1)
  actual: (not (= 0 1))
false

Note that the filename is NO_SOURCE_FILE, which is a special value from the Clojure compiler, maybe here or here.

This is when the REPL is started with deps.edn. When I start the REPL with leiningen, the result is slightly different. The filename is set to something like form-init16875214884936877680.clj, while the line numbers are correct. This probably comes from here.

The REPL log shows that Calva is doing the right thing. The eval op has the :file parameter set correctly, but the result has the wrong filename.

{
  id: '13',
  op: 'eval',
  session: 'ab204e2f-5f71-46e5-87cf-528108675bcd',
  code: '(is (= 0 1))',
  'nrepl.middleware.print/options': { 'right-margin': 120, length: 50 },
  'nrepl.middleware.print/print': 'cider.nrepl.pprint/pprint',
  file: '/Users/marc/dev/marcomorain/advent-2021/src/core.clj',
  line: 295,
  column: 1,
  stdout: [Function: stdout],
  stderr: [Function: stderr],
  pprint: true
}

<- received
{
  id: '13',
  out: '\nFAIL in () (NO_SOURCE_FILE:295)\n',
  session: 'ab204e2f-5f71-46e5-87cf-528108675bcd'
}
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

2 participants