From 09801c985b4449de0736603b1c2d8652bfab4b93 Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Mon, 2 Dec 2024 18:45:25 +0800 Subject: [PATCH] vscode-extensions: make `pname` optional Many code in the wild still use `vscode-utils.buildVscodeExtension` with the `name` argument, so it would be better to make it optional. For example, a github code search of `buildVscodeExtension` returns 100+ results, most of them uses the `name` argument: https://github.com/search?q=buildVscodeExtension+language%3ANix&type=code&l=Nix --- .../editors/vscode/extensions/vscode-utils.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/editors/vscode/extensions/vscode-utils.nix b/pkgs/applications/editors/vscode/extensions/vscode-utils.nix index bd0390eaa84b..74d674dced92 100644 --- a/pkgs/applications/editors/vscode/extensions/vscode-utils.nix +++ b/pkgs/applications/editors/vscode/extensions/vscode-utils.nix @@ -11,7 +11,7 @@ let buildVscodeExtension = a@{ - pname, + pname ? null, # Only optional for backward compatibility. src, # Same as "Unique Identifier" on the extension's web page. # For the moment, only serve as unique extension dir. @@ -37,9 +37,10 @@ let "vscodeExtUniqueId" "pname" ]) - // { - + // (lib.optionalAttrs (pname != null) { pname = "vscode-extension-${pname}"; + }) + // { passthru = passthru // { inherit vscodeExtPublisher vscodeExtName vscodeExtUniqueId;