-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Fix: Wait for clear command to execute before reusing terminal #240970
Conversation
V pohodě, jsem moc spokojen |
We should not just blindly add a delay. If shell integration is available (the common case) we should use |
@connor4312 if you check the lines above the pr code: vscode/src/vs/workbench/api/node/extHostDebugService.ts Lines 155 to 158 in a948ee5
you can see after the ^C there is also a 200ms delay (which was related to an issue exactly the same as this, except about ^C being in the terminal command instead of clear). so i used the same fix/copied that for that on this issue. for the clearBeforeReusing code, there isn't an if statement making sure that there is a terminal.shellIntegration (so we can't use it yet). so if you suggest using the shellIntegration for this instead of a delay, then where should there be an added if for the terminal.shellIntegration? and what if terminal.shellIntegration isn't true? should we then fall back to the delay? To me it makes more sense to copy the delay from the few lines above as it works always and doesn't depend on if terminal.shellIntegration is there or not. if (terminal.shellIntegration) {
terminal.shellIntegration.executeCommand('clear');
} So what do you suppose is the best way to handle this? add an if statement like above to check if it is available? and if it isn't available fall back to the old solution with a delay? (or add the if statement to the main if clearBeforeReusing statement, but this would only allow the setting clearBeforeReusing if the shellIntegration is also available, which isn't always the case) |
@microsoft-github-policy-service agree |
@connor4312 i have updated the PR code, i added the shellIntegration and kept the delay only for when the shellIntegration isn't available. Can you review my PR again to see if this is what you mean and are satisfied with this implementation? |
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
clear command was in the middle of executing while the main (debugger) command started executing. Adding a small timeout to make sure the clear command executes before allowing the main command to be sent to the terminal.
this would happen when the
settings.json
has these settings:Fixes #240953