Merge pull request #31221 from jraygauthier/jrg/vscode-ext-python

vscode-extension-ms-python-python: Init at 0.8.0
This commit is contained in:
Frederik Rietdijk 2017-12-12 20:58:17 +01:00 committed by GitHub
commit 1817ec70fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 3 deletions

View File

@ -1,7 +1,8 @@
{ stdenv, lib, fetchurl, callPackage, vscode-utils }: { stdenv, lib, fetchurl, callPackage, vscode-utils }:
let let
inherit (vscode-utils) buildVscodeExtension buildVscodeMarketplaceExtension; inherit (vscode-utils) buildVscodeExtension buildVscodeMarketplaceExtension
extensionFromVscodeMarketplace;
in in
# #
# Unless there is a good reason not to, we attemp to use the same name as the # Unless there is a good reason not to, we attemp to use the same name as the
@ -24,4 +25,6 @@ rec {
}; };
ms-vscode.cpptools = callPackage ./cpptools {}; ms-vscode.cpptools = callPackage ./cpptools {};
ms-python.python = callPackage ./python {};
} }

View File

@ -0,0 +1,41 @@
{ stdenv, lib, vscode-utils
, pythonUseFixed ? false, python # When `true`, the python default setting will be fixed to specified.
# Use version from `PATH` for default setting otherwise.
# Defaults to `false` as we expect it to be project specific most of the time.
, ctagsUseFixed ? true, ctags # When `true`, the ctags default setting will be fixed to specified.
# Use version from `PATH` for default setting otherwise.
# Defaults to `true` as usually not defined on a per projet basis.
}:
assert pythonUseFixed -> null != python;
assert ctagsUseFixed -> null != ctags;
let
pythonDefaultsTo = if pythonUseFixed then "${python}/bin/python" else "python";
ctagsDefaultsTo = if ctagsUseFixed then "${ctags}/bin/ctags" else "ctags";
in
vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = {
name = "python";
publisher = "ms-python";
version = "0.8.0";
sha256 = "0i7s93l5g5lyi6vn77zh3ipj0p267y17fayv6vjrxc2igrs27ik6";
};
postPatch = ''
# Patch `packages.json` so that nix's *python* is used as default value for `python.pythonPath`.
substituteInPlace "./package.json" \
--replace "\"default\": \"python\"" "\"default\": \"${pythonDefaultsTo}\""
# Patch `packages.json` so that nix's *ctags* is used as default value for `python.workspaceSymbols.ctagsPath`.
substituteInPlace "./package.json" \
--replace "\"default\": \"ctags\"" "\"default\": \"${ctagsDefaultsTo}\""
'';
meta = with lib; {
license = licenses.mit;
maintainer = [ maintainers.jraygauthier ];
};
}

View File

@ -70,12 +70,14 @@ let
mktplcRef = ext; mktplcRef = ext;
}); });
extensionFromVscodeMarketplace = mktplcExtRefToExtDrv;
extensionsFromVscodeMarketplace = mktplcExtRefList: extensionsFromVscodeMarketplace = mktplcExtRefList:
builtins.map mktplcExtRefToExtDrv mktplcExtRefList; builtins.map extensionFromVscodeMarketplace mktplcExtRefList;
in in
{ {
inherit fetchVsixFromVscodeMarketplace buildVscodeExtension inherit fetchVsixFromVscodeMarketplace buildVscodeExtension
buildVscodeMarketplaceExtension extensionsFromVscodeMarketplace; buildVscodeMarketplaceExtension extensionFromVscodeMarketplace
extensionsFromVscodeMarketplace;
} }