Message Boards Message Boards


The Wolfram Language & Engine in Visual Studio code notebooks

Posted 1 month ago
2 Replies
19 Total Likes

enter image description here

Wolfram Engine is a great tool that makes Wolfram Language available to researchers and developers. But since Wolfram Engine does not ship with a notebook interface, writing and debugging Wolfram Language code is challenging. Motivated by the idea of making Wolfram Engine easier to work with, I have recently developed a VS Code extension Wolfram Language Notebook; it offers a lightweight notebook interface to wolframscript:

To use the extension, you need to install Wolfram Engine, or Wolfram Mathematica with wolframscript (version 12.0 or higher). You are ready to go if you can run wolframscript from the command line or the shell. If you want to use remote kernel with the extension, you will instead need an ssh client on the local machine, and wolframscript on the remote machine.

Getting Started

To create a new Wolfram Language notebook, execute Create New Wolfram Language Notebook in the Command Palette, or create a new file with .wlnb extension.

Execute Manage Kernels command and choose Use wolframscript to add wolframscript to the kernel configuration and connect to it. The status of the kernel will be shown in the status bar.

Add a code cell, type Wolfram language code in the cell, and evaluate it.



Syntax Highlighting: The notebook highlights Wolfram language syntax, common built-in functions, and full character names, e.g. \[Alpha].

Auto-completion and Usages: Auto-completion for built-in functions are provided. Their usage information is displayed when typing and hovering.

Output Renderer: The notebook renders common Wolfram language expressions into HTML for better presentations. Graphics are shown as rasterized images.

Export as Wolfram notebook: The notebooks can be exported as Wolfram notebooks, containing markdown cells, code cells and their outputs.

Remote kernel: When configured, the notebook can establish an ssh connection to the remote machine and launch a kernel on it. Computations are done remotely, but code and outputs are stored locally. See the kernel configuration guide.

How it works & limitations


The interface of Wolfram Language Notebook is based on VS Code Notebook API. The extension launches wolframscript and connect to the kernel, and it will manage sending and receiving messages from the kernel. On the back-end, a wolfram kernel schedules the computations, which are done by a subkernel.

Currently, the extension has a few notable limitations. First, the notebook interface cannot send interaction made by the user back to the kernel, because the VS Code API for such messaging is yet to be finalized. Interactive interface is expected to be implemented in future versions. Second, the presentation of graphics still needs to be improved. Instead of bitmaps, vector graphics is a better form in terms of performance and interactability, but such migration will take a long period of time.

2 Replies

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

This is really cool! Currently it seems like it only support Wolfram engine. Although Wolfram products such as Mathematica, WolframDesktop has front end, it would be great if we could have support for other wolfram products using WolframKernel.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract