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

Sometimes, "Send the whole current file to the REPL" sends only the initial lines of code after the REPL is closed. #5

Closed
vagreargnatry opened this issue Jun 26, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@vagreargnatry
Copy link

Thank you to the author for creating this fantastic software. It has helped me write Scheme code more comfortably. But I still have some questions below.

Describe the bug
The content of the file is as follows. When using Send the whole current file to the REPL the code appearing in the REPL is missing the initial lines (the number of missing lines seems to be related to the number of characters in the preceding lines).

(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)]))

(define (counter state)
  (lambda (info)
    (cond
     [(eq? info 'add1) (set! state (add1 state))]
     [(eq? info 'sub1) (set! state (sub1 state))]
     [(eq? info 'get) state]
     [(eq? info 'reset) (set! state 0)]
     [else "error"])))

To Reproduce
Steps to reproduce the behavior:

  1. Use Powershell 7.3.4 or GNU bash, version 5.2.15(1)-release (x86_64-pc-msys) or Powershell 5.1.22621.1778 as VS Code default terminal.
  2. Open the file.
  3. Use Send the whole current file to the REPL

Expected behavior
The file content can be sent to the REPL all at once, ensuring that all the code is executed correctly.

Screenshots
Powershell 7.3.4
powershell
Git Bash
git-bash
Command Prompt (cmd)
cmd

Logs

Chez Scheme REPL starting.
Registered all commands
Extension startup finished.
Sent to REPL using command chezScheme.sendSelectionToREPL
Sent to REPL using command chezScheme.sendSelectionToREPL
Sent to REPL using command chezScheme.sendSelectionToREPL

Environment (please complete the following information):

  • Version of the extension: v0.2.0
  • Version of VS Code: 1.79.2 (user setup)
  • OS: Windows 11 22H2

Additional context
When using cmd (Command Prompt) as VS Code's default terminal, there is no such issue.
This issue may not occur consistently, but it seems to be happening frequently in my case.

This issue will also make "Send selected s-expression to the REPL" unavailable.
4

@Release-Candidate
Copy link
Owner

Could it be that this is a timing issue, that the REPL took to long to start?
VS Code does not give me a way to know if the REPL in the terminal I have started has finished it's startup before sending the file, as of now I'm just waiting 1s.

Please test if the same issue appears when first starting the REPL by clicking at the Chez Scheme REPL: Start REPL button on the upper right or executing the command Chez Scheme REPL: Start REPL and only after the REPL has been started sending the whole file to the REPL.

If it is, I could make the delay between the start of the terminal and REPL and sending data to it configurable.

@Release-Candidate Release-Candidate self-assigned this Jun 26, 2023
@Release-Candidate
Copy link
Owner

A remark: exiting the REPL but leaving the REPL Window open does not work. Because VS Code does not let me know if the REPL is running or not, I can only control the existence of the terminal window named Chez Scheme REPL. If this window exists, I do not start the REPL but just send the Scheme source to the terminal.

So please always close the Chez Scheme REPL Terminal window after exiting the REPL.

@vagreargnatry
Copy link
Author

Could it be that this is a timing issue, that the REPL took to long to start? VS Code does not give me a way to know if the REPL in the terminal I have started has finished it's startup before sending the file, as of now I'm just waiting 1s.

Please test if the same issue appears when first starting the REPL by clicking at the Chez Scheme REPL: Start REPL button on the upper right or executing the command Chez Scheme REPL: Start REPL and only after the REPL has been started sending the whole file to the REPL.

If it is, I could make the delay between the start of the terminal and REPL and sending data to it configurable.

When using this method, the issue will no longer occur.

@Release-Candidate Release-Candidate added feature enhancement New feature or request and removed feature labels Jun 26, 2023
@Release-Candidate
Copy link
Owner

Great, I'll make that delay between starting the terminal and sending the code to the REPL configurable.

Release-Candidate added a commit that referenced this issue Jun 26, 2023
Add popup window on configuration changes.
See #5

Signed-off-by: Release-Candidate <[email protected]>
@Release-Candidate
Copy link
Owner

The new version 0.4.0 has this configurable delay, chezScheme.replDelay.

Please try if increasing this delay solves your problem.

@vagreargnatry
Copy link
Author

Thank you! Increasing this delay solves my problem.

@Release-Candidate
Copy link
Owner

Great to hear.

Thank you again very much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants