diff --git a/src/awesomewm.d.tl/init.tl b/src/awesomewm.d.tl/init.tl index 1d23308..2cecf43 100644 --- a/src/awesomewm.d.tl/init.tl +++ b/src/awesomewm.d.tl/init.tl @@ -161,7 +161,7 @@ ast.in_order_visitor(module_ast, function(node: Node) module_dependencies.visit(node, module_ast, { modules = { Screen = { - name = "screen", + name = "Screen", module_path = "awful.screen", token = "module", }, diff --git a/src/awesomewm.d.tl/printer/teal_type_definition.tl b/src/awesomewm.d.tl/printer/teal_type_definition.tl index 4f089e4..05724f2 100644 --- a/src/awesomewm.d.tl/printer/teal_type_definition.tl +++ b/src/awesomewm.d.tl/printer/teal_type_definition.tl @@ -28,6 +28,14 @@ local function render_code(code: string, indent_level: integer): string return generated end +local function render_require(dependencies: { string : string }): string + local generated = "" + for dependency, path in pairs(dependencies) do + generated = generated .. string.format("local %s = require(\"%s\")\n", dependency, path) + end + return generated:sub(1, -2) -- remove the last newline +end + local record Node_Printer_Function on_node: function(node: Node, indent_level: integer): string, integer before_node: nil | function(node: Node, indent_level: integer): string, integer @@ -45,9 +53,11 @@ local node_printer : { Node.Token : Node_Printer_Function } = { string.format( [[ -- This file was auto-generated. + %s local record %s ]], + render_require(node.dependencies), node.name), indent_level), indent_level + 1 end,