WIP: awesomerc.tl should work #85

Draft
Aire-One wants to merge 40 commits from feat/#58 into master
2 changed files with 17 additions and 29 deletions
Showing only changes of commit 1595e9b834 - Show all commits

View File

@ -1,21 +1,7 @@
local type Node = require("awesomewmdtl.types.Node") local type Node = require("awesomewmdtl.types.Node")
-- Teal doesn't have a `keyof` operator yet, so we have to do this manually.
-- Some keys shouldn't be changed, so we don't include them here.
local enum Node_Key
"token"
"name"
-- "children"
"types"
"parameters"
"return_types"
-- "module_path"
-- "dependencies"
-- "global"
end
-- Teal can't define nested Map types yet, so we have to define a type for the nested map. -- Teal can't define nested Map types yet, so we have to define a type for the nested map.
local type New_Node = { Node_Key : any } local type New_Node_By_Name = { string : Node }
local type New_Node_By_Name = { string : New_Node }
-- This is a map of module paths to a map of node names to a map of node keys to new values. -- This is a map of module paths to a map of node names to a map of node keys to new values.
-- This is used to fix nodes where either -- This is used to fix nodes where either
@ -27,20 +13,19 @@ local type New_Node_By_Name = { string : New_Node }
-- EVERYTHING IN HERE IS TEMPORARY AND SHOULD BE REMOVED! -- EVERYTHING IN HERE IS TEMPORARY AND SHOULD BE REMOVED!
local node_fixer <const>: { string : New_Node_By_Name } = { local node_fixer <const>: { string : New_Node_By_Name } = {
-- ["gears.color"] = { ["awful.titlebar"] = {
-- ["to_rgba_string"] = { new = {
-- parameters = { return_types = { { "Titlebar" } }, -- The Awesome APIDoc have to updated
-- { token = "variable", name = "color", types = { "string" } }, },
-- { token = "variable", name = "fallback", types = { "string" } }, },
-- }, ["awful.widget.prompt"] = {
-- }, set_shape = {
-- ["change_opacity"] = { parameters = {
-- parameters = { { token = "variable", name = "self", types = { "Prompt" } },
-- { token = "variable", name = "input", types = { "string" } }, { token = "variable", name = "shape", types = { "Gears_Shape_Function" } }, -- cannot discriminate a union between multiple function types: Gears_Shape_Function | function(...: <any type>): <any type>...
-- { token = "variable", name = "opacity", types = { "number" } }, },
-- }, },
-- }, },
-- },
["gears.surface"] = { ["gears.surface"] = {
apply_shape_bounding = { apply_shape_bounding = {
parameters = { parameters = {

View File

@ -10,10 +10,13 @@ local type_map <const>: { string : string } = {
client = "Client", client = "Client",
["gears.shape"] = "Gears_Shape_Function", ["gears.shape"] = "Gears_Shape_Function",
["gears.surface"] = "Cairo_Surface", ["gears.surface"] = "Cairo_Surface",
["Gio.InputStream"] = "any", -- We'll probably never have better support for this one, since it's a GI bindings
image = "Image", image = "Image",
int = "integer", int = "integer",
Integer = "integer", Integer = "integer",
layout = "Layout", layout = "Layout",
["lgi.Pango.FontDescription"] = "any", -- We'll probably never have better support for this one, since it's a GI bindings
["Pango.FontDescription"] = "any", -- We'll probably never have better support for this one, since it's a GI bindings
placement = "Awful_Placement_Function", placement = "Awful_Placement_Function",
raw_surface = "Cairo_Surface", raw_surface = "Cairo_Surface",
screen = "Screen", screen = "Screen",