Skip to content

Feature request: add more info in TypeInfo and TypeReport #1045

@BLKTower

Description

@BLKTower

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions