teal-language / vscode-teal

Teal language support for Visual Studio Code
MIT License
76 stars 11 forks source link

"[Error] `tl types` has returned an empty response" whenever I open a tl file #34

Closed horatiohafnaugels closed 3 years ago

horatiohafnaugels commented 3 years ago

Whenever I open or save a tl file with VS Code I get this error: [Error] tl types has returned an empty response

I'm using the latest precompiled binary version of tl (0.11.2+dev) on Windows 10 and the latest version of vscode-teal available on the marketplace (v0.7.4).

pdesaulniers commented 3 years ago

Thanks for the bug report. On the command line, can you try running tl types <filename> on one of the files that are causing the error? You should see a JSON response.

pdesaulniers commented 3 years ago

Now that I think of it, the extension might have some trouble picking up the tl executable because it assumes tl is a .bat script, not an .exe: https://github.com/teal-language/vscode-teal/pull/11

horatiohafnaugels commented 3 years ago

Thanks for the bug report. On the command line, can you try running tl types <filename> on one of the files that are causing the error? You should see a JSON response.

tl types <filename> invoked from the command line works as expected, producing the JSON response.

pdesaulniers commented 3 years ago

The issue should be fixed on latest master. I will push the fix to the marketplace as soon as tl gets a new release.

pdesaulniers commented 3 years ago

@horatiohafnaugels @evanpaul22 I pushed a new release, does it work now?

evanpaul commented 3 years ago

@pdesaulniers That error went away for me!

I have a new (likely unrelated) error "[Error] Could not find the tl executable Please make sure that is available in the PATH"

This definitely seems like a me problem though; I actually have luarocks and tl installed on my Ubuntu WSL. Probably the answer would be to install them both outside of WSL and add tl to the PATH like mentioned

pdesaulniers commented 3 years ago

@evanpaul22 Yeah, on Windows, the extension tries to invoke tl using the default shell (generally cmd.exe).

As a workaround, you could probably create a shell script called tl.bat to serve as a bridge between cmd.exe and WSL. Something like this (disclaimer: I didn't test it!)

@echo off
wsl.exe tl %*

Then, just make sure the script is available in the PATH outside of WSL, so that the extension can detect it.

evanpaul commented 3 years ago

@evanpaul22 Yeah, on Windows, the extension tries to invoke tl using the default shell (generally cmd.exe).

As a workaround, you could probably create a shell script called tl.bat to serve as a bridge between cmd.exe and WSL. Something like this (disclaimer: I didn't test it!)

@echo off
wsl.exe tl %*

Then, just make sure the script is available in the PATH outside of WSL, so that the extension can detect it.

Clever! I'll give it a try. Thanks!

pdesaulniers commented 3 years ago

@evanpaul22 On second thoughts, you might run into some issues, considering that Windows-style paths differ from POSIX-style paths:

# POSIX
/somedir/myfile

# Win32
C:\\somedir\\myfile

tl inside WSL might not be able to understand Windows-style paths. (Also, I don't know how require() would behave with this setup :))

Anyway, I'm closing this issue in favor of https://github.com/teal-language/vscode-teal/issues/35.

horatiohafnaugels commented 3 years ago

@horatiohafnaugels @evanpaul22 I pushed a new release, does it work now?

Yes, it does. Thank you a lot!