Eugleo / magic-racket

The best coding experience for Racket in VS Code
https://marketplace.visualstudio.com/items?itemName=evzen-wybitul.magic-racket
GNU General Public License v3.0
199 stars 29 forks source link

"enter!: not a module path or #f" when Load file in REPL #115

Closed NekoMonad closed 1 year ago

NekoMonad commented 1 year ago

Environment

Error message

code: foo.rkt

#lang scheme

(define (foo)
  (display "bar"))

terminal message:

pwsh > racket --repl --eval '(enter! (file \"c:/Users/quantumbird/workspace/racket/foo.rkt\"))'
Welcome to Racket v8.7 [cs].
enter!: not a module path or #f
  at: (file |"c:/Users/quantumbird/workspace/racket/foo.rkt"|)
  in: (enter! (file |"c:/Users/quantumbird/workspace/racket/foo.rkt"|))
  context...:
   C:\Program Files\Racket\collects\racket\enter.rkt:10:0
> 

Additional context

the REPL works normally when run racket --repl --eval '(enter! (file "c:/Users/quantumbird/workspace/racket/foo.rkt"))' in terminal

It looks like the plugin incorrectly identified my powershell version as pwsh 5, and added some reduntant slash into the command.

in src/repl.ts: function createRepl

else if (isPowershellShell() && isVersion5Powershell()) {
      fullCommand += ` --eval '(enter! (file \\"${filePath}\\"))'`;
}

and src/utils.ts

const isVersion5Powershell = (): boolean =>
  ["powershell.exe"].some((p) => vscode.env.shell.endsWith(p));
jryans commented 1 year ago

Thanks for the report!

What is the PowerShell command you are using on your system? Is it powershell or pwsh?

Assuming the answer is pwsh, then my suspicion is this the same issue that was fixed by https://github.com/Eugleo/magic-racket/pull/110, but that's not in a released version yet, so that's presumably why it's not yet working.

NekoMonad commented 1 year ago

Yes, in the vscode's REPL terminal, it is C:\Program Files\PowerShell\7\pwsh.exe sorry to bother you, thanks for your reply and waiting for the new version :)

jryans commented 1 year ago

No worries, glad to see we understand the cause. 🙂

I'm hoping to release a new version in next few days or so.