I am trying to use SML/NJ in Visual Studio Code editor but can't figure out how to run SML REPL in Visual Studio Code. I have installed SML extension in Visual Studio Code but no documentation is available. How to configure SML in Visual Studio Code?
Have you installed latest SML/NJ version ? Download from here https://www.smlnj.org/dist/working/index.html
Install it.
Now open VSCode, go to menu Terminal > New terminal.
In terminal type sml and confirm command. It will enter the SML/NJ REPL mode.
On linux, you can open a bash terminal with Ctrl-j and use the sml command (if you have it installed) to get an integrated REPL.
To run REPL one can set-up a task for VSCode like this:
{
"label": "SML REPL",
"type": "shell",
"command": "sml ${file}",
}
this task will run current file with REPL.
It is also possible to use problem matcher and then issues (at least with syntax) will be highlighted directly in editor.
Related
When I open my visual studio code my terminal is blank, neither ubuntu, nor command prompt, nor powershell, nor JavaScript debugger work.
I tried to change the path by which vs code calls my ubuntu but it didn't work.
Can a VSC extension add an entry in the "New Terminal" menu and pipe args into Python or some other terminal program?
There are examples available on the VSC samples repository:
https://github.com/microsoft/vscode-extension-samples/blob/main/terminal-sample/src/extension.ts
https://github.com/microsoft/vscode-extension-samples/pull/449/files
Just started to learn SICP (Structure and Interpretation of Computer Program). I installed mit-scheme compiler. I am able to run the interpreter by just typing scheme in terminal. I also have VSCode installed along with linting support for scheme.
Now I need to write, compile and launch the scheme program from VSCode.How do I do that. I dont need to debug line by line. I am new to VS code.
PS: I can write program, edit it and check for lint errors. I am unable to launch the scheme compiler out of the box. I am missing some steps in editing few jsons to get this done.
PS PS: I prefer VSCode and I want mit-scheme to interpret/ compile my program. Do not want to use racket or code runner extension. Thanks!
Main menu->Terminal->Configure tasks
Create new task:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "run scheme",
"type": "shell",
"command": "scheme",
"args": ["<", "${file}"]
}
]
}
Open file with scheme code
Main menu->Terminal->Run Task->run scheme
on mac os with chezscheme
install chezscheme
brew install chezscheme
install code runner extension of vscode
setup code runner in setting.json
"code-runner.executorMap": {
"scheme": "chez --script"
},
run scheme
create hello.ss
; Hello World
(display "Hello World")
(exit)
click run code button in top right or menu.
Most Scheme systems do not compile. They are interpreters. That is the reason why the book is called Structure and Interpretation of Computer Programs. The typical interaction with an interpreter is the REPL, the Read Eval Print Loop. The easiest way to write Scheme code is to use an editor like Emacs and execute run-scheme. After that you can send any s-expression with Ctrl-x Ctrl-e from the editor to the interpreter. Emacs shows the result in the REPL window.
What a coincidence! I'm learning SICP too.
I'm on a Mac. My way of running scheme programs in VS code is control+shift+ to open its terminal and the input scheme > foo.sch. (replace foo.sch with you file name).
And you can do this in the built-in Terminal app too, without VS Code.
I simply cannot find an answer by googling, for, what is the command line shortcut that stands for Visual Studio Code. For example to check the version, and I know I can just use its built-in terminal and type --version but what if I want to check that from outside?
It's simply code.
code --version // to check version
code // opens visual studio code
I am trying to set the https://github.com/mintty/mintty terminal installed by Cygwin as the default Visual Studio Code terminal with:
"terminal.integrated.shell.windows": "D:\\Cygwin\\bin\\mintty.exe",
But it opens the Mintty.exe terminal on a new window, instead of show it as an embedded console.
Related thread I found about it:
How to change the integrated terminal in visual studio code or VSCode
How to Integrate babun shell in VS code
Is it possible to configure Babun/ZSH for the integrated terminal on Windows?
How to integrate terminal whth babun on windows?
You should use "D:\\Cygwin\\bin\\bash.exe" instead of mintty
cheers.
There are two terminal settings, you may want set them like this:
"terminal.external.windowsExec": "D:\\cygwin64\\bin\\mintty.exe",
"terminal.integrated.shell.windows": "D:\\cygwin64\\bin\\bash.exe",