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

Ensure interpreter information in the status bar appears for "Python related" files #18930

Closed
karrtikr opened this issue Apr 15, 2022 · 10 comments
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality needs PR Ready to be worked on

Comments

@karrtikr
Copy link

karrtikr commented Apr 15, 2022

Currently it's only displayed if a Python file or a settings.json file is opened. Some of other things we should probably display it for:

  • Any file which triggers extension activation should ideally have it displayed:
    "workspaceContains:mspythonconfig.json",
    "workspaceContains:pyproject.toml",
    "workspaceContains:Pipfile",
    "workspaceContains:setup.py",
    "workspaceContains:requirements.txt",
    "workspaceContains:manage.py",
    "workspaceContains:app.py"

Also note there can various types of requirements files:

vscode-python/package.json

Lines 1470 to 1477 in e157943

"filenamePatterns": [
"**/*-requirements.{txt, in}",
"**/*-constraints.txt",
"**/requirements-*.{txt, in}",
"**/constraints-*.txt",
"**/requirements/*.{txt,in}",
"**/constraints/*.txt"
],

cc/ @luabud @brettcannon feel free to edit the list

@karrtikr karrtikr added feature-request Request for new features or functionality needs PR area-environments Features relating to handling interpreter environments labels Apr 15, 2022
@FloLey
Copy link

FloLey commented May 3, 2022

Could It also be considered to add a field in the settings to specify manually files or type of files (*.txt for example) for which the status bar would remain active?
I was using the environment selector of the status bar with files of a custom type but this isn't possible anymore.

@karrtikr
Copy link
Author

karrtikr commented May 3, 2022

Can you elaborate on these "files of a custom type"? If it's standard we can possibly include them in the regex.

@FloLey
Copy link

FloLey commented May 4, 2022

It's not standard. We developed a DSL that is translated to python code and executed by our compiler. All those files have the same extension (*.cf). So the virtual env in which we are is important for our compiler but we do not follow the python syntax and keywords. When the statusbar was always visible we were happy but we do understand that showing it all the time is overkill and can annoy people. What I propose is adding a setting to the the python extension in which people can add additional files/file extensions/regexes for which the statusbar would stay active or even a setting that is by default toggled off but can be toggled on to always show the status bar. I'm ready to open a PR myself for this if it has a chance to be merged :)

Thanks

(Should I create a new issue for this or am I at the right place?)

@FloLey
Copy link

FloLey commented May 4, 2022

Another option that would suit us:
We have our own vs-code extension. If you would have a command to show/hide the statusbar, we could invoke it from within our own extension. The command would change a "showPythonSelector" flag.
and then this would need to change like this:

get hidden() {
    const document = this.docManager.activeTextEditor?.document;
    if (document?.fileName.endsWith('settings.json') || showPythonSelector) {
        return false;
    }
    return document?.languageId !== PYTHON_LANGUAGE;
}

Would that be possible?

@wouterdb
Copy link

wouterdb commented May 4, 2022

Or, alternatively, allow other extensions to register additional languages that get the selector box by registering their languageId's into showPythonSelectorType

get hidden() {
    const document = this.docManager.activeTextEditor?.document;
    if (document?.fileName.endsWith('settings.json')) {
        return false;
    }
    return ! showPythonSelectorType.includes(document?.languageId);
}

(I'm not a typescript user, so I could be way of here)

@brettcannon
Copy link
Member

brettcannon commented May 4, 2022

(Should I create a new issue for this or am I at the right place?)

This is as good as any other place. 🙂

Another option we have is bringing back the "always show" mechanic when we move to the language status menu. Since it would be hidden behind the {} menu it would be less intrusive, so the objections to always showing it may become less of a concern. I've asked the wider VS Code team for input on this idea.

@brettcannon
Copy link
Member

After talking it over with the wider VS Code team, we decided we can provide a setting to expose the interpreter information at all times when the Python extension is loaded. I will create a separate issue for this.

@brettcannon
Copy link
Member

#19089 for the setting idea.

@karrtikr
Copy link
Author

karrtikr commented Jul 25, 2022

FYI we now have a setting python.interpreter.infoVisibility which controls the basic visibility: #19089 (comment).

@github-actions github-actions bot removed the needs PR label Aug 9, 2022
@karrtikr karrtikr added the needs PR Ready to be worked on label Aug 9, 2022
@karrtikr
Copy link
Author

Since we've a setting to always show interpreter and we haven't received any other reports asking to show this, closing this issue.

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality needs PR Ready to be worked on
Projects
None yet
Development

No branches or pull requests

4 participants