fix - stale code block height during incremental chat layout by xinyi-gong · Pull Request #343 · microsoft/copilot-for-eclipse · GitHub
Skip to content

fix - stale code block height during incremental chat layout - #343

Merged
Sheng Chen (jdneo) merged 3 commits into
mainfrom
tori/codeblock
Jul 9, 2026
Merged

Sheng Chen (jdneo) merged 3 commits into
mainfrom
tori/codeblock

Conversation

@xinyi-gong

Copy link
Copy Markdown
Member

Summary

  • Add a computeSize(...) override for SourceViewerComposite so code block height is measured synchronously from the current StyledText content.
  • Reuse a shared height helper in both measurement and async bounds refresh to keep scrollbar-height handling consistent.
  • Prevent incremental chat layout from caching stale code block heights while large code blocks are still waiting for async setBounds(...).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves chat code-block layout stability by ensuring SourceViewerComposite reports an up-to-date height synchronously (via computeSize(...)), reducing the chance that incremental chat layout caches stale code-block heights while async setBounds(...) is pending.

Changes:

  • Override computeSize(...) in SourceViewerComposite to measure height directly from the current StyledText content.
  • Factor out a shared getSourceViewerHeight(...) helper and reuse it in refreshScrollerLayout() for consistent scrollbar-height handling.

@jdneo

Copy link
Copy Markdown
Member

@xinyi-gong

Copy link
Copy Markdown
Member Author

@jdneo Sheng Chen (jdneo) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jdneo
Sheng Chen (jdneo) merged commit 65db401 into main Jul 9, 2026
4 checks passed
@jdneo
Sheng Chen (jdneo) deleted the tori/codeblock branch July 9, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants