Giter Site home page Giter Site logo

wolfram-language-notebook's Introduction

Notebook support for Wolfram Language in VS Code

Prerequisites

Install this extension from VS Code Marketplace.

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.

getting-started

Features

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 development: When configured, the notebook can establish a tunnel or an SSH connection to the remote machine, and the computations are done remotely. Code and outputs can be stored either on the remote machine or locally.

Kernel Configuration

To add a new kernel, click ⨉ Wolfram Kernel in the status bar and choose Add a new kernel (when no kernel is currently connected). By default, the command launching the kernels is wolframscript and the port is randomly selected between 49152 and 65535. To edit or remove kernel configurations, find kernel.configurations in the extension settings page, and edit settings.json.

Remote Development

Use VS Code Remote Tunnel

With this approach, you connect to a remote machine through a secure tunnel following this guide. When configured, you can work with the files and the kernel on the remote system from a web browser. In short, you need to:

  1. Install code CLI on the remote machine.
  2. Create a tunnel with the command code tunnel, where a URL will be printed as https://vscode.dev/tunnel/.../....
  3. Open the URL in a web browser.
  4. Click ⨉ Wolfram Kernel to add or launch a kernel on the remote system.

Use VS Code Remote Development

With this approach, you use VS Code to connect to remote machines, containers, or WSL. You work with the files and the kernel on the remote system. To do this, you need to:

  1. Install Remote Development Extension Pack;
  2. Follow the guide to connect to a remote system; and
  3. Click ⨉ Wolfram Kernel to add or launch a kernel on the remote system.

Launch Remote Kernel via SSH

With this approach, you launch and connect to a remote kernel via SSH: code and files are stored locally, and the communication with the remote kernel is managed by the extension.

To add a remote kernel, choose On a remote machine, and provide the private key file for ssh authentication (skip the private key if it is already available to ssh).

To edit or remove kernel configurations, find kernel.configurations in the extension settings page, and edit settings.json. Each kernel is an entry with the kernel name as the key and the following configurations as the value:

Key Value
type "local"/"remote"
command command to launch the kernel, e.g. "wolframscript"
ports ranges of numbers, e.g. "1,3,6-9"
sshCommand the ssh command, e.g. "ssh"
sshHost user@hostname
sshPort port of ssh server (default: 22)
sshCredentialType "key"/"none"
sshCredential path to the ssh credential

Release Notes

Check Release Notes.

FAQ

The notebook failed to connect to a kernel.

  • Check that wolframscript is installed, and it can be used in the terminal.
  • Wolfram Mathematica/Engine limits the number of kernels running simultaneously. Try closing all Wolfram processes before connecting to a kernel from the notebook.
  • If the problem persists, Open an issue with the content in the Output panel (Ctrl+Shift+U / ⇧⌘U) "Wolfram Language Notebook" tab.

The output of an evaluation was not what I expected.

  • Please open an issue with the actual and expected output. Note that the extension only supports a limited number of styling options for now.
  • The brightness of the images is inverted by default in dark and high-contrast themes. Uncheck rendering.invertBrightnessInDarkThemes in the extension settings to disable this feature (outputs are updated after re-evaluations).

How can I use the notebook with Wolfram Language Server?

  • With Wolfram Language Server installed, the features, like hover and completion, are enabled in Wolfram Language cells.
  • Meanwhile, you can uncheck editor.languageFeatures in the extension settings to disable the built-in language features provided by Wolfram Language Notebook.

wolfram-language-notebook's People

Contributors

kenkangxgwe avatar njpipeorgan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

wolfram-language-notebook's Issues

Extra `$DisplayFunction` block when plotting a user defined function

Describe the bug
When plotting a defined function, there is an extra $DisplayFunction[] around the desired figure.

Expected behavior
Directly output the figure

Screenshots
image

Environment (please complete the following information):

  • Operating system: Windows 11
  • Mathematica/Engine: 13.0
  • VS Code: 1.63
  • Version: 0.0.8

Misplaced rendering of subscript and exponent

Misplaced rendering of subscript and exponent while run the following code:

n = 2;
A = Table[Subscript[a, i], {i, 0, n}]; (* coefficient vector *)
X = Table[x^i, {i, 0, n}]; (* power vector *)
Solve[A.X == 0, x] 

The output of vs code:

Screenshot 2021-12-30 下午10 07 32

The output of jupyter notebook(correct):

Screenshot 2021-12-30 下午10 08 35

Automatic connect to kernel

Is your feature request related to a problem?

Now each time when I launch a notebook, I have to manually choose the kernel, wait for it to connect, then do some calculation.

Describe the solution you'd like

It could remember the kernel, auto connect to it.

empty line is treated as input line

Description
I find the treatment of empty line and comment in wolfram-language-notebook is different from that in mathematica notebook.

I attached the example.
mma
wlnb

I guess this issue is related to \[NewLine] and wolframscript. It may not be a bug, but sometimes I find it inconvenient when I want to reuse the output via Out[n].

Environment:

  • Operating system: Windows 10
  • Mathematica/Engine: Mathematica 12.3.1/Wolfram Engine 12.3.1
  • VS Code: 1.65.2
  • Version: 0.0.9

add autocomplete when lower case.

Is your feature request related to a problem?
A clear and concise description of what the problem is.

No.

Describe the solution you'd like
A clear and concise description of what you want to happen.

In Notebook, if this is false, the user can get Sin from just typing sin

So could there be an option to turn on this behavior?

The default behavior won't change.

Additional context
Add any other context or screenshots about the feature request here.

Command 'Wolfram Language Notebook: Create New Wolfram Language Notebook' resulted in an error (command 'wolframLanguageNotebook.new Notebook' not found)

When I try to use any command from WolframLanguageNotebook I receive the following error:

Command 'Wolfram Language
Notebook: Create New Wolfram Language Notebook' resulted in an error (command
'wolframLanguageNotebook.new
Notebook' not found)

Screenshot 2023-01-03 at 22 14 01

  • Operating system: macOS Ventura 13.1
  • Mathematica/Engine: 13.2
  • VS Code: 1.74.2

Today I used this extension on my Windows 11 PC and everything was OK.

Add dynamic plot3d

Is your feature request related to a problem?
A clear and concise description of what the problem is.

Now 3d plot is static. Make them interactive.

Describe the solution you'd like
A clear and concise description of what you want to happen.

https://github.com/wuyudi/Mathematica-ThreeJS-graphics-engine/tree/enable-plot3d

Plot3D[Sin[x^2+y^2], {x,0,4},{y,0,4}] 
%//ExportString[#//N, "ExpressionJSON"]& // Export["~/test.txt", #]&

now it works well

image

Additional context
Add any other context or screenshots about the feature request here.

Some pitfalls:

Because that repo is legacy, three js's version is old, hard to add new functions.

For example:

https://stackoverflow.com/a/51591365

https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401

Failed to find the kernel wolframscript in configurations. A kernel must contain a "command" field.

On the deb version of VS code, the kernel cannot run because the "command" is not found, although it is in the .json file.

image

Version: 1.67.2
Commit: c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
Date: 2022-05-17T18:23:40.286Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Linux x64 5.13.0-44-generic

settings.json

{
    "editor.bracketPairColorization.enabled": true,
    "editor.guides.bracketPairs":"active",
    "jupyter.alwaysTrustNotebooks": true,
    "python.languageServer": "Pylance",
    "jupyter.askForKernelRestart": false,
    "explorer.confirmDelete": false,
    "files.trimTrailingWhitespace": true,
    "jupyter.interactiveWindowMode": "perFile",
    "explorer.confirmDragAndDrop": false,
    "workbench.editorAssociations": {
        "*.out": "hexEditor.hexedit",
        "*.ipynb": "jupyter-notebook"
    },
    // "jupyter.maxOutputSize": 1200,
    "diffEditor.codeLens": true,
    "C_Cpp.updateChannel": "Insiders",
    "r.rterm.linux": "/home/userme/.local/bin/radian",
    "r.bracketedPaste": true,
    "r.lsp.debug": true,
    "notebook.cellToolbarLocation": {
        "default": "right",
        "jupyter-notebook": "left"
    },
    "window.zoomLevel": -1,
    "explorer.sortOrder": "type",
    "debug.javascript.autoAttachFilter": "always",
    "wolframLanguageNotebook.kernel.configurations": {

        "wolframscript": {
            "type": "local",
            "command": "wolframscript",
            "ports": "49152-65535"
        }
    }
}

Command wolframscript cannot be launch

Describe the bug
wolframscript doesn't start in vscode, even the terminal that vscode opens, but wolframscript is installed and works in all other terminals (like cmd, pws, etc.) that I run manually directly.

Expected behavior
The wolframscript work on my vscode.

Environment (please complete the following information):

  • Operating system: win 11
  • Mathematica/Engine: 13.2
  • VS Code: 1.74.3
  • Version: 0.1.0

Additional context
[Thu, 09 Feb 2023 19:30:08 GMT] kernelIsRemote = false, kernelPort = 63013
[Thu, 09 Feb 2023 19:30:08 GMT] kernelInitPath = c:\Users\user.vscode\extensions\njpipeorgan.wolfram-language-notebook-0.1.0\resources\init-compressed.txt
[Thu, 09 Feb 2023 19:30:08 GMT] kernelRenderInitPath = c:\Users\user.vscode\extensions\njpipeorgan.wolfram-language-notebook-0.1.0\resources\render-html.wl
[Thu, 09 Feb 2023 19:30:08 GMT] launchCommand = wolframscript
[Thu, 09 Feb 2023 19:30:08 GMT] launchArguments = -code,ToExpression["zmqPort=63013;"<>Uncompress["1:eJy9PA1X27iy96e4gsMBrkJJ+7bvHSB54fOWu0ApSXfvWdcLJhHEi2OnttNCQ/afvf/2ZvRhS7IdUtpddimJJY1Go9F8yy+u44vu/7n/+MfqurO1de737/xbtrXlrK993Gy+wl/e0GX9LIijvGF1/
[Thu, 09 Feb 2023 19:30:08 GMT] Error occured in spwaning the kernel process:
Error: spawn wolframscript ENOENT

The animation has not been supported

Is your feature request related to a problem?
Yes,when I use Animated function like Animate[Show[ Graphics[Disk[{x, 5/(1 + E^-x)}, 0.2], PlotRange -> {{- 6, 6}, {-0.4, 5.4}}], Plot[5/(1 + E^-x), {x, -6, 6}, PlotRange -> {{-6, 6}, {-0.4, 5.4}}]], {x, -5.8, 5.8, 0.1}, AnimationRunning -> False],it does show a graph with buttons and a scroll bar,but actually they are inoperable.

Describe the solution you'd like
They should be operable

Enable rendering a pdf (for instance with pandoc)

Hi !

I am really impressed by this really nice piece of software. It does much better than the jupyter notebook on my computer running Linux.

A real issue though is that I cannot share my notebook. It would be really nice to add pdf printing capabilities. I tried several extensions to print the notebook with no success until now.

Thank you very much for your work !

notebook cell output showing wrong colors

First, let me thank you for this great extension. I have been looking for something like this for quite some time. And now to the problem :) ...

Describe the bug
Colors seem to be presented wrong. Let's say I want to do a simple Plot and have a Red Background using
Plot[Sin[x], {x, 1, 2*Pi}, Background->Red] I get the image shown below. The image clearly does not show a pure red background. Same goes for different colors and different Graphics creations like Graphics[{Red, Disk[{0,0}]}], which leads to the same wrong color output. It seems that there is some color adjustment done by default, which leads to wrong color output.

Expected behavior
The colors should display according to code input.

Screenshots
image

Environment

  • Operating system: MacOS 11.6.4
  • Mathematica/Engine: 13.0
  • VS Code: 1.65.2
  • Version: 0.0.9

Unable to create notebook under Linux

I tried to create a new Wolfram Language notebook using the command provided by the extension. However, I encountered the following error. I am running Fedora Linux, if that matters.

image

Association is not correctly rendered

Describe the bug
Association is not correctly rendered

Expected behavior
expect <|x->3, y->4|>

Screenshots
image

Environment (please complete the following information):

  • Operating system: Windows 10
  • Mathematica/Engine: Wolfram Engine 12.3.1
  • VS Code: 1.63.2
  • Version: v0.0.8

Is there debug mode or something, help to profile?

Is your feature request related to a problem?
A clear and concise description of what the problem is.

https://mathematica.stackexchange.com/questions/7768

Recently, I want to profile a code. So I found this, but it needs a Debugger, and just run

f[x_] := x^2

Table[f[x], {100000}]; // RuntimeTools`Profile

Not work.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Any method to use it? Or impossible to use?

Additional context
Add any other context or screenshots about the feature request here.

重启内核失败

[Thu, 02 Dec 2021 03:27:49 GMT] kernelIsRemote = false, kernelPort = 65434
[Thu, 02 Dec 2021 03:27:49 GMT] launchCommand = wolframscript
[Thu, 02 Dec 2021 03:27:49 GMT] launchArguments = -code,ToExpression["zmqPort=65434;"<>Uncompress["1:eJzFXP9T20iyv//i/aoMFM9QsmOS2rv3APlMCHnhli8BO5eqVXQgrAnWIUteSQ54jfO3X/d8kWZGkvElu/eoSrA1Mz093T3dn+4Z8eI2uRr8189/+lNrx9rb++CP7v07urdn7Wx/7u6+wn+sYUBHe
[Thu, 02 Dec 2021 03:27:50 GMT] Received the following data from kernel (stderr):
[Thu, 02 Dec 2021 03:27:50 GMT]
Your Wolfram Engine installation is not activated or is experiencing a license-related problem.

Please run wolframscript with the -activate option, and then try
your original wolframscript command again.

[Thu, 02 Dec 2021 03:27:50 GMT] Killing kernel process, pid = 1014
[Thu, 02 Dec 2021 03:27:50 GMT] Process exited with code 255 and signal null.

用内置命令重启内核后会直接失败并且出现授权问题,直接在命令行输入wolframscript会出现免费的liscense只能两个设备使用的问题,从而激活不了

The Wolfram Engine could not be activated using your Wolfram ID.

This may have occurred because WolframScript has already activated a different
installation of the Wolfram Engine using your account's limited
free activation keys. Only two keys are generated
when you create a free Wolfram Engine license using
https://www.wolfram.com/engine/free-license/.

For additional Wolfram Engine keys, contact Wolfram Research at
https://www.wolfram.com/contact-us/.

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

Live Print Output

Thank you for this plugin!

Is your feature request related to a problem?

The output only appears at the end of the evaluation.
However, often if one encounters problems, the cell will never fully evaluate.
Stopping the cell leads to no output at all.
This makes debugging really hard.

Describe the solution you'd like

Live print output like in Mathematica notebooks.
If possible also PrintTemporary output.

Additional context

Example code:

Do[
    Print[i]; Pause[1]
    , {i, 1, 5}
]

报错

无法使用类型为“wolfram-language-notebook”的笔记本编辑器打开资源,请检查是否已安装或启用了正确的扩展。

终端中出现如下错误

[2021-11-30 21:10:31.916] [renderer1] [info] Starting extension host with pid 42715.
[2021-11-30 21:10:31.917] [renderer1] [info] [LocalProcessExtensionHost]: IExtensionHostStarter.start() took 12 ms.
[2021-11-30 21:10:32.089] [renderer1] [error] [Extension Host] (node:42715) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code Helper (Renderer) --trace-deprecation ...` to show where the warning was created)

I cannot export my notebook as PDF.

Describe the bug
I can not export my notebook as PDF. It tells me "Failed to export the notebook."

5jfgfd

Environment (please complete the following information):

  • Operating system: Win10 21H2
  • Mathematica/Engine: 12.3.1 for Microsoft Windows (64-bit) (June 24, 2021)
  • VS Code: 1.62.0
  • Version: 0.0.8

Show multiple lines of definition at one time.

Is your feature request related to a problem?
A clear and concise description of what the problem is.

the definition can't be shown at one glance.

image

Describe the solution you'd like
A clear and concise description of what you want to happen.

This may be better?

image

Additional context
Add any other context or screenshots about the feature request here.

License issue with free Wolfram Engine and kernel limits

Activated license expired

I installed the free Wolfram Engine in Windows Subsystem of Linux, Ubuntu 20.04.3 LTS and tried using it with this extension in VSCode. However, each time after using it for a while, wolframscript prompts that the license is no long valid.

The Problem might be the kernel limit.

When I'm using wolfram-language-notebook, command

pgrep wolfram

returns 2 pid.

When I'm using wolframscript in command-line, command

pgrep wolfram

returns 1 pid.

Environment

  • Operating system: Windows11 Pro 21H2
  • Mathematica/Engine: 13.0.1
  • VS Code: 1.65.2
  • Version: 0.0.9

ClassifierFunction output is huge

Describe the bug

run

trainingset = {1 -> "A", 2 -> "A", 3.5 -> "B", 4 -> "B"};
c = Classify[trainingset]

Expected behavior

A less noisy output

Screenshots

image

Environment (please complete the following information):

  • Operating system: Archlinux
  • Mathematica/Engine: 13.2
  • VS Code: 1.75.1
  • Version: 0.1.1

Can not start kernel (even after restarting) .

I have not been able to start the kernel even after restarting the computer. I received this popup error:

The kernel has stopped due to the following error:
The first packet is not a InputNamePacket;
packet=Message[acket[SetOptions, optnf]

Screenshots
[Fri, 07 Oct 2022 09:00:50 GMT] kernelIsRemote = false, kernelPort = 52714
[Fri, 07 Oct 2022 09:00:50 GMT] kernelInitPath = /home/name/.vscode/extensions/njpipeorgan.wolfram-language-notebook-0.1.0/resources/init-compressed.txt
[Fri, 07 Oct 2022 09:00:50 GMT] kernelRenderInitPath = /home/name/.vscode/extensions/njpipeorgan.wolfram-language-notebook-0.1.0/resources/render-html.wl
[Fri, 07 Oct 2022 09:00:50 GMT] launchCommand = wolframscript
[Fri, 07 Oct 2022 09:00:50 GMT] launchArguments = -code,ToExpression["zmqPort=52714;"<>Uncompress["1:eJy9PA1X27iy96e4gsMBrkJJ+7bvHSB54fOWu0ApSXfvWdcLJhHEi2OnttNCQ/afvf/2ZvRhS7IdUtpddimJJY1Go9F8yy+u44vu/7n/+MfqurO1de737/xbtrXlrK993Gy+wl/e0GX9LIijvGF1/
[Fri, 07 Oct 2022 09:00:51 GMT] Received the following data from kernel:
[Fri, 07 Oct 2022 09:00:51 GMT]
[Fri, 07 Oct 2022 09:00:52 GMT] Received the following data from kernel:
[Fri, 07 Oct 2022 09:00:52 GMT] $CommandLine={/usr/local/Wolfram/Mathematica/13.1/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel, -runfirst, Unprotect[$EvaluationEnvironment];$EvaluationEnvironment="Script";Protect[$EvaluationEnvironment
[Fri, 07 Oct 2022 09:00:52 GMT] Received the following data from kernel:
[Fri, 07 Oct 2022 09:00:52 GMT] $ScriptCommandLine={wolframscript, -code, ToExpression["zmqPort=52714;"<>Uncompress["1:eJy9PA1X27iy96e4gsMBrkJJ+7bvHSB54fOWu0ApSXfvWdcLJhHEi2OnttNCQ/afvf/2ZvRhS7IdUtpddimJJY1Go9F8yy+u44vu/7n/+MfqurO1de737/xbtrXlrK993Gy+
[Fri, 07 Oct 2022 09:00:52 GMT] Received the following data from kernel:
[Fri, 07 Oct 2022 09:00:52 GMT] Using the following command to launch the subkernel process:
[Fri, 07 Oct 2022 09:00:52 GMT] Received the following data from kernel:
[Fri, 07 Oct 2022 09:00:52 GMT] /usr/local/Wolfram/Mathematica/13.1/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel -noicon -wstp -linkprotocol SharedMemory -linkmode connect -linkname doktjhhm6y8t1a5z
[Fri, 07 Oct 2022 09:00:53 GMT] Killing kernel process, pid = 3662
[Fri, 07 Oct 2022 09:00:53 GMT] Process exited with code 0 and signal null.

Environment:

  • Operating system: Linux
  • Mathematica/Engine: 13.1
  • VS Code Version: 1.71.2

**Can't open new Wolfram Notebooks**

Describe the bug
After an apparently successful installation, opening new Wolfram Notebooks fails with an error "command wolframLanguageNotebook.newNotebook not found" (screenshot attached). The same happens with the Manage Kernel command.

Expected behavior
A new notebook should open.

Screenshots
image

Environment (please complete the following information):

  • Operating system: Ubuntu 20.04.4 LTS
  • Mathematica/Engine: 13.0.0
  • VS Code: 1.64.2
  • Version: 0.0.9

Additional context
I've checked that the wolframscript command does work as expected from the CLI, and that there are no running Wolfram processes when trying to open a notebook.
I was able to make the extension work on another machine (which, however, runs Windows).

`require('mathjax')` in extensions causes error when 'wolfram-language-notebook' is installed

最近在自己写扩展,发现只要有 require('mathjax') ,就会崩,要么报错 Cannot set property Package of #<Object> which has only a getter. ,要么 .wlnb 打不开。

复现过程:(wolfram-language-notebook 已经装好)

  1. 使用 yo code 或者 npx yo code 新建一个 javascript 扩展

  2. 在扩展文件夹下 npm install mathjax@3

  3. extension.js 中,hello world 的函数下加上 require('mathjax') ,如图。已经删除各种注释了,这里是最小的示范,只require ,不做其他任何事情。
    image

  4. F5 运行插件,新建/打开一个.wlnb 文件,ctrl+shift+p 执行命令hello world ,然后立即报错:
    image

  5. 如果没有开 .wlnb 文件,那么是正常的,可以执行命令:
    image

  6. 但是此时打不开 .wlnb 文件:
    image

很好奇这个问题。因为上述测试,在 jupyter notebook 下是可以跑通的。

这个问题涉及最近写的扩展 Ultra Math Preview.

Environment (please complete the following information):

  • Operating system:win10
  • VS Code: 1.64.0
  • Version: 0.0.9

感谢!


一开始不小心按回车发出去了,已修改。

"Could not initialize webview" error

I followed the steps on the VSCode homepage for the plugin. When I try to use the Create New Wolfram Language Notebook command, I get the following error:

image

  • Operating system: Win 10
  • Mathematica/Engine: [13.3.1] (Wolfram Language 13.3.1 Engine for Microsoft Windows (64-bit))
  • VS Code:
    image
  • Version: 0.1.1

Copy latex equation

If I write something like this:

sol: Integrate[1/(1+x^3),x]
TeXForm(sol)

the math expression is correctly rendered. It would be nice to be able to right-click on it and copy the latex plain text.

How do I enable the Wolfram Language extension in VS Code?

When I check the runtime status of the newly installed Wolfram Language extension (1.7.0) it says "Not yet activated".

None of the commands associated with this extension appear in the pallette.

How do I activate the Wolfram Language extension.

`wl` script support.

I'm very glad to know this wonderful vscode plugin here, but I've the following question:

Can this plugin support writing wl script, i.e., the file with .wl extension, directly in vscode? I've noticed that the official vscode-wolfram plugin has this feature.

Regards,
HZ

About importing .nb in VS Code

Hello,
First of all thank you for your amazing work! This has recently turned into one of the main ingredient of my workflow. I can also see this becoming essential for students or amateurs, as no expensive mathematica license is required.

I was wondering if there was some some progress on this old issue of opening .nb directly in VS Code?

I often need to exchange notebooks with my collaborators, which led me to develop my own conversion script, available on my github. It is not very powerful, but sufficient for most of my cases (it only works as long as the formatting in the notebook is not too crazy).

The easiest way I discovered was to first convert the notebook to a .m file, which can be done either manually from the notebook itself, or using a rather ugly wolfram script. After that I just parse it in python.

I know absolutely nothing about VS Code extensions, do you think this could be included in some form?

Graph and Dataset objects are not rasterized and the default image size for Graphics is large

Hi,

Thank you for your work as it allows a rather nice notebook environment (especially with github copilot).

Describe the bug

"Graph and Dataset objects are returned in input form and the default image size for Graphics is quite big"

Expected behavior

"Graph and Dataset objects should return an image and the default image size for Graphics should maybe be smaller"

Environment (please complete the following information):

  • Operating system: Linux Fedora
  • Mathematica/Engine: 13.2
  • VS Code: 1.74.3
  • Version: latest

Unable to display an image

As the title suggests
Everything is okay include display an equation, solve a differential equation.
THE IMAGE JUST DONT SHOWN UP, even if there's no an error report

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image

Environment (please complete the following information):
Here is my configuration settings
image

add partly local manual support

Is your feature request related to a problem?

Currently, it will only go to the online manual, which is slow. If local has manual, prefer local will be much faster.

Describe the solution you'd like

Suppose the help docs are under the ~/path/to/docs/, if we want to find something like Function

for *nix user.

find ~/path/to/docs/ -name Function.nb -exec wolframplayer {} +

the wolframplayer is distributed with the free Wolfram engine.

will do the trick. But I am not sure it could execute in vscode.

the variable pathToDocs could be set in the setting.

Additional context
Add any other context or screenshots about the feature request here.

command not found

all Wolfram Language Noteboot command not found

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
2023-10-16 15-32-12 的屏幕截图
2023-10-16 15-28-33 的屏幕截图

Environment (please complete the following information):

  • Operating system: [Ubuntu 20.04 AMD64]
  • Mathematica/Engine: [WolframScript 1.10.0 for Linux x86 (64-bit)]
  • VS Code: [1.83.1]
  • Version: [0.1.1]

Additional context
Add any other context about the problem here.

[Bug] Wrong render

Describe the bug
Some characters are rendered incorrectly

Expected behavior
The natural constant, as the base of the exponent, should be shown as e. And c1.

Screenshots
image

Environment (please complete the following information):

  • Operating system: WSL 2 in Windows 10
  • Mathematica/Engine: 13.1.0
  • VS Code: 1.72.0
  • Version: 0.1.0

Adjustable column spacing

Is your feature request related to a problem?

The third option for Column does not seem to work. I suppose this is because TeXForm does not take that option into account. I use Column to read long or dense lists.

Describe the solution you'd like
This code roughly mimics the third spacing option and modifies the TeXForm as well by mapping elements to column with "" entries :

(
column[a_,b_:Automatic,c_:0]/; IntegerQ[c] && c>=0 :=
 If[c==0,
	Column[a,b,c],
    Column[a//Map[Column@Prepend[ConstantArray["",c],#]&]
          ,
           b
          ]
 ]
)

The issue is that the third option of Column can also handle non integer values for the third argument. I suppose one might first omit the third option then modify the TexForm output using string manipulations to adjust the spacing. I can look into that if needed.

Question :

Is it possible to add something similar to the output renderer ?

The universal build VSCode cannot launch the extension

[2021-12-01 01:01:53.024] [exthost] [error] Activating extension njpipeorgan.wolfram-language-notebook failed due to an error:
[2021-12-01 01:01:53.024] [exthost] [error] Error: No native build was found for platform=darwin arch=arm64 runtime=electron abi=89 uv=1 armv=8 libc=glibc node=14.16.0 electron=13.5.2
loaded from: /Users/xiajunwen/.vscode/extensions/njpipeorgan.wolfram-language-notebook-0.0.2/node_modules/zeromq

I think this could be an issue from VSCode itself, cause the intel build is OK. Maybe this error should be posted to VSCode team as well.

LinkObject::linkd: Unable to communicate with closed link

I've installed version 0.0.10 in VSCode 1.68, and I am using Wolfram Engine 13.0.1 on Windows 10. Attempting to connect to a kernel, using the default wolframscript configuration, fails with the following log output:

[Sun, 12 Jun 2022 16:19:28 GMT] kernelIsRemote = false, kernelPort = 59322
[Sun, 12 Jun 2022 16:19:28 GMT] kernelInitPath = c:\Users\dylan\.vscode\extensions\njpipeorgan.wolfram-language-notebook-0.0.10\resources\init-compressed.txt
[Sun, 12 Jun 2022 16:19:28 GMT] kernelRenderInitPath = c:\Users\dylan\.vscode\extensions\njpipeorgan.wolfram-language-notebook-0.0.10\resources\render-html.wl
[Sun, 12 Jun 2022 16:19:28 GMT] launchCommand = wolframscript
[Sun, 12 Jun 2022 16:19:28 GMT] launchArguments = -code,ToExpression["zmqPort=59322;"<>Uncompress["1:eJy9PA1X27iy96e4gsMBrkJJ+7bvHSB54fOWu0ApSXfvWdcLJhHEi2OnttNCQ/afvf/2ZvRhS7IdUtpddimJJY1Go9F8yy+u44vu/7n/+MfqurO1de737/xbtrXlrK993Gy+wl/e0GX9LIijvGF1/
[Sun, 12 Jun 2022 16:19:30 GMT] Received the following data from kernel:
[Sun, 12 Jun 2022 16:19:30 GMT] <INITIALIZATION STARTS>
[Sun, 12 Jun 2022 16:19:33 GMT] Received the following data from kernel:
[Sun, 12 Jun 2022 16:19:33 GMT] $CommandLine={C:/Program Files/Wolfram Research/Wolfram Engine/13.0/wolfram.exe, -runfirst, Unprotect[$EvaluationEnvironment];$EvaluationEnvironment="Script";Protect[$EvaluationEnvironment];, -linkmode, Connect, -
[Sun, 12 Jun 2022 16:19:33 GMT] Received the following data from kernel:
[Sun, 12 Jun 2022 16:19:33 GMT] $ScriptCommandLine={wolframscript, -code, ToExpression["zmqPort=59322;"<>Uncompress["1:eJy9PA1X27iy96e4gsMBrkJJ+7bvHSB54fOWu0ApSXfvWdcLJhHEi2OnttNCQ/afvf/2ZvRhS7IdUtpddimJJY1Go9F8yy+u44vu/7n/+MfqurO1de737/xbtrXlrK993Gy+
[Sun, 12 Jun 2022 16:19:33 GMT] Received the following data from kernel:
[Sun, 12 Jun 2022 16:19:33 GMT] Using the following command to launch the subkernel process:
[Sun, 12 Jun 2022 16:19:33 GMT] Received the following data from kernel:
[Sun, 12 Jun 2022 16:19:33 GMT] C:/Program Files/Wolfram Research/Wolfram Engine/13.0/wolfram.exe -noicon -wstp -linkprotocol SharedMemory -linkmode connect -linkname qnuuu1jsqc0r55ie
[Sun, 12 Jun 2022 16:19:35 GMT] Received the following data from kernel:
[Sun, 12 Jun 2022 16:19:35 GMT] 
LinkObject::linkd: Unable to communicate with closed link LinkObject[qnuuu1jsqc0r55ie, 192, 2].

[Sun, 12 Jun 2022 16:19:35 GMT] Killing kernel process, pid = 27420
[Sun, 12 Jun 2022 16:19:35 GMT] Process exited with code 0 and signal null.

Note that I have put C:\Program Files\Wolfram Research\Wolfram Engine\13.0 and C:\Program Files\Wolfram Research\WolframScript on PATH.

LinksCreate[CreateUUID[]] does not work under macOS

Thank you for the great extension! It looks very promising.

Starting kernel fails with message

The kernel has stopped due to the following error: Failed to create main and preemptive links; $kernel=$Failed

The probable reason for this is that link cannot be created with LinkCreate[CreateUUID[]] under macOS. When I try this in Mathematica notebook I get image

although this works under Linux.

(see init.wl lines 96/97)

Changing these lines to

$kernel=LinkCreate[];
$preemptive=LinkCreate[];

(and recompressing init-compressed.txt) fixes the issue for me (kernel takes care that names are unique)

  • Operating system: macOS Monterey 12.1
  • Mathematica/Engine: 13.0
  • VS Code: 1.64.0
  • Version: 0.0.8

Cannot connect to kernel, stuck when wolframkernel window shows

Describe the bug
Can't connect to kernel using this extension, but it's ok with cmd, I am using mma13.0.
When tap manage kernel and choose wolframscript, wolfram kernel will show up and everything stuck in this step, and then time out.

Expected behavior
vscode should connect to the kernel

Screenshots
image

Environment (please complete the following information):

  • Operating system: Windows 10
  • Mathematica/Engine: 13.0
  • VS Code: 1.62.0
  • Version: 0.0.1

Error:command "wolframLanguageNotebook.newNotebook" not found

I have successfully downloaded the extension, but it seems not activated. When I try to create a new notebook, I encountered the error --- command "wolframLanguageNotebook.newNotebook" not found.

Screen Shot 2023-08-21 at 9 35 43 AM

Environment (please complete the following information):

  • Operating system: macOS Monterey Version 12.6
  • Mathematica/Engine: Mathematica 13.3.0.0
  • VS Code: 1.81.1

Additional context
I have tried this extension on a windows pc, and it works perfectly.

import standard Mathematica notebook

This is indeed brilliant work!

Just curious about if there's any plan to add the feature for importing the standard Mathematica notebook (i.e. .nb files) into the vs code environment.
I think that would be a big step to enhance WL adoption.

Not able to launch the kernel

Describe the bug
Can't connect to the kernel:
Error message: "The kernel has stopped due to the following error: The first packet is not a InputNamePacket; packet=$Failed

Expected behavior
No error message.

Screenshots
vscode error
image

Environment (please complete the following information):

  • Operating system: Windows 11
  • Mathematica/Engine: 13.1
  • VS Code: 1.79.2
  • Version:

Additional context
I was able to run the kernel right after installation, but after then I was not able to re-launch it.

Wolfram Kernel does not start

Here is the output log

[Sun, 31 Jul 2022 08:07:53 GMT] kernelIsRemote = false, kernelPort = 53736
[Sun, 31 Jul 2022 08:07:53 GMT] kernelInitPath = c:\Users\Adithya.vscode\extensions\njpipeorgan.wolfram-language-notebook-0.1.0\resources\init-compressed.txt
[Sun, 31 Jul 2022 08:07:53 GMT] kernelRenderInitPath = c:\Users\Adithya.vscode\extensions\njpipeorgan.wolfram-language-notebook-0.1.0\resources\render-html.wl
[Sun, 31 Jul 2022 08:07:53 GMT] launchCommand = E:\wolframlanguage\wolframscript
[Sun, 31 Jul 2022 08:07:53 GMT] launchArguments = -code,ToExpression["zmqPort=53736;"<>Uncompress["1:eJy9PA1X27iy96e4gsMBrkJJ+7bvHSB54fOWu0ApSXfvWdcLJhHEi2OnttNCQ/afvf/2ZvRhS7IdUtpddimJJY1Go9F8yy+u44vu/7n/+MfqurO1de737/xbtrXlrK993Gy+wl/e0GX9LIijvGF1/
[Sun, 31 Jul 2022 08:08:04 GMT] Received the following data from kernel:
[Sun, 31 Jul 2022 08:08:04 GMT]
[Sun, 31 Jul 2022 08:08:16 GMT] Received the following data from kernel:
[Sun, 31 Jul 2022 08:08:16 GMT] $CommandLine={E:/wolframlanguage/wolfram.exe, -runfirst, Unprotect[$EvaluationEnvironment];$EvaluationEnvironment="Script";Protect[$EvaluationEnvironment];, -linkmode, Connect, -linkname, tn3hm_shm, -mathlink}
[Sun, 31 Jul 2022 08:08:16 GMT] Received the following data from kernel:
[Sun, 31 Jul 2022 08:08:16 GMT] $ScriptCommandLine={E:\wolframlanguage\wolframscript, -code, ToExpression["zmqPort=53736;"<>Uncompress["1:eJy9PA1X27iy96e4gsMBrkJJ+7bvHSB54fOWu0ApSXfvWdcLJhHEi2OnttNCQ/afvf/2ZvRhS7IdUtpddimJJY1Go9F8yy+u44vu/7n/+MfqurO1d
[Sun, 31 Jul 2022 08:08:16 GMT] Received the following data from kernel:
[Sun, 31 Jul 2022 08:08:16 GMT] Using the following command to launch the subkernel process:
[Sun, 31 Jul 2022 08:08:16 GMT] Received the following data from kernel:
[Sun, 31 Jul 2022 08:08:16 GMT] E:/wolframlanguage/wolfram.exe -noicon -wstp -linkprotocol SharedMemory -linkmode connect -linkname 2qgui889vypbyjt9
[Sun, 31 Jul 2022 08:08:35 GMT] Received the following data from kernel:
[Sun, 31 Jul 2022 08:08:35 GMT]
LinkObject::linkd: Unable to communicate with closed link LinkObject[2qgui889vypbyjt9, 197, 2].

[Sun, 31 Jul 2022 08:08:35 GMT] Killing kernel process, pid = 15664
[Sun, 31 Jul 2022 08:08:35 GMT] Process exited with code 0 and signal null.

Use ?? or Information to give hover information

Is your feature request related to a problem?

Sometimes ?? can give much more information for symbols. For example, ??Precedence will give

Precedence[sym]
returns the precedence of the output operator associated to the symbol sym.
Precedence[boxes, fmt]
returns the precedence of the operator of used in the typeset expression boxes, assuming it was typeset in the format fmt.

??Precedence // OutputForm

function taken from https://mathematica.stackexchange.com/a/819/68689

Describe the solution you'd like

Add an Option to read from ?? when hover on function.

Additional context

But the var type may be very long.

Unprotect[PlotRange];
ClearAttributes[PlotRange, ReadProtected];
??PlotRange // OutputForm
PlotRange is an option for graphics functions that specifies what range of coordinates to include in a plot. 
PlotRange[GraphicsArray[System`Dump`x_, System`Dump`opts___]] := With[{System`Dump`res = Graphics[GraphicsArray[System`Dump`x, System`Dump`opts]]}, PlotRange[System`Dump`res] /; System`Dump`GRTest[System`Dump`res]]
PlotRange[Internal`RasterGraphics[System`Dump`x_, System`Dump`opts___]] := With[{System`Dump`res = DensityGraphics[Internal`RasterGraphics[System`Dump`x, System`Dump`opts]]}, PlotRange[System`Dump`res] /; System`Dump`DGTest[System`Dump`res]]

and execute may also be slower than current method.


More deeply, is it possible to auto-complete those functions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.