#18031·theia

AI Chat: scroll position is not preserved when switching chat sessions

Author: safisaCreated Sep 16, 2026Updated Sep 16, 2026

Feature Description:

Switching between AI chat sessions always lands at the bottom of the session. If you were reading somewhere in the middle of a session, that position is lost as soon as you switch away and back.

Current behaviour:

  • ChatViewTreeWidget.getScrollToRow() returns this.rows.size whenever auto-scroll is unlocked, so every trackChatModel() (i.e. every session switch) scrolls to the last row.
  • If auto-scroll happens to be locked (you scrolled up before switching), getScrollToRow() returns undefined and the virtualized list keeps the previous session's raw scrollTop — the new session then opens at an arbitrary offset. Scroll lock is per-widget, not per-session.
  • Nothing persists a scroll position: ChatViewWidget.State only holds locked / temporaryLocked.

Proposal: remember a per-session scroll position (top visible row index) and restore it when the session becomes active again, optionally persisting it with the widget state so it survives a reload. Making the scroll lock per-session would address the second point.

This is most valuable when the chat view is extracted into a standalone window and used alongside the editor: there, sessions are browsed and revisited like open documents, so losing the reading position on every switch is much more noticeable.