Unverified Commit 4c751704 authored by Matthieu Coudron's avatar Matthieu Coudron Committed by GitHub
Browse files

neovim: computing python3 deps (#499097)

parents 587527a6 754cb66a
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ let
        optional = false;
      };
    in
    map (x: defaultPlugin // (if (x ? plugin) then x else { plugin = x; })) plugins;
    map (x: defaultPlugin // (if x ? plugin then x else { plugin = x; })) plugins;

  pluginWithConfigType =
    with lib;
@@ -78,17 +78,26 @@ in

    userPluginViml = lib.mkOption {
      readOnly = true;
      type = lib.types.listOf (lib.types.lines);
      type = lib.types.listOf lib.types.lines;
      description = ''
        The viml config set by the user.
      '';
    };

    pluginPython3Packages = lib.mkOption {
      readOnly = true;
      type = lib.types.listOf (lib.types.functionTo (lib.types.listOf lib.types.package));
      example = lib.literalExpression "[ (ps: [ ps.python-language-server ]) ]";
      description = ''
        Packages required by the plugins to work with the python3 provider.
      '';
    };

  };

  config =
    let
      pluginsNormalized = normalizePlugins config.plugins;
      pluginsNormalized = config.plugins;
    in
    {
      pluginAdvisedLua =
@@ -111,5 +120,7 @@ in
      userPluginViml = lib.foldl (
        acc: p: if p.config != null then acc ++ [ p.config ] else acc
      ) [ ] pluginsNormalized;

      pluginPython3Packages = map (plugin: plugin.python3Dependencies or (_: [ ])) pluginsNormalized;
    };
}
+2 −7
Original line number Diff line number Diff line
@@ -99,24 +99,19 @@ let
        inherit plugins;
      };

      pluginsNormalized = normalizePlugins plugins;
      pluginsNormalized = checked_cfg.plugins;

      vimPackage = normalizedPluginsToVimPackage pluginsNormalized;

      getDeps = attrname: map (plugin: plugin.${attrname} or (_: [ ]));

      requiredPlugins = vimUtils.requiredPluginsForPackage vimPackage;
      pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins;
    in
    {
      # plugins' python dependencies
      inherit pluginPython3Packages;

      # viml config set by the user along with the plugin
      inherit (checked_cfg)
        userPluginViml
        runtimeDeps
        pluginAdvisedLua
        pluginPython3Packages
        ;

      # A Vim "package", see ':h packages'