优化: 文件预览大纲提取 + 预览/图标/滚动条打磨

This commit is contained in:
lxy
2026-08-10 02:23:53 +08:00
parent 40224d603a
commit 2473dcfe68
10 changed files with 905 additions and 58 deletions
+28
View File
@@ -60,6 +60,26 @@ export interface ReadFileResult {
truncated: boolean
}
/** fileOutline 返回的单个顶层符号。 */
export interface OutlineSymbol {
/** 符号名(如匿名 impl 可能为空) */
name: string
/** 定义节点 kind(function_item / class_declaration 等) */
kind: string
/** 定义起始行号(1-based) */
line: number
/** 签名(到首个 { 或 ; 为止) */
signature: string
}
/** fileOutline 返回结构。 */
export interface FileOutlineResult {
path: string
symbols: OutlineSymbol[]
/** 是否为支持语言(不支持时 symbols 为空) */
supported: boolean
}
/** Git 改动文件项(对齐后端 GitChangedFile)。 */
export interface GitChangedFile {
status: string
@@ -149,6 +169,14 @@ export const moduleApi = {
return invoke('read_module_file', { moduleId, filePath })
},
/**
* 提取文件符号概览(顶层定义符号列表,供预览面板做符号树)。
* 不支持的语言返 supported=false + 空 symbols。
*/
fileOutline(moduleId: string, filePath: string): Promise<FileOutlineResult> {
return invoke('file_outline', { moduleId, filePath })
},
/** 查询工程内文件元信息(不读内容,前端检测外部变化用)。返回 { path, size, modified_at }。 */
getModuleFileMeta(moduleId: string, filePath: string): Promise<{ path: string; size: number; modified_at: number }> {
return invoke('get_module_file_meta', { moduleId, filePath })