WolframResearch / vscode-wolfram

Official Visual Studio Code extension for Wolfram Language
Other
114 stars 7 forks source link

Support for Wolfram Engine? #19

Open stepelu opened 2 years ago

stepelu commented 2 years ago

Does this extensions support Wolfram Engine (https://www.wolfram.com/engine/) as well?

bostick commented 2 years ago

Absolutely! Download and install it, and let me know if you have any problems with setting up this extension to use it.

stepelu commented 2 years ago

I got around to trying this, some remarks:

According to the instructions I should

Enter the command: Preferences: Configure Language Specific Settings... Select Wolfram A settings.json file is now open.

This results in the following (vscode latest), which is not what you want:

image

Instead, one simply has to add the following to the settings.json (Open User Settings (JSON)):

 "wolfram.kernel": "/Applications/Wolfram Engine.app/Contents/MacOS/WolframKernel",

It would be nice to mention this path for Wolfram Engine.

Other than that, I am happy to report that it works with Wolfram Engine.

A couple of quick questions:

i) Is it possible to customize the options used for code formatting via this extension?

The relevant package repository doesn't mention options either, but they are present (even though undocumented). Specifically, I would like to change the current behavior to something vaguely resembling the output of https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html, the present behavior produces a bit too much empty space for what I'm used to...

ii) If I understand correctly, autocomplete of standard (System?) Wolfram functions is not supported, correct?

If so, are there plans to extend this extension to cover that use case?

Thank you!

bostick commented 2 years ago

Thank you for the feedback!

I have fixed the instructions for the settings. (I think Configure Language Specific Settings... did used to go to JSON before. Anyway, I can't remember).

I also realized that a problem you probably ran into is that Wolfram Engine was not being recommended on macOS. Before version 13.0, usage messages were not present in Wolfram Engine (this was a bug). So we did not want to recommend versions of Wolfram Engine older than 13.0. This is easy to do for Linux and Windows, because the versions are in the paths themselves, but the path on Mac is just: /Applications/Wolfram Engine.app/

So a precaution, we did not recommend Wolfram Engine on Mac at all (though of course, it could always be provided manually as a setting).

I believe enough time has elapsed for people to be using 13.0+, so we will now automatically use Wolfram Engine on Mac systems.

i) It is possible, but there is not a convenient way to do it. The easiest way is to manually change the command-line to be used to set the settings that you want.

For example, my command looks something like this:

"wolfram.command": [
    "`kernel`",
    "-noinit",
    "-noprompt",
    "-nopaclet",
    "-nostartuppaclets",
    "-noicon",
    "-run",
    "Needs[\"LSPServer`\"];CodeFormatter`$DefaultLineWidth=Infinity;LSPServer`StartServer[]"
]

This sets the line width for CodeFormatter to Infinity.

Please open an issue in CodeFormatter repo to carry on a detailed discussion about this.

ii) We are actually currently in the process of finishing up the implementation of autocomplete and hope to have it in the product soon!

asukaminato0721 commented 11 months ago

autocomplete of standard (System?) Wolfram functions

it's usable now.

This issue can be closed now.