feat(ui): 实现 LSP UI 集成
- 添加 LSP 相关类型定义 (LSPServer, FileDiagnostic, DiagnosticsResponse) - 添加 LSP API 函数 (listLSPServers, installLSPServer, startLSPServer 等) - 创建 LSPPanel 组件: 语言服务器管理面板 - 创建 DiagnosticsPanel 组件: 诊断详情面板 (含搜索过滤) - 创建 DiagnosticsIndicator 组件: 状态栏指示器 - 集成到 Web 模块 (App.tsx, Chat.tsx)
This commit is contained in:
@@ -14,6 +14,8 @@ import {
|
||||
AgentsPanel,
|
||||
CheckpointPanel,
|
||||
ProvidersPanel,
|
||||
LSPPanel,
|
||||
DiagnosticsPanel,
|
||||
Toaster,
|
||||
ThemeProvider,
|
||||
listSessions,
|
||||
@@ -33,6 +35,8 @@ export function App() {
|
||||
const [showAgents, setShowAgents] = useState(false);
|
||||
const [showCheckpoints, setShowCheckpoints] = useState(false);
|
||||
const [showProviders, setShowProviders] = useState(false);
|
||||
const [showLSP, setShowLSP] = useState(false);
|
||||
const [showDiagnostics, setShowDiagnostics] = useState(false);
|
||||
const [sessionTitleUpdate, setSessionTitleUpdate] = useState<{ sessionId: string; name: string } | null>(null);
|
||||
const [workingDirectory, setWorkingDirectory] = useState<string>('');
|
||||
|
||||
@@ -147,6 +151,8 @@ export function App() {
|
||||
onOpenAgents={() => setShowAgents(true)}
|
||||
onOpenCheckpoints={() => setShowCheckpoints(true)}
|
||||
onOpenProviders={() => setShowProviders(true)}
|
||||
onOpenLSP={() => setShowLSP(true)}
|
||||
onOpenDiagnostics={() => setShowDiagnostics(true)}
|
||||
workingDirectory={workingDirectory}
|
||||
/>
|
||||
) : (
|
||||
@@ -211,6 +217,30 @@ export function App() {
|
||||
{/* Providers 面板 */}
|
||||
{showProviders && <ProvidersPanel onClose={() => setShowProviders(false)} responsive />}
|
||||
|
||||
{/* LSP 面板 */}
|
||||
{showLSP && (
|
||||
<LSPPanel
|
||||
onClose={() => setShowLSP(false)}
|
||||
onOpenDiagnostics={() => {
|
||||
setShowLSP(false);
|
||||
setShowDiagnostics(true);
|
||||
}}
|
||||
responsive
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Diagnostics 面板 */}
|
||||
{showDiagnostics && (
|
||||
<DiagnosticsPanel
|
||||
onClose={() => setShowDiagnostics(false)}
|
||||
onFileClick={(file, line) => {
|
||||
console.log('Navigate to:', file, line);
|
||||
// TODO: Integrate with file browser or editor
|
||||
}}
|
||||
responsive
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* 移动端底部文件按钮 */}
|
||||
<button
|
||||
onClick={() => setShowFileBrowser(true)}
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
PermissionDialog,
|
||||
ContextUsage,
|
||||
SubagentProgress,
|
||||
DiagnosticsIndicator,
|
||||
} from '@ai-assistant/ui';
|
||||
|
||||
interface ChatPageProps {
|
||||
@@ -30,6 +31,8 @@ interface ChatPageProps {
|
||||
onOpenAgents?: () => void;
|
||||
onOpenCheckpoints?: () => void;
|
||||
onOpenProviders?: () => void;
|
||||
onOpenLSP?: () => void;
|
||||
onOpenDiagnostics?: () => void;
|
||||
// Working Directory
|
||||
workingDirectory?: string;
|
||||
}
|
||||
@@ -47,6 +50,8 @@ export function ChatPage({
|
||||
onOpenAgents,
|
||||
onOpenCheckpoints,
|
||||
onOpenProviders,
|
||||
onOpenLSP,
|
||||
onOpenDiagnostics,
|
||||
workingDirectory,
|
||||
}: ChatPageProps) {
|
||||
const {
|
||||
@@ -184,8 +189,17 @@ export function ChatPage({
|
||||
<ConnectionStatus />
|
||||
|
||||
{/* 工具栏按钮 */}
|
||||
{(onToggleFileBrowser || onOpenCommands || onOpenMCP || onOpenHooks || onOpenAgents || onOpenCheckpoints || onOpenProviders) && (
|
||||
{(onToggleFileBrowser || onOpenCommands || onOpenMCP || onOpenHooks || onOpenAgents || onOpenCheckpoints || onOpenProviders || onOpenLSP || onOpenDiagnostics) && (
|
||||
<div className="flex items-center gap-1.5 border-l border-line-muted pl-3">
|
||||
{/* LSP 诊断指示器 */}
|
||||
{(onOpenLSP || onOpenDiagnostics) && (
|
||||
<DiagnosticsIndicator
|
||||
onClickDiagnostics={onOpenDiagnostics}
|
||||
onClickLSP={onOpenLSP}
|
||||
refreshInterval={30000}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Checkpoints 按钮 */}
|
||||
{onOpenCheckpoints && (
|
||||
<motion.button
|
||||
|
||||
Reference in New Issue
Block a user