Release-Candidate / vscode-scheme-repl

A Visual Studio Code extension for Chez Scheme, it uses the REPL for autocompletions and to evaluate expressions.
MIT License
13 stars 0 forks source link

Exception in read: invalid string character \U #1

Closed vagreargnatry closed 1 year ago

vagreargnatry commented 1 year ago

Describe the bug When I press Ctrl+Enter, the following error occurs:

Exception in read: invalid string character \U
Exception: variable sersomenlDesktopchez-playgroundsample1.scm is not bound
Exception: variable λ> is not bound
Exception in read: unexpected end-of-file reading string

To Reproduce Steps to reproduce the behavior:

  1. I added C:\Program Files\Chez Scheme 9.5.8\bin\ta6nt to the user environment variable PATH.
  2. Then I created a folder named "chez-playground" in C:\Users\omenl\Desktop.
  3. In this folder, I created a file named sample1.scm and put the following code in it.

    (define (fact n)
        (cond 
            [(< n 1) "error"] 
            [(= n 1) 1] 
            [else (* n (fact (sub1 n)))]))
    
    (define (fact-iter n)
        (define (iter cnt acc)
            (if (= cnt 1)
            acc
            (iter (sub1 cnt) (* cnt acc))))
    
        (cond
            [(< n 1) "error"]
            [else (iter n 1)]))
  4. Place the mouse cursor at the end of the fifth line and press Ctrl+Enter.
  5. This error occurred.

Expected behavior Eval s-expression left of the cursor.

Screenshots 1

Logs

Chez Scheme REPL starting.
Registered all commands
Extension startup finished.
Sent 
    [else (* n (fact (sub1 n)))])) to REPL using command chezScheme.evalLastSexp

Environment (please complete the following information):

Additional context After trying the aforementioned steps, I created a new folder called .vscode within the directory and added a file named .settings.json inside it. In this file, I set the value of chezScheme.schemePath to C:\\Program Files\\Chez Scheme 9.5.8\\bin\\ta6nt. But the error still occurs.

Release-Candidate commented 1 year ago

Hi and thank you very much for your bug report.

I see. What is happening here is that I'm loading the source file using something like

(load "C:\Users\omenl\Desktop")

and Chez thinks the \U is a non-existing escape sequence. I'm adding escaping of backslashes in file paths to the extension as soon as possible, I should be able to publish a new version today (until 00:00 CEST).

As a temporary workaround you can send the whole file to the interactive REPL by using a right click in the source file or the tab of the source file and selecting Chez Scheme REPL: Send the whole current file to the REPL or using the command Chez Scheme REPL: Send the whole current file to the REPL.

Release-Candidate commented 1 year ago

The new version 0.2.0 should fix this. Could you please check if the error has gone away? I do not have Windows myself and can't test it.

Download links:

VS Marketplace Open VSX Marketplace latest release at GitHub

vagreargnatry commented 1 year ago

Thank you! This error has been resolved.

Release-Candidate commented 1 year ago

Glad to hear, and thank you for your help!