Skip to content

Code browsing: project file tree and read-only file viewer #501

Description

@Tryanks

Idea

Add code browsing to the active project: a file tree for the project root and a read-only viewer that opens any file with syntax highlighting, line numbers, and a way to jump to a line or range. The viewer is a plain view of the working tree as it is on disk; it does not edit, and it does not interpret the agent's activity (that is a separate exploration, see the follow-up issue linked below).

Why

Today the only way to see project code inside Tcode is through what the agent shows: a command's output, an edit's diff hunk, or the finished-turn changed-files summary that opens a diff. There is no way to open an arbitrary file, look at surrounding context, or navigate the tree. Every client is a screen for the host (Principle 2), so browsing has to be served by the host and work the same on desktop, phone, tablet and browser; a phone reviewing a remote machine's code is the main case where an external editor is not available.

Scope

  • A file tree for the project root, lazily listed by the host, respecting .gitignore for the default view with a toggle to show ignored files.
  • A file viewer for text files: syntax highlighting through the existing syntect setup in crates/ui/src/highlight.rs, line numbers, wrapping toggle, and a "go to line / range" entry point other surfaces can call. Binary and very large files get a placeholder, not a render attempt.
  • A protocol addition so remote clients read tree listings and file contents from the host, with size caps; nothing is read outside the project root.
  • Entry points: a sidebar item per project, and the existing file links in the changed-files summary and diff panel open the file in the viewer at the relevant line.

Out of scope: editing, search across files, live following of the agent (follow-up issue), and anything that changes what the model sees or does (Principle 1).

Open questions

  • Where the viewer lives in the shell: a tab next to the diff panel and preview panel, or a pane inside the thread view. Phone geometry decides this; check it with cargo run -p tcode-ui --example phone.
  • Whether the tree stays cached on the host per project and invalidated by a watcher, or is listed on every expand.

Code context

Reviewed against main at 9a64fbae (2026-09-22).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions