mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 00:05:51 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import * as React from 'react'
|
||||
import { Text } from '@anthropic/ink'
|
||||
import { count } from '../utils/array.js'
|
||||
import { MessageResponse } from './MessageResponse.js'
|
||||
import * as React from 'react';
|
||||
import { Text } from '@anthropic/ink';
|
||||
import { count } from '../utils/array.js';
|
||||
import { MessageResponse } from './MessageResponse.js';
|
||||
|
||||
type Props = {
|
||||
filePath: string
|
||||
structuredPatch: { lines: string[] }[]
|
||||
style?: 'condensed'
|
||||
verbose: boolean
|
||||
previewHint?: string
|
||||
}
|
||||
filePath: string;
|
||||
structuredPatch: { lines: string[] }[];
|
||||
style?: 'condensed';
|
||||
verbose: boolean;
|
||||
previewHint?: string;
|
||||
};
|
||||
|
||||
export function FileEditToolUpdatedMessage({
|
||||
filePath,
|
||||
@@ -18,32 +18,24 @@ export function FileEditToolUpdatedMessage({
|
||||
verbose,
|
||||
previewHint,
|
||||
}: Props): React.ReactNode {
|
||||
const numAdditions = structuredPatch.reduce(
|
||||
(acc, hunk) => acc + count(hunk.lines, _ => _.startsWith('+')),
|
||||
0,
|
||||
)
|
||||
const numRemovals = structuredPatch.reduce(
|
||||
(acc, hunk) => acc + count(hunk.lines, _ => _.startsWith('-')),
|
||||
0,
|
||||
)
|
||||
const numAdditions = structuredPatch.reduce((acc, hunk) => acc + count(hunk.lines, _ => _.startsWith('+')), 0);
|
||||
const numRemovals = structuredPatch.reduce((acc, hunk) => acc + count(hunk.lines, _ => _.startsWith('-')), 0);
|
||||
|
||||
const text = (
|
||||
<Text>
|
||||
{numAdditions > 0 ? (
|
||||
<>
|
||||
Added <Text bold>{numAdditions}</Text>{' '}
|
||||
{numAdditions > 1 ? 'lines' : 'line'}
|
||||
Added <Text bold>{numAdditions}</Text> {numAdditions > 1 ? 'lines' : 'line'}
|
||||
</>
|
||||
) : null}
|
||||
{numAdditions > 0 && numRemovals > 0 ? ', ' : null}
|
||||
{numRemovals > 0 ? (
|
||||
<>
|
||||
{numAdditions === 0 ? 'R' : 'r'}emoved <Text bold>{numRemovals}</Text>{' '}
|
||||
{numRemovals > 1 ? 'lines' : 'line'}
|
||||
{numAdditions === 0 ? 'R' : 'r'}emoved <Text bold>{numRemovals}</Text> {numRemovals > 1 ? 'lines' : 'line'}
|
||||
</>
|
||||
) : null}
|
||||
</Text>
|
||||
)
|
||||
);
|
||||
|
||||
// Plan files: invert condensed behavior
|
||||
// - Regular mode: just show the hint (user can type /plan to see full content)
|
||||
@@ -54,13 +46,11 @@ export function FileEditToolUpdatedMessage({
|
||||
<MessageResponse>
|
||||
<Text dimColor>{previewHint}</Text>
|
||||
</MessageResponse>
|
||||
)
|
||||
);
|
||||
}
|
||||
} else if (style === 'condensed' && !verbose) {
|
||||
return text
|
||||
return text;
|
||||
}
|
||||
|
||||
return (
|
||||
<MessageResponse>{text}</MessageResponse>
|
||||
)
|
||||
return <MessageResponse>{text}</MessageResponse>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user