-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Task's new integrated terminals are always revealed when Python extension is active with python.terminal.activateEnvironment set to true #17508
Comments
In the python extension we use |
@karthiknadig can you provide a self contained repro where
{
"label": "echo task",
"type": "shell",
"command": ".\\powershell.ps1",
"presentation": {
"reveal": "never"
}
}
const disposable = vscode.commands.registerCommand('extension.helloWorld', () => {
vscode.window.terminals.forEach(terminal => {
console.log('sending text');
terminal.sendText('echo hello');
});
});
|
While trying to create the repro, I might have discovered the problem in the extension. Looks like in some cases we call |
@karthiknadig correct, if you |
We have two activation paths, this one seems to be the culprit here:
@luabud Is there any reason we need to show the terminal on activation? I am guessing not and this is just a remnant from how we had it from a long time ago. |
@alexr00 Sorry for the trouble. I some how missed that line when looking into this issue. |
@karthiknadig I don't think we need to display the terminal on activation. As long as we active the terminal when users first open it, the setting serves its purpose. |
We have a new activation mechanism #11039 which does not require executing any commands so should not have this problem, give it a try:
|
I found these interlinking issues on the topic:
#3852 (links to vscode/66056, which is duplicate of vscode/65179)
microsoft/vscode#65179 (references this to be an issue with vscode-python specifically => #3852)
microsoft/vscode#66056 (duplicate of vscode/65179)
However #3852 was closed and locked, without the actual problem being addressed properly in my opinion.
While the latest answer in #3852 from @DonJayamanne does seem to get rid of the issue, I fail to see how the python.terminal.activateEnvironment setting SHOULD be connected to it.
I am presuming the activation of the virtual environment reveals the terminal, however the two features seem like they should not be connected / should not interact.
Having a task run within the configured virtual environment AND not showing/revealing its terminal when running it is a completely viable use-case in my opinion, but maybe I fail to see a connection?
Note that all of this only applies if a new integrated terminal is opened for the task's output, not when a "shared" panel is ready to be re-used or if the task is using a "dedicated" panel that is still open from the last run of the task.
Hence the real issue here as far as I can tell would be why the activation of the virtual environment is bringing the task's integrated terminal "to the front" (reveal).
Environment data
python.languageServer
setting: "Pylance"Expected behaviour
Even with "python.terminal.activateEnvironment" set to true and the "presentation.reveal" property of a task set to "never" I expect the terminal with the task output not to come into focus when running the task.
Actual behaviour
With "python.terminal.activateEnvironment" set to true, tasks with their "presentation.reveal" property set to "never" come into focus when the virtual environment is activated.
Steps to reproduce:
Activate the Python extension.
Create a task, e.g. (presentation.panel has been chosen as "new" because the issue only happens, when a new integrated terminal is opened for the task)
}
Run the task
Observe how the terminal with the task's output is revealed even though its presentation.reveal property is set to "never"
Logs
No output is shown in the Output panel, output of the task is shown in an integrated terminal instead (Correct behavior).
No log messages are triggered by this in the developer console.
The text was updated successfully, but these errors were encountered: