feat: implement terminal command AI Variable#17312
feat: implement terminal command AI Variable#17312Fangoling wants to merge 5 commits intoeclipse-theia:masterfrom
Conversation
- stores a command and its corresponding output - a specific command can be adressed via an index or chosen in the arguments picker - falls back to last executed command when no index is passed - when command history is disable return the last 50 lines Signed-off-by: Fangxing Liu <fx.liu@tum.de>
Signed-off-by: Fangxing Liu <fx.liu@tum.de>
Signed-off-by: Fangxing Liu <fx.liu@tum.de>
|
What is the use case for this, especially with the variable? |
This is a building block for #17308 which adds per-block command actions to the terminal. The primary use case would be passing the context of a terminal block directly to the ai chat mirroring the functionality of the
Currently the terminal variable is passed in as plain text and it would be nice to hide this behind the abstraction of an AI variable. The selection of the terminal command directly in the chat input window is just a nice to have. The toolcall usecase is also good point, I can create an issue for this. |
eneufeld
left a comment
There was a problem hiding this comment.
Looks good to me overall and works great.
I left some comment. The missing disposal is the main missing one.
…ck variable - Return undefined instead of an empty string when the terminal buffer is empty (no command history state) - Replace parseInt with Number(...trim()) for arg parsing and add full index validation (NaN, non-integer, out-of-bounds) to prevent silent invalid lookups - Format resolved variable value with markdown headings for clearer AI context - Normalize whitespace in quick pick descriptions before truncating to avoid multi-line output in the picker - Fix quickPick.dispose() placement so it always runs on accept (not only on successful selection) and also runs on hide Signed-off-by: Fangxing Liu <fx.liu@tum.de>
|
I also adjusted the 'prompt' on how the command and output are passed to the terminal. They are now passed in this shape: |
Signed-off-by: Fangxing Liu <fx.liu@tum.de>
What it does
This PR builds on top of #16732.
This PR introduces a new AI Variable that allows the user to target a specific command in their last used terminal.
If the experimental command history preference is disabled, this ai variable will return the last 50 lines of the terminal buffer.
ai-variable-terminal-1775517866896.mp4
How to test
Terminal › Integrated: Enable Command History#terminalCommandAI Variable in the AI Chat and choose a terminal command via the arguments pickerFollow-ups
Breaking changes
Attribution
Review checklist
nlsservice (for details, please see the Internationalization/Localization section in the Coding Guidelines)Reminder for reviewers