[TBB] Thinking block UI improvements: Label title, collapse timing, height cap, and section parsing fix#191
Merged
Merged
Conversation
e78e353 to
fda550b
Compare
fda550b to
de108f5
Compare
de108f5 to
599bdd2
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the “Thinking” block UX in the chat UI by reducing header rendering overhead, making completion/collapse behavior more responsive, capping streaming height with scroll support, and fixing section parsing that could create “ghost” sections during streaming.
Changes:
- Replaced the thinking header title rendering with a lightweight
Label(instead ofChatMarkupViewer) and kept chat font synchronization. - Collapses the thinking block immediately on seal, adds a streaming-only height cap via
ScrolledCompositewith auto-scroll behavior, and unwraps the scroller on seal/cancel. - Fixes section title parsing to require
**Title**to be at line start; adds unit tests covering inline-bold and boundary cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ThinkingTurnWidget.java | Updates seal/title-finalization flow and adds an exception fallback for title generation failures. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ThinkingBlock.java | Swaps header title to Label, adds streaming scroller/height cap + auto-scroll, collapses on seal, and tightens section title parsing. |
| com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/ThinkingBlockParseTest.java | Adds regression tests for inline-bold parsing and title-at-start behavior. |
ethanyhou
reviewed
May 14, 2026
Contributor
ethanyhou
left a comment
There was a problem hiding this comment.
Overall a solid improvement. Just some nit comments. Thanks!
jdneo
approved these changes
May 14, 2026
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Use Label instead of ChatMarkupViewer for thinking block header title
ChatMarkupViewerwith a lightweight SWTLabelfor the ThinkingBlock header title ("Thinking...", "Thinking completed", etc.)ChatMarkupViewer(which initializes a full Markdown parser, hyperlink detectors, and CSS stylesheets) is unnecessary overheadChatFontServiceto keep chat font synchronizationSWT.WRAPandupdateTitleWidthHint()to handle long titles correctly on resizeResolves #178
Fix title generation fallback showing "cancelled" instead of "completed"
thinking/generateTitlereturns empty or fails, the thinking block previously showed "Thinking cancelled" — but the thinking itself completed successfully, only the title generation failedshowCompleted("Thinking completed")instead ofshowCancelled().exceptionally()handler to catch request errors, preventing the block from getting stuck in SEALED stateBefore:

After:

Collapse thinking block immediately when thinking ends
Previously, the thinking block stayed expanded until the thinking title generation response arrived, which could take several seconds. During this gap the block showed "Thinking completed" but remained open, which felt unresponsive.
Now the block collapses as soon as thinking output stops.
Cap thinking body height during streaming with auto-scroll
During streaming, the thinking block body is now wrapped in a ScrolledComposite with a max height of 180px. This prevents long thinking output from pushing the chat view unboundedly downward.
Fix ghost section from inline bold at streaming fragment boundary
Fixed a bug where inline bold text (e.g. combined with The Ship of Theseus and its...) could appear as a spurious section title with a bullet point at the end of the thinking block.

Root cause: TITLE_PATTERN required Title to be followed by \n or end-of-string ($), but did not require it to be at the start of a line. When a streaming fragment happened to end right after The Ship of Theseus, the $ anchor matched the buffer end, creating a ghost ThinkingSection. Subsequent fragments appended more text, making the match disappear — but the widget was never cleaned up.
Fix: Added (?:^|\n) anchor to require Title to appear at line start or string start. Added unit tests covering inline bold, mixed inline+standalone, and title-at-start scenarios.