Closed octacian closed 11 months ago
Thanks for reporting. This should be handled more gracefully.
Right now, the extension simply calls whichever tl
it finds in the $PATH
. So, this issue should be fixed by appending <your home folder>/.luarocks/bin/
to the $PATH
variable.
As per this wiki page, assuming you're using Bash, you can add eval $(luarocks path --bin)
to ~/.bashrc
to take care of this.
With commit https://github.com/pdesaulniers/vscode-teal/commit/ba37a765837bf72570d44925a2997b3637340b63, the server should not crash when tl
cannot be found.
The next step will be to add a configuration key to customize the path of the tl
executable. Also, maybe the extension should look for tl
in multiple places before giving up...
Since https://github.com/teal-language/vscode-teal/commit/e324c9904ca480a0ccbab44849298ce14c52cae3, the compiler's path can be customized using the Teal > Compiler Path
setting.
I think this issue can be closed now!
Hello, is this change available in VS Code Extensions Marketplace?
Hello! No, unfortunately, I canceled this change at some point, since it was a bit misleading :(
Last time I checked, tl
's launcher script was programmed to load the first tl.lua
it finds in the LUA_PATH
, rather than the one in the same directory as the launcher script. So, in some circumstances, the compiler defined in the Teal > Compiler Path
setting would not match the one that tl
actually uses...
With that said, it seems like this behavior has been changed in the compiler, so it might be possible to reimplement this setting: https://github.com/teal-language/tl/blob/098780faa1220c6028257270ea9c197a273c2004/tl#L3-L15
Alright, looking forward to it, thanks.
Another option would be to bundle tl
along with the extension. So, by default, the extension would not depend on tl
being installed; it would simply use its own build of the compiler. Would that be OK for your use case?
For now I used the prebuilt binaries of Teal (tl.exe
) and put it somewhere accessible by VSCode (through my PATH
). While bunding the extension is also a good idea, the extension must be updated when new version of Teal is released.
Another option would be to bundle
tl
along with the extension. So, by default, the extension would not depend ontl
being installed; it would simply use its own build of the compiler. Would that be OK for your use case?
The initial solution you implemented would be ideal imho. The reason being that it would enable support for monorepos were the repos could have a specific version of teal versioned. Also, if users of teal embed it into their own binaries, they could supply the path to their binary that embeds teal.
To +1 this I'd appreciate being able to set the path to the tl compiler rather than having it in my global PATH. Can we re-open this issue?
OK, let's reopen the issue :)
It should be a matter of reverting this commit and publishing a new release: https://github.com/teal-language/vscode-teal/commit/922a03e785c07e0cc4bbd1a43b4b0d6d02131fdb
The teal.compilerPath
setting has been re-added in version v0.9.0.
After manually installing the extension I discovered that the language server doesn't start up correctly if the
tl
package is installed to the local LuaRocks tree vialuarocks install --local tl
. Instead, it fails with the following reason:Installing
tl
globally viasudo luarocks install tl
solves the problem.