clojure-emacs / cider-nrepl

A collection of nREPL middleware to enhance Clojure editors with common functionality like definition lookup, code completion, etc.
https://docs.cider.mx/cider-nrepl
670 stars 175 forks source link

The debugger returns the wrong `coor` for atoms #865

Closed PEZ closed 2 months ago

PEZ commented 2 months ago

The debug response coordinates for the dereferenced atom contains an extra 1, throwing the client out of whack. For the repro code below the coor is returned as [3 1], where it probably should just be [3]. At least that would make Calva happy.

A minimal repro project: https://github.com/PEZ/cider-nrepl-debugger-issues, thanks @javierrweiss!

Issue reported on Calva:

Steps to reproduce the problem

In CIDER or Calva:

  1. Evaluate the top level forms here:

    (def !a (atom 0))
    
    #dbg
    (defn boom
      []
      @!a)
    
    (comment
      (boom)
      )
  2. Evaluate (boom)

Expected behavior

The debugger should stop showing the value 0 from the @!a expression.

Actual behavior

Things go BOOM. A bit different symptoms in Calva and CIDER.

Environment & Version information

cider-nrepl version

0.47.1

Java version

20

Operating system

MacOS

PEZ commented 2 months ago

It's been brought to my attention that [3 1] is indeed the right coor for the dereffed atom. This needs to be fixed in Calva instead.

bbatsov commented 2 months ago

A problem that solves itself! My favorite kind! 😄

vemv commented 2 months ago

Let us know if the documentation could be improved somewhere

Cheers - V