From bb40406978fc279349f6105b0588e8768e137b23 Mon Sep 17 00:00:00 2001 From: Konv Suu <2583695112@qq.com> Date: Tue, 5 Aug 2025 10:27:51 +0800 Subject: [PATCH 1/2] Refactor import paths to use absolute imports for better readability --- .vscode/settings.json | 7 ++++ src/components/ai-chat/ai-chat-input-bar.tsx | 6 ++-- src/components/ai-chat/ai-chat.tsx | 14 ++++---- src/components/ai-chat/chat-history-modal.tsx | 2 +- .../ai-chat/file-mention-dropdown.tsx | 13 ++++--- src/components/ai-chat/mention-utils.ts | 2 +- src/components/ai-chat/tool-call-display.tsx | 2 +- src/components/ai-chat/types.ts | 4 +-- .../command/components/command-bar.tsx | 12 +++---- .../command/components/command-palette.tsx | 4 +-- .../command/components/theme-selector.tsx | 4 +-- src/components/diff-viewer/diff-header.tsx | 2 +- .../diff-viewer/diff-hunk-header.tsx | 2 +- src/components/diff-viewer/diff-line.tsx | 2 +- src/components/diff-viewer/diff-viewer.tsx | 4 +-- .../diff-viewer/hooks/useDiffData.ts | 20 +++++------ .../diff-viewer/image-diff-viewer.tsx | 2 +- .../diff-viewer/multi-file-diff-viewer.tsx | 2 +- .../diff-viewer/text-diff-viewer.tsx | 2 +- .../diff-viewer/utils/diff-helpers.ts | 2 +- src/components/diff-viewer/utils/types.ts | 2 +- src/components/editor/breadcrumb.tsx | 34 +++++++++---------- src/components/editor/code-editor.tsx | 26 +++++++------- src/components/editor/core/editor-layers.tsx | 2 +- .../editor/core/line-based-editor.tsx | 14 ++++---- src/components/editor/core/text-editor.tsx | 33 ++++++++---------- .../editor/overlays/completion-dropdown.tsx | 12 +++---- src/components/editor/overlays/cursor.tsx | 6 ++-- .../editor/overlays/decoration-layer.tsx | 14 ++++---- .../editor/overlays/editor-context-menu.tsx | 2 +- .../editor/overlays/hover-tooltip.tsx | 6 ++-- .../editor/rendering/editor-viewport.tsx | 12 +++---- .../editor/rendering/line-gutter.tsx | 4 +-- .../editor/rendering/line-renderer.tsx | 2 +- .../editor/rendering/line-with-content.tsx | 2 +- src/components/git/git-actions-menu.tsx | 4 +-- src/components/git/git-branch-manager.tsx | 8 +---- src/components/git/git-commit-history.tsx | 4 +-- src/components/git/git-commit-panel.tsx | 4 +-- src/components/git/git-remote-manager.tsx | 2 +- src/components/git/git-stash-manager.tsx | 2 +- src/components/git/git-status-panel.tsx | 2 +- src/components/git/git-tag-manager.tsx | 2 +- src/components/git/git-view.tsx | 6 ++-- src/components/image-viewer/image-viewer.tsx | 2 +- src/components/layout/main-layout.tsx | 20 +++++------ src/components/layout/main-sidebar.tsx | 16 ++++----- .../layout/sidebar-pane-selector.tsx | 2 +- src/components/remote/connection-list.tsx | 2 +- .../remote/remote-connection-view.tsx | 2 +- .../resizable-sidebar/resizable-sidebar.css | 4 +-- .../resizable-sidebar/resizable-sidebar.tsx | 2 +- src/components/tab-bar/tab-bar-item.tsx | 6 ++-- src/components/tab-bar/tab-bar.tsx | 6 ++-- src/components/tab-bar/tab-context-menu.tsx | 2 +- src/components/tab-bar/tab-drag-preview.tsx | 4 +-- .../terminal/terminal-container.tsx | 4 +-- src/components/terminal/terminal-search.tsx | 2 +- src/components/terminal/terminal-session.tsx | 2 +- src/components/terminal/terminal-tab-bar.tsx | 4 +-- src/components/terminal/terminal.tsx | 10 +++--- src/components/ui/button.tsx | 2 +- src/components/ui/dropdown.tsx | 2 +- src/components/ui/input.tsx | 2 +- src/components/ui/keybinding-badge.tsx | 2 +- src/components/ui/section.tsx | 2 +- src/components/ui/switch.tsx | 2 +- src/components/ui/toggle.tsx | 2 +- .../views/file-tree-custom-dnd.tsx | 6 ++-- src/file-explorer/views/file-tree.tsx | 12 +++---- src/file-system/controllers/store.ts | 22 ++++++------ src/file-system/models/interface.ts | 2 +- .../components/tabs/editor-settings.tsx | 2 +- .../components/tabs/general-settings.tsx | 2 +- .../components/tabs/theme-settings.tsx | 8 ++--- src/settings/stores/settings-store.ts | 2 +- src/stores/ai-chat/store.ts | 8 ++--- src/stores/ai-chat/types.ts | 4 +-- 78 files changed, 241 insertions(+), 244 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..dcac4fed1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "quickFix.biome": "explicit", + "source.organizeImports.biome": "explicit" + }, +} diff --git a/src/components/ai-chat/ai-chat-input-bar.tsx b/src/components/ai-chat/ai-chat-input-bar.tsx index a2209860c..16df5cbd7 100644 --- a/src/components/ai-chat/ai-chat-input-bar.tsx +++ b/src/components/ai-chat/ai-chat-input-bar.tsx @@ -1,9 +1,9 @@ import { ChevronDown, Database, FileText, Send, Square, X } from "lucide-react"; import type React from "react"; import { useCallback, useEffect, useRef } from "react"; -import { usePersistentSettingsStore } from "../../settings/stores/persistent-settings-store"; -import { useAIChatStore } from "../../stores/ai-chat/store"; -import { cn } from "../../utils/cn"; +import { usePersistentSettingsStore } from "@/settings/stores/persistent-settings-store"; +import { useAIChatStore } from "@/stores/ai-chat/store"; +import { cn } from "@/utils/cn"; import ModelProviderSelector from "../model-provider-selector"; import Button from "../ui/button"; import { FileMentionDropdown } from "./file-mention-dropdown"; diff --git a/src/components/ai-chat/ai-chat.tsx b/src/components/ai-chat/ai-chat.tsx index 728d3519d..45dffec6b 100644 --- a/src/components/ai-chat/ai-chat.tsx +++ b/src/components/ai-chat/ai-chat.tsx @@ -2,17 +2,17 @@ import { invoke } from "@tauri-apps/api/core"; import { MessageSquare, Plus, Sparkles } from "lucide-react"; import type React from "react"; import { useCallback, useEffect, useRef } from "react"; -import { usePersistentSettingsStore } from "../../settings/stores/persistent-settings-store"; -import { useAIChatStore } from "../../stores/ai-chat/store"; -import { useProjectStore } from "../../stores/project-store"; +import { usePersistentSettingsStore } from "@/settings/stores/persistent-settings-store"; +import { useAIChatStore } from "@/stores/ai-chat/store"; +import { useProjectStore } from "@/stores/project-store"; import { getAvailableProviders, getProviderById, setClaudeCodeAvailability, -} from "../../types/ai-provider"; -import type { ClaudeStatus } from "../../types/claude"; -import { getChatCompletionStream } from "../../utils/ai-chat"; -import { cn } from "../../utils/cn"; +} from "@/types/ai-provider"; +import type { ClaudeStatus } from "@/types/claude"; +import { getChatCompletionStream } from "@/utils/ai-chat"; +import { cn } from "@/utils/cn"; import ApiKeyModal from "../api-key-modal"; import AIChatInputBar from "./ai-chat-input-bar"; import ChatHistoryModal from "./chat-history-modal"; diff --git a/src/components/ai-chat/chat-history-modal.tsx b/src/components/ai-chat/chat-history-modal.tsx index b6aab9b20..3b54fa9ed 100644 --- a/src/components/ai-chat/chat-history-modal.tsx +++ b/src/components/ai-chat/chat-history-modal.tsx @@ -1,6 +1,6 @@ import { MessageSquare, Search, Trash2, X } from "lucide-react"; import { useState } from "react"; -import { cn } from "../../utils/cn"; +import { cn } from "@/utils/cn"; import type { ChatHistoryModalProps } from "./types"; import { getRelativeTime } from "./utils"; diff --git a/src/components/ai-chat/file-mention-dropdown.tsx b/src/components/ai-chat/file-mention-dropdown.tsx index cc757c650..02a52100f 100644 --- a/src/components/ai-chat/file-mention-dropdown.tsx +++ b/src/components/ai-chat/file-mention-dropdown.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useMemo, useRef } from "react"; -import FileIcon from "../../file-explorer/views/file.icon"; -import type { FileEntry } from "../../file-system/models/app"; -import { useAIChatStore } from "../../stores/ai-chat/store"; -import { useProjectStore } from "../../stores/project-store"; +import FileIcon from "@/file-explorer/views/file.icon"; +import type { FileEntry } from "@/file-system/models/app"; +import { useAIChatStore } from "@/stores/ai-chat/store"; +import { useProjectStore } from "@/stores/project-store"; interface FileMentionDropdownProps { files: FileEntry[]; @@ -141,9 +141,8 @@ export const FileMentionDropdown = React.memo(function FileMentionDropdown({ {filteredFiles.map((file, index) => (