This one's a really huge ask, but would be a huge boost in production speed for Teal. Let's say I've got a file that exports a single thing like this:
local record Pos
x: integer
y: integer
end
return Pos
If I start typing Pos in another file, I'd expect to see a class completion at the very top, and hitting enter would automatically complete it and add local Pos = require 'physics.pos' to the list at the top. And the language server would scan all teal files on startup to see what's exported out of each file like this.
Everyone writes their file exports a little differently, but handling the basic case of a single record or named local variable could be a good start. And the quick fix assumes the require would have the same name as the record or variable. If you don't export a named variable and do something more complex like return { A = A, B = B, C = C } we don't bother handling that case for now.
Another point: the style of requires can vary a lot between people so I think a good heuristic is to look at the first line of the file and copy the style of whatever's found there, so you could do local Pos = require("physics.pos") or local Pos = require "physics.pos" or whatever tickles your fancy.
Love the extension, by the way! A language is only as good as it's tooling and VSCode + Teal easily beats out every other embedded scripting language I've seen.
This one's a really huge ask, but would be a huge boost in production speed for Teal. Let's say I've got a file that exports a single thing like this:
If I start typing
Pos
in another file, I'd expect to see aclass
completion at the very top, and hitting enter would automatically complete it and addlocal Pos = require 'physics.pos'
to the list at the top. And the language server would scan all teal files on startup to see what's exported out of each file like this.Everyone writes their file exports a little differently, but handling the basic case of a single record or named local variable could be a good start. And the quick fix assumes the require would have the same name as the record or variable. If you don't export a named variable and do something more complex like
return { A = A, B = B, C = C }
we don't bother handling that case for now.Another point: the style of requires can vary a lot between people so I think a good heuristic is to look at the first line of the file and copy the style of whatever's found there, so you could do
local Pos = require("physics.pos")
orlocal Pos = require "physics.pos"
or whatever tickles your fancy.Love the extension, by the way! A language is only as good as it's tooling and VSCode + Teal easily beats out every other embedded scripting language I've seen.