1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00

vscode: Fix version checks when using Cursor (#6680)

The version check for VSCode fails when using Cursor.
Cursor has its own versioning and is currently at
0.45.14 (based on VSCode version 1.96.2).
The version checks for generating the `extensions.json` in the
module look at the package version,
which causes them not to be generated for Cursor.
This commit is contained in:
Tim Steinbach 2025-03-26 09:44:18 -04:00 committed by GitHub
parent ce287a5cd3
commit 693840c01b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -389,25 +389,26 @@ in {
mkMerge (concatMap toPaths
(flatten (mapAttrsToList (n: v: v.extensions) cfg.profiles))
++ optional
(versionAtLeast vscodeVersion "1.74.0" && defaultProfile != { }) {
# Whenever our immutable extensions.json changes, force VSCode to regenerate
# extensions.json with both mutable and immutable extensions.
"${extensionPath}/.extensions-immutable.json" = {
text = extensionJson defaultProfile.extensions;
onChange = ''
run rm $VERBOSE_ARG -f ${extensionPath}/{extensions.json,.init-default-profile-extensions}
verboseEcho "Regenerating VSCode extensions.json"
run ${getExe cfg.package} --list-extensions > /dev/null
'';
};
})
((versionAtLeast vscodeVersion "1.74.0" || vscodePname == "cursor")
&& defaultProfile != { }) {
# Whenever our immutable extensions.json changes, force VSCode to regenerate
# extensions.json with both mutable and immutable extensions.
"${extensionPath}/.extensions-immutable.json" = {
text = extensionJson defaultProfile.extensions;
onChange = ''
run rm $VERBOSE_ARG -f ${extensionPath}/{extensions.json,.init-default-profile-extensions}
verboseEcho "Regenerating VSCode extensions.json"
run ${getExe cfg.package} --list-extensions > /dev/null
'';
};
})
else {
"${extensionPath}".source = let
combinedExtensionsDrv = pkgs.buildEnv {
name = "vscode-extensions";
paths = (flatten (mapAttrsToList (n: v: v.extensions) cfg.profiles))
++ optional
(versionAtLeast vscodeVersion "1.74.0" && defaultProfile != { })
++ optional ((versionAtLeast vscodeVersion "1.74.0" || vscodePname
== "cursor") && defaultProfile != { })
(extensionJsonFile "default"
(extensionJson defaultProfile.extensions));
};