How can I run Scheme on Visual Studio Code?
Solution 1
Compiling Scheme on VSCode is quite easy by now.
Install the Code Runner extension.
For setting it up:
- Open User Settings (
ctrl + ,
by default) - Search for
Code-runner: Executor Map By File Extension
. - Press "Edit in settings.json"
- Add the following:
"code-runner.executorMapByFileExtension": {
".scm": "racket"
}
- Run the code directly with
ctrl + alt + n
or from the Command Palette (ctrl + shift + p
) withRun Code
Solution 2
From looking at the github source it seems it only provide basic syntax highlighting support. Thus VSC is slightly better than Notepad, but not much.
To run you need to start one of the available scheme systems and run the file. It might be a way to do that from VSC, but it's not included in the extension.
I would have opted for DrRacket which is a IDE and an implementation of many Scheme standard languages. It can help you expand macros, debug and profile your code in the same place. Another great alternative is Emacs, but it requires a little more effort to set up. I have yet to hear about other alternatives.
Solution 3
If you just want to use VS Code because it's a good IDE (better than DRacket in terms of completion (parens, etc) and code navigation, I just discovered scheme on repl.it.
Doesn't appear that you can debug in Scheme. But it's a good start. (I'm getting the csi error as well).
Related videos on Youtube
YuanZheng Hu
Updated on June 04, 2022Comments
-
YuanZheng Hu over 1 year
I'm wondering how to run simple Scheme code on Visual Studio Code.
I've installed an extension called Scheme, but what is the next step..
I didn't find any details on the extension about how to run the code or the developer's contact ...
-
User2585 almost 4 yearsI followed your exact instructions but I'm getting the following error
'csi' is not recognized as an internal or external command, operable program or batch file.
-
oldbrazil over 3 yearsI have the same issue as @User2585 : I added:
"code-runner.executorMapByFileExtension": { ".scm": "racket", ".rkt": "racket" }, "code-runner.executorMap": { "racket": "C:\\Program iles\\Racket\\Racket.exe tete $fullFileName" }
to settings.json Trying to run the file yields:[Running] csi -script "c:\Users\olivierH\-dev-\scheme\scheme-1.rkt" 'csi' is not recognized as an internal or external command ...
-
mm2001 almost 2 yearsInstead of the above, I used the following which worked: ``` "code-runner.executorMap": { "scheme": "racket" } ```