Skip to content

Do not attempt to launch any servers in case when Python is not installed #25

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

Closed
karrtikr opened this issue Jul 1, 2022 · 7 comments
Closed
Labels
feature-request Request for new features or functionality

Comments

@karrtikr
Copy link
Contributor

karrtikr commented Jul 1, 2022

Something like:

public async hasInterpreters(): Promise<boolean> {
    const onAddedToCollection = createDeferred();
    // Watch for collection changed events.
    this.api.onChanged(async (e: PythonEnvCollectionChangedEvent) => {
        if (e.new) {
            onAddedToCollection.resolve();
        }
    });
    const initialEnvs = this.api.getEnvs();
    if (initialEnvs.length > 0) {
        return true;
    }
    await Promise.race([onAddedToCollection.promise, this.api.getRefreshPromise()]);
    return this.api.getEnvs().length > 0;
}

can be built off using the proposed discovery API.

@karthiknadig
Copy link
Member

@karrtikr @luabud Since this particular issue is there to reduce the number of notifications we pop; do you suggest that we just log this

@karrtikr I don't want this template to have any more knowledge about how the discovery occurs in the python extension. I think a better approach is, this extension asks for interpreter, and gets back undefined if nothing is available. When one becomes available and is selected it will trigger interpreter changed event. that should start the server.

@luabud
Copy link
Member

luabud commented Jul 7, 2022

I agree 👍

@karthiknadig
Copy link
Member

karthiknadig commented Jul 13, 2022

To Do:

  • Use new API to fetch python.
  • If python is missing log to output channel.
  • If user runs restart command, show notification that python is not selected. With a button to trigger python selection.

@karrtikr
Copy link
Contributor Author

If user runs restart command, show notification that python is not selected. With a button to trigger python selection.

python.triggerEnvSelection command can be used if no interpreter is returned via the API to trigger a prompt asking to select an interpreter.

@karrtikr
Copy link
Contributor Author

Can you please link the PRs/commits fixing this in all 4 repositories?

@karrtikr
Copy link
Contributor Author

We should also add a milestone so these can be verified.

@karthiknadig
Copy link
Member

karthiknadig commented Jul 29, 2022

pull requests for the template:
#30
#34

Pull request for pylint:
microsoft/vscode-pylint#147

Pull request for black:
pending

Pull request for isort:
pending

Note that i did create TPI to test some settings which used proposed API. There is no direct way to test the template other than using the pylint, black, isort extensions. I will schedule a mini bug bash for those next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants