tl icon indicating copy to clipboard operation
tl copied to clipboard

Feature request: add more info in `TypeInfo` and `TypeReport`

Open BLKTower opened this issue 2 months ago • 1 comments

We are maintaining an in-house vscode teal plugin. To make the plugin support necessary features e.g., go to definition/find references/etc, we feel that current TypeInfo collected by teal compiler is not enough. So we did some customizations to the compiler to collect the data we need.

However, teal recently upgraded to 0.25 with a major structure change, which makes us have to reapply all the customizations to the new version. And it's a lot of work. So I wonder if it is possible that teal compiler can just support collecting and providing these infos natively. I believe other developers can also get benefits from this.

Here are some examples of what we added:

record TypeInfo
   ...      
   -- Used for vscode plugin `go to definition`. E.g., a.foo()
   field_pos: {string: Where}
end
record TypeReport
   ...      
   -- Used for vscode plugin `find ferences`
   -- filename -> typeid -> filedname -> line -> character
   record_field_usages: {string: {integer: {string: {integer: integer}}}}
   -- Used for vscode plugin `find ferences`
   -- var_decl_key -> filename -> line -> character
   var_decl_to_ref_map: {string: {string: {integer: integer}}}
   -- Used for vscode plugin `go to definition` for local variable. E.g., local a = 1
   -- filename -> line -> character -> var_decl_key
   var_ref_to_decl_map: {string: {integer: {integer: string}}}
end
record FunctionType
   ...      
   -- Used for vscode plugin formatter
   arg_names: {string}
end

These may not be the best practice/naming/place to put/etc, but good enough for our use case. If teal compiler can provide something better, that would be great appreciated.

BLKTower avatar Nov 06 '25 00:11 BLKTower

Hi @hishamhm sorry to bother. I noticed this issue is not labeled as feature request. Does it mean Teal doesn't plan to add this?

BLKTower avatar Nov 26 '25 01:11 BLKTower