删除冗余导入,优化代码结构
This commit is contained in:
@@ -49,7 +49,14 @@ pub fn find_claude_binary(app_handle: &tauri::AppHandle) -> Result<String, Strin
|
||||
info!("Found stored claude path in database: {}", stored_path);
|
||||
|
||||
// Check if the path still exists and works
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let final_path = stored_path.clone();
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let path_buf = PathBuf::from(&stored_path);
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let mut final_path = stored_path.clone();
|
||||
#[cfg(target_os = "windows")]
|
||||
let mut path_buf = PathBuf::from(&stored_path);
|
||||
|
||||
// On Windows, if stored path exists but is not executable (shell script), try .cmd version
|
||||
@@ -62,9 +69,9 @@ pub fn find_claude_binary(app_handle: &tauri::AppHandle) -> Result<String, Strin
|
||||
let cmd_path_buf = PathBuf::from(&cmd_path);
|
||||
if cmd_path_buf.exists() {
|
||||
if let Ok(_) = get_claude_version(&cmd_path) {
|
||||
final_path = cmd_path.clone();
|
||||
final_path = cmd_path;
|
||||
path_buf = cmd_path_buf;
|
||||
info!("Using .cmd version instead of shell script: {}", cmd_path);
|
||||
info!("Using .cmd version instead of shell script: {}", final_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ use tauri::{AppHandle, Emitter, State};
|
||||
use tokio::sync::Mutex;
|
||||
use uuid::Uuid;
|
||||
use anyhow::Result;
|
||||
use portable_pty::{native_pty_system, CommandBuilder, PtySize, PtyPair, Child, MasterPty};
|
||||
use portable_pty::{native_pty_system, CommandBuilder, PtySize, Child, MasterPty};
|
||||
use std::io::{Read, Write};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
@@ -45,7 +45,8 @@ import { SplitPane } from "@/components/ui/split-pane";
|
||||
import { WebviewPreview } from "./WebviewPreview";
|
||||
import { FileExplorerPanelEnhanced } from "./FileExplorerPanelEnhanced";
|
||||
import { GitPanelEnhanced } from "./GitPanelEnhanced";
|
||||
import { FileEditorEnhanced } from "./FileEditorEnhanced";
|
||||
// 动态导入 FileEditorEnhanced 以减少初始包大小
|
||||
const FileEditorEnhanced = React.lazy(() => import("./FileEditorEnhanced"));
|
||||
import { SlashCommandsManager } from "./SlashCommandsManager";
|
||||
import type { ClaudeStreamMessage } from "./AgentExecution";
|
||||
import { useVirtualizer } from "@tanstack/react-virtual";
|
||||
@@ -1904,11 +1905,17 @@ export const ClaudeCodeSession: React.FC<ClaudeCodeSessionProps> = ({
|
||||
<div className={cn("h-full w-full", layout.activeView === 'terminal' ? 'hidden' : 'block')}>
|
||||
{layout.activeView === 'editor' && layout.editingFile ? (
|
||||
// 文件编辑器视图
|
||||
<React.Suspense fallback={
|
||||
<div className="flex items-center justify-center h-full">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
|
||||
</div>
|
||||
}>
|
||||
<FileEditorEnhanced
|
||||
filePath={layout.editingFile}
|
||||
onClose={closeFileEditor}
|
||||
className="h-full"
|
||||
/>
|
||||
</React.Suspense>
|
||||
) : layout.activeView === 'preview' && layout.previewUrl ? (
|
||||
// 预览视图
|
||||
<SplitPane
|
||||
|
@@ -51,10 +51,17 @@ export default defineConfig(async () => ({
|
||||
'react-vendor': ['react', 'react-dom'],
|
||||
'ui-vendor': ['@radix-ui/react-dialog', '@radix-ui/react-dropdown-menu', '@radix-ui/react-select', '@radix-ui/react-tabs', '@radix-ui/react-tooltip', '@radix-ui/react-switch', '@radix-ui/react-popover'],
|
||||
'editor-vendor': ['@uiw/react-md-editor'],
|
||||
'monaco-editor': ['monaco-editor', '@monaco-editor/react'],
|
||||
'syntax-vendor': ['react-syntax-highlighter'],
|
||||
// Animation and motion
|
||||
'framer-motion': ['framer-motion'],
|
||||
// Tauri and other utilities
|
||||
'tauri': ['@tauri-apps/api', '@tauri-apps/plugin-dialog', '@tauri-apps/plugin-shell'],
|
||||
'tauri': ['@tauri-apps/api', '@tauri-apps/plugin-dialog', '@tauri-apps/plugin-shell', '@tauri-apps/plugin-fs', '@tauri-apps/plugin-clipboard-manager'],
|
||||
'utils': ['date-fns', 'clsx', 'tailwind-merge'],
|
||||
// Charts and visualization
|
||||
'recharts': ['recharts'],
|
||||
// Virtual scrolling
|
||||
'virtual': ['@tanstack/react-virtual'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user