lib.generators.toLua: tune comment for noogle use

See https://github.com/nix-community/noogle
This commit is contained in:
Mykola Orliuk
2023-04-23 19:33:11 +02:00
parent 4ec4c6fda9
commit a48fd10c86

View File

@@ -428,26 +428,37 @@ ${expr "" v}
builtins.toJSON v; builtins.toJSON v;
/* /*
* Translate a simple Nix expression to Lua representation with occasional Translate a simple Nix expression to Lua representation with occasional
* Lua-inlines that can be construted by mkLuaInline function. Lua-inlines that can be construted by mkLuaInline function.
*
* generators.toLua {} { Configuration:
* cmd = [ "typescript-language-server" "--stdio" ]; * indent - initial indent.
* settings.workspace.library = mkLuaInline ''vim.api.nvim_get_runtime_file("", true)'';
* } Attention:
* Regardless of multiline parameter there is no trailing newline.
*> {
*> ["cmd"] = { Example:
*> "typescript-language-server", generators.toLua {}
*> "--stdio" {
*> }, cmd = [ "typescript-language-server" "--stdio" ];
*> ["settings"] = { settings.workspace.library = mkLuaInline ''vim.api.nvim_get_runtime_file("", true)'';
*> ["workspace"] = { }
*> ["library"] = (vim.api.nvim_get_runtime_file("", true)) ->
*> } {
*> } ["cmd"] = {
*> } "typescript-language-server",
*/ "--stdio"
},
["settings"] = {
["workspace"] = {
["library"] = (vim.api.nvim_get_runtime_file("", true))
}
}
}
Type:
toLua :: AttrSet -> Any -> String
*/
toLua = { indent ? "" }@args: v: toLua = { indent ? "" }@args: v:
with builtins; with builtins;
let let
@@ -478,7 +489,10 @@ ${expr "" v}
abort "generators.toLua: type ${typeOf v} is unsupported"; abort "generators.toLua: type ${typeOf v} is unsupported";
/* /*
* Mark string as Lua expression to be inlined when processed by toLua. Mark string as Lua expression to be inlined when processed by toLua.
*/
Type:
mkLuaInline :: String -> AttrSet
*/
mkLuaInline = expr: { _type = "lua-inline"; inherit expr; }; mkLuaInline = expr: { _type = "lua-inline"; inherit expr; };
} }