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