-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Implementing Terminal: Run Recent Commad when there are no open terminal #234124
base: main
Are you sure you want to change the base?
Implementing Terminal: Run Recent Commad when there are no open terminal #234124
Conversation
@microsoft-github-policy-service agree |
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.
I don't think we should be doing anything outside of the command implementation. Everything you need to do should be able to be done there. You might need to change it to registerTerminalAction
instead in order to get it to run when a terminal doesn't actually exist yet.
run: async (c, accessor, args) => { | ||
let activeInstance = c.service.activeInstance; | ||
const id = options.id; | ||
if (activeInstance) { | ||
return originalRun(activeInstance, c, accessor, args); | ||
} | ||
if (id !== 'workbench.action.terminal.runRecentCommand') { | ||
return; | ||
} | ||
const commandService = accessor.get(ICommandService); | ||
await commandService.executeCommand('workbench.action.terminal.new'); | ||
activeInstance = c.service.activeInstance; |
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.
This is a generic function so you shouldn't be changing this, instead you should change the run
callback passed in when it's called.
…d changing generic functions
@Tyriar I changed it in order to avoid changing the generic function. |
Fix #233604
The command 'Terminal: Run Recent Command' will now create a new terminal if no terminals are currently open.
Simply creating a new terminal is not sufficient for the recent command window to display correctly.
When a new terminal is created, it looks like it takes some more time to fully update its related variables, so I inserted a loop of quick sleep functions (up to 5 seconds in total) while continuosly trying to display the recent command window.