Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] tl types has returned an empty response. #42

Closed
quienn opened this issue Jun 26, 2021 · 8 comments
Closed

[Error] tl types has returned an empty response. #42

quienn opened this issue Jun 26, 2021 · 8 comments
Labels
bug Something isn't working
Milestone

Comments

@quienn
Copy link

quienn commented Jun 26, 2021

Just installed the vscode-teal extension through the editor itself, version 1.57.1, Windows 10.

image

When run from PowerShell, tl types does work perfectly fine.

Edit: I'm running tl 0.13.1. I'll check if this happens in latest master branch.

@pdesaulniers pdesaulniers added the bug Something isn't working label Jun 26, 2021
@pdesaulniers
Copy link
Member

OK, I've seen this error before: #34

How did you install tl? Did you use LuaRocks?

@pdesaulniers
Copy link
Member

pdesaulniers commented Jun 26, 2021

In any case, I assume Node.js is unable to find tl in the PATH for some reason. The extension is probably failing to detect the ENOENT correctly, and it encounters an error later on because stdout is empty:

if (isEmptyOrSpaces(typesCmdResult.stdout)) {
showErrorMessage("[Error]\n" + "`tl types` has returned an empty response.");
return null;
}

@quienn
Copy link
Author

quienn commented Jun 26, 2021

How did you install tl? Did you use LuaRocks?

Yes, using LuaRocks 3.5.0. I'm managing my Lua install using hererocks.

Instead of relying in Node.js magic, what about letting the user choose a path where tl is located? It could first search for it in the PATH and then, if it is not found, use the one at tl.compilerPath instead.

@pdesaulniers
Copy link
Member

pdesaulniers commented Jun 26, 2021

Yes, using LuaRocks 3.5.0. I'm managing my Lua install using hererocks.

OK, good. Can you please run cmd.exe and check if tl is available in the PATH? If not, can you add it to the PATH and check if that fixes the issue?

Instead of relying in Node.js magic, what about letting the user choose a path where tl is located?

The extension used to have an option for customizing the compiler path, but it would lead to some issues due to how LUA_PATH works.

The tl driver always require the first tl.lua that it finds in the LUA_PATH. Even if we call /subdirectory/tl/tl directly, this doesn't mean that the driver will necessarily pick up /subdirectory/tl/tl.lua. It could pick a different one, say, /usr/local/lua/tl.lua instead. So, the tl.compilerPath option did not behave as expected in some cases :/

@quienn
Copy link
Author

quienn commented Jun 26, 2021

Can you please run cmd.exe and check if tl is available in the PATH?

It worked! But that just defeats the whole purpose of using hererocks to manage different Lua versions for me. 😞
The cool thing about my setup at least is that I can change a $LuaVersion variable in PowerShell and get that version up and running easily.

What about bundling tl.lua into the project? Something like fengari or even wasmoon would do the job of running it. Relying in the user compiler could lead to inconsistencies and errors because of different versions being tested.

@pdesaulniers
Copy link
Member

pdesaulniers commented Jun 26, 2021

Yes, I think this could be a good solution. I'll think about it!

The tl releases on GitHub contain standalone executables for Windows and Linux. Instead of running tl.lua using fengari, it would probably be easier to bundle these platform-dependent tl executables along with the extension.

pdesaulniers added a commit that referenced this issue Jun 26, 2021
This hack was used to detect "tl not found" errors on Windows. However, this approach proved to be quite fragile: #42
@pdesaulniers pdesaulniers added this to the v0.8.0 milestone Jul 23, 2021
@pdesaulniers
Copy link
Member

The error message should be indirectly fixed by 85cffb7.

The extension will now display the following message when opening a file, if tl cannot be found:

Could not find the tl executable. Please make sure that it is available in the PATH.

Type-checking has been disabled for this file.

I'm closing this issue in favor of #44. Thanks!

@quienn
Copy link
Author

quienn commented Jul 23, 2021

The error message should be indirectly fixed by 85cffb7.

Though the error I reported actually got fixed with ae605c9 somehow, that was the other thing I wanted to open an issue for, because it became an annoyance while breaking stuff in my existing codebase. I'm glad it's fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants