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 end
local global_module_ast <const> = ast.create_node("module", "global_env_def", "global_env_def", true) local global_module_ast <const> = ast.create_node("module", "global_env_def", "global_env_def", true)
-- Declare global types -- 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", "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", "Surface", { "any" }, true))
table.insert(global_module_ast.children, ast.create_node("type", "Cairo_Context", { "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") 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 } = { local type_map <const>: { string : string } = {
awesome = "Awesome", awesome = "Awesome",
bool = "boolean", bool = "boolean",
["surface._native"] = "Surface",
cairo_context = "Cairo_Context",
color = "Color",
client = "Client", client = "Client",
["gears.shape"] = gears_shape_function, ["gears.shape"] = "Gears_Shape_Function",
["gears.surface"] = "Surface", ["gears.surface"] = "Surface",
image = "Image", image = "Image",
int = "integer", int = "integer",
layout = "Layout", layout = "Layout",
raw_surface = "Surface",
raw_curface = "Surface", -- typo that should be fixed in the Client doc
screen = "Screen", screen = "Screen",
shape = gears_shape_function, shape = "Gears_Shape_Function",
surface = "Surface", surface = "Surface",
tag = "Tag", tag = "Tag",
widget = "wibox.widget", widget = "wibox.widget",