microsoft / microsoft/terminal
Suggestions: Add scroll back as suggestion source.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
### Description of the new feature
This is based on Vim's out of the box completions where it sources the options from words in the open buffers. In this case it would pull the options from the active terminal buffer.
The case where I have found this really useful is when I have run a command that returns some data and now want to use part of the result in my next command. Ex. After running git log, running an additional command on one of the hashes and being able to auto complete it. Or After running --help on a command and then being able to auto complete the options.
Being able to define a regex for the filter was really useful to be able to have targeted completions for common stuff (hashes, addresses, command line flags) and then a catch all "default" one for words with > 4 chars.
Example Config.
```json
{
"command":
{
"action": "showSuggestions",
"source": "scrollback",
"regex": "[^\\s]{5,}"
},
"id": "User.showSuggestions.2F7A7303"
},
{
"command":
{
"action": "showSuggestions",
"source": "scrollback",
"regex": "-{1,2}\\w(?:[\\w+|-])+"
},
"id": "User.showSuggestions.2F7A7304"
},
{
"command":
{
"action": "showSuggestions",
"source": "scrollback",
"regex": "\\b(?:0x)?[0-9A-Fa-f]{8,16}(?:`[0-9A-Fa-f]{1,16})?|\\b[0-9A-Fa-f]{7,40}\\b"
},
"id": "User.showSuggestions.2F7A7305"
},
```
This what it looked like when I was testing what I had hacked together locally.
https://github.com/user-attachments/assets/7719493f-a5f0-43c2-a4f1-bfb4505d8e86
### Proposed technical implementation details
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing showSuggestions command and its configuration handling, then trace how terminal scrollback is exposed. Define how the scrollback source and optional regex should behave, using the provided examples as acceptance cases; the feature is done when those configured suggestion sources work in the terminal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100