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

Support for Teal language #42

Open
megasoft1978 opened this issue Apr 27, 2024 · 11 comments
Open

Support for Teal language #42

megasoft1978 opened this issue Apr 27, 2024 · 11 comments

Comments

@megasoft1978
Copy link

Hi everyone,
I'm wondering if it's possible to extend this tool to support the Teal language with full integration and automatic transpile to Lua.
Defold team is already working on supporting the language in the editor but I actually prefer vscode.
Is it possible?

@astrochili
Copy link
Owner

astrochili commented Apr 27, 2024

It doesn't seem like it should be complicated. If I understand correctly, all it needs to do is run tl build before running bob? That's it?

Language support already is here.

There will be a lack of debug, no idea how to support it. Probably something related to source maps.

@megasoft1978
Copy link
Author

@astrochili yes, I think it would be nice to have the debugger working. Also I'm not sure if the defold API code completion will work with it. Any idea?

@astrochili
Copy link
Owner

No idea, I've never used Teal. But the questions raised are interesting:

  • Debugging (local lua debugger with source maps for teal?)
  • API autocomplete (what do we need to make it work?)
  • Adding an optional pre-task for Teal building.

@megasoft1978
Copy link
Author

@astrochili I think Teal just add types to Lua but we need source map for it in order to make the debugger works. No idea about the rest.

@megasoft1978
Copy link
Author

@astrochili I uploaded a very simple example here.
TealTestProject.zip

test.lua is actually generated using the command tl gen test.tl from the main folder.

Is this enough to give you an idea?

@astrochili
Copy link
Owner

astrochili commented Apr 30, 2024

As I understand, we need to turn all Teal files into Lua files before the build of the game. Probably by running tl build.

  • Which files are these, only lua scripts or also script, gui_script, render_script?
  • How to configure the list of these files, so that the build goes through them all, is it possible to configure tlconfig.lua for the whole current folder?
  • What should the Teal annotations for the Defold API look like and where should they be located?

There is good news about debugging, it looks like Teal saves line numbers in the generated Lua file. How exactly to debug it - we should see how it is done in ts-defold, as it uses the same debugging extension as the Defold Kit - local lua debugger.

Unfortunately I don't have that much time and attention to look into this issue thoroughly, nor do I have a plan to use Teal yet. If we omit debugging, then just adding file generation is a doable task. But at least with Defold API annotations.

We need consistent instructions on how to do this manually:

  • Example of the necessary tlconfig.lua to run tl build.
  • Example of Defold API annotation files and how to connect them.

@megasoft1978
Copy link
Author

@astrochili Let's postpone this to after Defold support Teal officially. At that point I guess it will be easier.
Thank you. :)

@astrochili
Copy link
Owner

Good idea 👍

@astrochili
Copy link
Owner

Example of API implementation for Love2D

@megasoft1978
Copy link
Author

@astrochili That looks great! Let me know when you'll have a bit of time to look into it.
I'm available to try out. :)

@astrochili
Copy link
Owner

astrochili commented May 10, 2024

When the Defold beta is available you can try Teal. The build phase will be included in the bob.

So all we need to do is add to the Defold Kit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants