Skip to content
康小广 edited this page Nov 19, 2019 · 22 revisions

Editor Support

Visual Studio Code

Get the Extension from Visual Studio Marketplace

Gnu Emacs

Tested under Linux. Not work for Windows, because it seems that lsp-mode doesn't support socket for Windows.

(add-to-list 'lsp-language-id-configuration '(wolfram-mode . "Mathematica"))

(lsp-register-client
 (make-lsp-client :language-id 'wolfram
                  :new-connection (;; lsp-tcp-connection
                                   lsp-tcp-server-command
                                   ;; (lambda () message)
                                   (lambda (port)
                                     ;; print
                                     `("wolfram.exe"
                                       "-script"
                                       "path/to/lsp-wl/init.wls"
                                       ,(concat
                                         "--socket="
                                         (number-to-string port)
                                         ))))
                  :major-modes '(wolfram-mode)
                  :server-id 'lsp-wl
                  ))

(Neo)vim

Use coc.nvim together with coc-lsp-wl.

Troubleshooting

Dependency Issue

The server depends on @brenton's ASTand Lint paclet, which can be install in Mathematica / Wolfram Kernel using the following command.

PacletInstall[{"AST", <version_number>}, "Site" -> "http://pacletserver.wolfram.com", "UpdateSites" -> True]
PacletInstall[{"Lint", <version_number>}, "Site" -> "http://pacletserver.wolfram.com", "UpdateSites" -> True]

But sometimes if the <version_numver> is not the latest one, it will fail. The reason I explicitly specify the version number here is trying to keep the dependency in a stable and consistent version with the server. But seems that the Wolfram Paclet Server doesn't save all the previous versions. So use this instead.

PacletInstall["AST", "Site" -> "http://pacletserver.wolfram.com", "UpdateSites" -> True]
PacletInstall["Lint", "Site" -> "http://pacletserver.wolfram.com", "UpdateSites" -> True]

You may also refer to @wuyudi's article (in Chinese).

Cannot start w/ Mathematica 11.2

Mathematica 11.2 doesn't have Curry function, so far, you just need to checkout the develop branch, where I implemented my own MyCurry function.