-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Fixup file name and line numbers when evalulating a form #329
Comments
Thanks. Looking at this a bit. I am not sure I can fix the actual case you mention with re-rerunning tests (haven't even looked at that yet, so it could be it is entirely fixable), but for regular evaluations it certainly works providing that info. Will look at it a bit more and see what I can do. |
How do you run those tests, @marcomorain ? My output does not match what you show there... |
Can you test this VSIX package out, @marcomorain ? And let me know if it makes the difference you wanted, or not. |
How do I try the package out @PEZ ? I don't see a file anywhere? |
OK, I found the file in the Releases section of GH. Thanks for working on this. The line numbers are now fixed, but not the file name. To run tests, I eval the following in the REPL: (clojure.test/test-var #'name-of-the-test) |
Sorry, missed attaching the vsix. 😄 |
@marcomorain , if you want to dig in to this some, please do. Or, if not, let me know and I'll have another go at it. |
The test runner (at least now, not sure about back when this issue was created) shows the file and line number of the failing test when using the test commands as well as when running the test directly from the repl window using We do, however, need to make them clickable (maybe this used to be possible, but with the new output window maybe we lost this). I created an issue for this, #851. |
When I eval a chunk of code using the "Calva: evaluate current top level form..." commands, the file name is auto-generated as
form-init2144587467489926643.clj
, and the line numbers start from 1 for the chunk that I have evaluated.This leads to confusing data in a stack trace. Let's say I eval a chunk of code in a file named
storage_test.clj
, and run a test that fails. The output is as follows:If instead, I evaluate the entire file, and then run the test, the output changes to:
I can click on the string
/Users/foo/bar/baz/storage_test.clj:43
in VS Code and be taken directly to that line of code. I cannot click onform-init2144587467489926643.clj:12
, which slows me down, and makes it harder to debug problems.Suggestion:
When Calva evaluates a form, it should specify the filename, column and initial line number when calling nrepl:
https://github.com/nrepl/nrepl/blob/cdd688f22e65580e9b52d9a8def9ad42a530914a/src/clojure/nrepl/middleware/interruptible_eval.clj#L157-L159
This will make everything line up much better.
The text was updated successfully, but these errors were encountered: