astrochili / vscode-defold

A toolkit for Visual Studio Code to develop games with Defold
https://marketplace.visualstudio.com/items?itemName=astronachos.defold
MIT License
160 stars 10 forks source link

Support for Teal language #42

Open megasoft1978 opened 2 months ago

megasoft1978 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

@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 commented 2 months ago

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

megasoft1978 commented 2 months ago

@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 commented 2 months ago

@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 commented 2 months ago

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

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:

megasoft1978 commented 2 months ago

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

astrochili commented 2 months ago

Good idea 👍

astrochili commented 2 months ago

Example of API implementation for Love2D

megasoft1978 commented 2 months ago

@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 commented 1 month ago

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: