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

Shell integration: Create "Terminal: Run Recent Command" command #139401

Closed
Tyriar opened this issue Dec 17, 2021 · 7 comments
Closed

Shell integration: Create "Terminal: Run Recent Command" command #139401

Tyriar opened this issue Dec 17, 2021 · 7 comments
Assignees
Labels
plan-item VS Code - planned item for upcoming terminal-shell-integration Shell integration, command decorations, etc.
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Dec 17, 2021

Parent issue #133084

Blocked on:

Notes:

  • This will present a quick pick with all recently run terminal commands, including command name, cwd, exit code
  • When selected in the quick pick, the command will run in the active terminal
  • Should have smoke tests
  • Whatever tracks command history should have unit tests
  • Considerations:
    • Do we have a maximum of entries we track?
    • Should this be sorted by recency of frequency?
    • Can we avoid settings for this feature?
@Tyriar Tyriar added plan-item VS Code - planned item for upcoming terminal-shell-integration Shell integration, command decorations, etc. labels Dec 17, 2021
@Tyriar Tyriar added this to the January 2022 milestone Dec 17, 2021
@Tyriar
Copy link
Member Author

Tyriar commented Jan 7, 2022

We also want to check to see if there is currently a command being input and send ctrl+c if so (Terminate batch job might cause problems on Windows)

@Tyriar
Copy link
Member Author

Tyriar commented Jan 7, 2022

Something else to think about, pretty sure we want to persist this information, but should it be persisted globally or per workspace?

@meganrogge
Copy link
Contributor

I think per workspace since the commands one runs in different projects (esp if using different languages) are often very different.

@meganrogge
Copy link
Contributor

meganrogge commented Jan 7, 2022

I still wonder if commands should be saved per terminal instance. Thoughts?

@Tyriar
Copy link
Member Author

Tyriar commented Jan 7, 2022

@meganrogge I guess a combination is what would be best, a given terminal instance would have a series of commands with exit code, timestamp, maybe output, etc. But then we would have a deduped list of past commands that are persisted which don't store exit code/timestamp/etc., or at least if we did keep those it would only refer to the last time it was run.

@Tyriar
Copy link
Member Author

Tyriar commented Jan 13, 2022

  • Should we share historical commands across shell types since zsh, bash, etc. are similar? Probably not since it's an edge case to commonly use multiple shells.
  • What do we store in historical commands? Just last run time? Exit code is probably not useful, output isn't possible.
    • Need shell type and OS
  • For how long do we keep these records around? A month?
  • We could sync historical commands across machines with the same shell type.
    • Should we share historical commands across OSs? Probably overcomplicating thing and there would be too many issues with path structures differing.
    • Should historical commands have a machine ID if we sync them?
  • Data structure to use? Probably an array sorted by timestamp so it's sorted for the quick pick already and we can trim invalidated items off the end.
  • Let's support removing entries, using a x icon that shows only on active and hovered item
  • Let's not use the x for failed, we can improve visualizing errors later on

@Tyriar
Copy link
Member Author

Tyriar commented Jan 19, 2022

More focused issue: #141006, the command exists and works for commands in the current session.

@Tyriar Tyriar closed this as completed Jan 19, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plan-item VS Code - planned item for upcoming terminal-shell-integration Shell integration, command decorations, etc.
Projects
None yet
Development

No branches or pull requests

2 participants