feat: map more types

This commit is contained in:
Aire-One 2023-10-08 17:37:16 +02:00
parent 93dd7e2e7b
commit 9e65a4cc9b
2 changed files with 8 additions and 5 deletions

View File

@ -149,6 +149,7 @@ for _, node in dag.iter_global_nodes(module_dag) do
end
local global_module_ast <const> = ast.create_node("module", "global_env_def", "global_env_def", true)
-- Declare global types
table.insert(global_module_ast.children, ast.create_node("type", "Gears_Shape_Function", { "(function(cr: any, width: integer, height: integer))" }, true))
table.insert(global_module_ast.children, ast.create_node("type", "Color", { "any" }, true))
table.insert(global_module_ast.children, ast.create_node("type", "Surface", { "any" }, true))
table.insert(global_module_ast.children, ast.create_node("type", "Cairo_Context", { "any" }, true))

View File

@ -1,19 +1,21 @@
local type Node = require("awesomewmdtl.types.Node")
-- Special types I don't want to deal with for now
local gears_shape_function = "function(cr: any, width: integer, height: integer)"
local type_map <const>: { string : string } = {
awesome = "Awesome",
bool = "boolean",
["surface._native"] = "Surface",
cairo_context = "Cairo_Context",
color = "Color",
client = "Client",
["gears.shape"] = gears_shape_function,
["gears.shape"] = "Gears_Shape_Function",
["gears.surface"] = "Surface",
image = "Image",
int = "integer",
layout = "Layout",
raw_surface = "Surface",
raw_curface = "Surface", -- typo that should be fixed in the Client doc
screen = "Screen",
shape = gears_shape_function,
shape = "Gears_Shape_Function",
surface = "Surface",
tag = "Tag",
widget = "wibox.widget",