-
Notifications
You must be signed in to change notification settings - Fork 22
Home
Get the Extension from Visual Studio Marketplace
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-server-command
(lambda (port)
`("wolfram.exe"
"-script"
"path/to/lsp-wl/init.wls"
,(concat
"--socket="
(number-to-string port)
))))
:major-modes '(wolfram-mode)
:server-id 'lsp-wl
))
Use coc.nvim together with coc-lsp-wl.
To reveal the internal debug and kernel message, change info
to debug
at
https://github.com/kenkangxgwe/lsp-wl/blob/master/init.wls#L175 or similar places if you check out other branches.
It reads:
loglevel = ArgumentValue["--log"|"-l", Alternatives @@ LoggingLevels]
// Replace[_Missing -> "debug"];
You can see the logging message in the output console of the editor. You may also dump it to a file. Uncomment https://github.com/kenkangxgwe/lsp-wl/blob/master/init.wls#L181 or places similar in other branches, so it reads:
logstreams = {
OpenWrite[WolframLanguageServer`RootDirectory <> "wlserver.log"],
First @ Streams["stderr"]
};
It will be saved to path/to/lsp-wl/wlserver.log
.
The server depends on @brenton's AST
and Lint
paclet, which can be install in Mathematica / Wolfram Kernel using the following command.
PacletInstall[{"AST", <version_number>}, "UpdateSites" -> True]
PacletInstall[{"Lint", <version_number>}, "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", "UpdateSites" -> True]
PacletInstall["Lint", "UpdateSites" -> True]
You may also refer to @wuyudi's article (in Chinese).
-
The
Curry
issue has been resolved in 0.2.1. Meanwhile, I figured out thatCurry
is not so efficient as lambda function, so I started to transform them back intoFunction
.Mathematica 11.2 doesn't haveCurry
function, so far, you just need to checkout thedevelop
branch, where I implemented my ownMyCurry
function.