spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / hooks / views / dialog-pane / list-body-of / list-body-of.ts
43 lines · 1.1 KBRaw
1import type Git from '../../../git'
2import type { ListPlace } from './list-place'
3
4/**
5 * The list's body as ReplDiffSidebarBody decides it: the empty state's
6 * hint, the too-many state, the only-noise state, or the session's rows.
7 *
8 * Strings are dim lines; rows are files to draw.
9 *
10 * @param place the fetch, its groups, the counts, the empty state
11 * @returns the lines and rows, in order
12 */
13export function listBodyOf(
14 place: ListPlace,
15): readonly (string | Git.FileStat)[] {
16 const { data, partition, totals, empty } = place
17
18 const hint = empty?.hint ?? null
19
20 if (empty) {
21 return hint === null ? [] : [hint]
22 }
23
24 const isTooMany =
25 data !== null && data.files.length === 0 && totals.filesCount > 0
26
27 if (isTooMany) {
28 return [
29 'Too many changed files to show diff',
30 'Per-file diff is skipped above 500 files',
31 ]
32 }
33
34 const isOnlyNoise = partition.shown.length === 0 && partition.noiseCount > 0
35
36 return isOnlyNoise
37 ? [
38 'Only tests and generated files changed',
39 'Tests and generated files are hidden · click "show" above to view ' +
40 'them',
41 ]
42 : partition.shown
43}