vscode-clojure-debug icon indicating copy to clipboard operation
vscode-clojure-debug copied to clipboard

Unexpected token ( in JSON at position 0. Stopping the debug adapter.

Open johnjelinek opened this issue 8 years ago • 3 comments

Environment

  • VSCode Version: 1.12.1
  • OS Version: Windows 7 Ultimate
  • Clojure Extension Version: 1.0.2

Description

If I highlight some code that is separated by a couple newlines, the repl attachment breaks with the error: Unexpected token ( in JSON at position 0. Stopping the debug adapter.

Steps to Reproduce

  1. Write some code like this:
(cubed 2)

(cubed 64)
  1. Highlight all of that code
  2. Execute the highlighted code: CTRL+ALT+E
  3. Unexpected token ( in JSON at position 0. Stopping the debug adapter.

johnjelinek avatar May 14 '17 05:05 johnjelinek

In contrast, code like this:

(cubed 2)
(cubed 64)

works fine.

johnjelinek avatar May 14 '17 05:05 johnjelinek

Hrmm .. I tried to be tricky by prefixing newlines with a ;

(defn- cubed [x]
  (* x x x))
;
(cubed 2)

but when I execute, it results in this:

continuum-demo.core=>(defn- cubed [x]
  (* x x x))
;
(cubed 2)#'continuum-demo.core/cubed

(which means only the first s-expression gets evaluated)

johnjelinek avatar May 14 '17 05:05 johnjelinek

I have not been able to reproduce the "Unexpected token" error, but I'm sure it's related to the way I am outputting the response from evaluations. I need to make that more robust; it should never break the debug adapter.

Regarding your second attempt with the commented line I can confirm this behavior. I will look into this to try to figure out why this is happening.

indiejames avatar May 14 '17 15:05 indiejames