about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMykola Orliuk <virkony@gmail.com>2023-04-23 19:33:11 +0200
committerMykola Orliuk <virkony@gmail.com>2023-04-23 19:46:13 +0200
commita48fd10c8699c4ae3cd6b4565cf1ebf1d9b38333 (patch)
treee5630e1761ffe18cef3b891c1e026610092ee9ce
parent4ec4c6fda90cec38b0878bf6e601f5df82ae5a8f (diff)
lib.generators.toLua: tune comment for noogle use
See https://github.com/nix-community/noogle
-rw-r--r--lib/generators.nix58
1 files changed, 36 insertions, 22 deletions
diff --git a/lib/generators.nix b/lib/generators.nix
index 41c2862973f18..9e663abbd57ba 100644
--- a/lib/generators.nix
+++ b/lib/generators.nix
@@ -428,26 +428,37 @@ ${expr "" v}
       builtins.toJSON v;
 
   /*
-   * Translate a simple Nix expression to Lua representation with occasional
-   * Lua-inlines that can be construted by mkLuaInline function.
-   *
-   * generators.toLua {} {
-   *   cmd = [ "typescript-language-server" "--stdio" ];
-   *   settings.workspace.library = mkLuaInline ''vim.api.nvim_get_runtime_file("", true)'';
-   * }
-   *
-   *> {
-   *>   ["cmd"] = {
-   *>     "typescript-language-server",
-   *>     "--stdio"
-   *>   },
-   *>   ["settings"] = {
-   *>     ["workspace"] = {
-   *>       ["library"] = (vim.api.nvim_get_runtime_file("", true))
-   *>     }
-   *>   }
-   *> }
-   */
+   Translate a simple Nix expression to Lua representation with occasional
+   Lua-inlines that can be construted by mkLuaInline function.
+
+   Configuration:
+     * indent - initial indent.
+
+   Attention:
+     Regardless of multiline parameter there is no trailing newline.
+
+   Example:
+     generators.toLua {}
+       {
+         cmd = [ "typescript-language-server" "--stdio" ];
+         settings.workspace.library = mkLuaInline ''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:
     with builtins;
     let
@@ -478,7 +489,10 @@ ${expr "" v}
       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; };
 }