mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-21 15:55:50 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import * as React from 'react'
|
||||
import { Box, Text } from '@anthropic/ink'
|
||||
import { Select } from '../CustomSelect/select.js'
|
||||
import { PermissionDialog } from '../permissions/PermissionDialog.js'
|
||||
import * as React from 'react';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { Select } from '../CustomSelect/select.js';
|
||||
import { PermissionDialog } from '../permissions/PermissionDialog.js';
|
||||
|
||||
type Props = {
|
||||
pluginName: string
|
||||
pluginDescription?: string
|
||||
fileExtension: string
|
||||
onResponse: (response: 'yes' | 'no' | 'never' | 'disable') => void
|
||||
}
|
||||
pluginName: string;
|
||||
pluginDescription?: string;
|
||||
fileExtension: string;
|
||||
onResponse: (response: 'yes' | 'no' | 'never' | 'disable') => void;
|
||||
};
|
||||
|
||||
const AUTO_DISMISS_MS = 30_000
|
||||
const AUTO_DISMISS_MS = 30_000;
|
||||
|
||||
export function LspRecommendationMenu({
|
||||
pluginName,
|
||||
@@ -19,33 +19,29 @@ export function LspRecommendationMenu({
|
||||
onResponse,
|
||||
}: Props): React.ReactNode {
|
||||
// Use ref to avoid timer reset when onResponse changes
|
||||
const onResponseRef = React.useRef(onResponse)
|
||||
onResponseRef.current = onResponse
|
||||
const onResponseRef = React.useRef(onResponse);
|
||||
onResponseRef.current = onResponse;
|
||||
|
||||
// 30-second auto-dismiss timer - counts as ignored (no)
|
||||
React.useEffect(() => {
|
||||
const timeoutId = setTimeout(
|
||||
ref => ref.current('no'),
|
||||
AUTO_DISMISS_MS,
|
||||
onResponseRef,
|
||||
)
|
||||
return () => clearTimeout(timeoutId)
|
||||
}, [])
|
||||
const timeoutId = setTimeout(ref => ref.current('no'), AUTO_DISMISS_MS, onResponseRef);
|
||||
return () => clearTimeout(timeoutId);
|
||||
}, []);
|
||||
|
||||
function onSelect(value: string): void {
|
||||
switch (value) {
|
||||
case 'yes':
|
||||
onResponse('yes')
|
||||
break
|
||||
onResponse('yes');
|
||||
break;
|
||||
case 'no':
|
||||
onResponse('no')
|
||||
break
|
||||
onResponse('no');
|
||||
break;
|
||||
case 'never':
|
||||
onResponse('never')
|
||||
break
|
||||
onResponse('never');
|
||||
break;
|
||||
case 'disable':
|
||||
onResponse('disable')
|
||||
break
|
||||
onResponse('disable');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,16 +70,13 @@ export function LspRecommendationMenu({
|
||||
label: 'Disable all LSP recommendations',
|
||||
value: 'disable',
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
return (
|
||||
<PermissionDialog title="LSP Plugin Recommendation">
|
||||
<Box flexDirection="column" paddingX={2} paddingY={1}>
|
||||
<Box marginBottom={1}>
|
||||
<Text dimColor>
|
||||
LSP provides code intelligence like go-to-definition and error
|
||||
checking
|
||||
</Text>
|
||||
<Text dimColor>LSP provides code intelligence like go-to-definition and error checking</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text dimColor>Plugin:</Text>
|
||||
@@ -102,13 +95,9 @@ export function LspRecommendationMenu({
|
||||
<Text>Would you like to install this LSP plugin?</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Select
|
||||
options={options}
|
||||
onChange={onSelect}
|
||||
onCancel={() => onResponse('no')}
|
||||
/>
|
||||
<Select options={options} onChange={onSelect} onCancel={() => onResponse('no')} />
|
||||
</Box>
|
||||
</Box>
|
||||
</PermissionDialog>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user