Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test proposed api to get custom environment variables for a workspace #20056

Closed
2 tasks done
karrtikr opened this issue Oct 24, 2022 · 3 comments
Closed
2 tasks done

Test proposed api to get custom environment variables for a workspace #20056

karrtikr opened this issue Oct 24, 2022 · 3 comments
Labels
testplan-item Test plan item/assignments for upcoming release
Milestone

Comments

@karrtikr
Copy link

karrtikr commented Oct 24, 2022

Refs: #15112

Complexity: 3

Create Issue


Requirements

Use Pre release build of the python extension.

Test APIs exposed via ProposedExtensionAPI

Python extensions offers environments definition file (.env files) using which users can specify any custom environment variables that can be used for running linters, formatters, IntelliSense, testing, debugging etc for the workspace. This API provides a way to return the environment variables after resolving values of the .env file.

New API: environment variables

Example usage:
Copy over contents of https://github.com/microsoft/vscode-python/blob/main/src/client/proposedApiTypes.ts#L62-L74 as needed.

const extension = extensions.getExtension('ms-python.python');
if (extension) {
    if (!extension.isActive) {
        await extension.activate();
    }
    const api: IExtensionApi & ProposedExtensionAPI = extension.exports as IExtensionApi & ProposedExtensionAPI;
    if (api.environment) {
        const vars =  api.environments.getEnvironmentVariables(<workspace folder>);
    }
}
@karrtikr karrtikr added the testplan-item Test plan item/assignments for upcoming release label Oct 24, 2022
@karrtikr karrtikr added this to the October 2022 milestone Oct 24, 2022
@DonJayamanne
Copy link

Thanks @karrtikr for this API.
I'll making the changes in jupyter extension and test this there, (best way to test)

@lszomoru
Copy link
Member

Api works as advertised. There is a typo in the code sample: api.environments instead of api.environment.

@lszomoru lszomoru removed their assignment Oct 25, 2022
@DonJayamanne DonJayamanne added the verified Verification succeeded label Oct 25, 2022
@DonJayamanne DonJayamanne removed their assignment Oct 25, 2022
@DonJayamanne
Copy link

Verified, works as expected, thanks @karrtikr

@karrtikr karrtikr removed the verified Verification succeeded label Oct 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
testplan-item Test plan item/assignments for upcoming release
Projects
None yet
Development

No branches or pull requests

3 participants