✨ feat(vscode): 代码阅读支持 Dockerfile:解析指令、每个 FROM 一个阶段(阶段名能跳过去)、RUN 交给 shell 按命令拆、复制、构建参数 / 环境变量、设置、标签、健康检查、启动,连着写的 ENV / ARG / COPY / LABEL 并成一块加一张表;语法包取自 npm 包 tree-sitter-wasm,打包时复制进扩展

This commit is contained in:
cruldra committed 2026-09-28 11:54:01 +08:00
1 parent 0665f35821
commit d4ec0e7de4
11 files changed
+1619 -4

No files matched your search

+7 -1
View File
@@ -3,7 +3,9 @@ import type { CodeReaderApi, RuleLocation, RuleReference } from './contract'
import type { IndexedName } from './nameResolution'
import { commands, window, workspace } from 'vscode'
import { logger } from '../logging/logger'
import { packageCommandRules } from './commands/packageCommands'
import { shellCommandRules } from './commands/shellCommands'
import { systemCommandRules } from './commands/systemCommands'
import { BlockFilter } from './editor/blockFilter'
import { NEXT_OCCURRENCE, PREVIOUS_OCCURRENCE } from './editor/occurrenceNavigation'
import { PREVIEW_VIEW_TYPE, PreviewEditorProvider } from './editor/previewEditor'
@@ -11,6 +13,7 @@ import { showPreview, showSource } from './editor/switchEditor'
import { registerCopyCommands } from './explorer/copyCommands'
import { FileTreeProvider } from './explorer/fileTree'
import { createBashAdapter } from './languages/bash'
import { createDockerfileAdapter } from './languages/dockerfile'
import { createPythonAdapter } from './languages/python'
import { createTypeScriptAdapter } from './languages/typescript'
import { resolveReference } from './libraryRules'
@@ -27,6 +30,7 @@ import { fastapiRule } from './rules/fastapi'
import { sqlalchemyRule } from './rules/sqlalchemy'
import { bundledWasmDir, TreeSitterRuntime } from './runtime'
import { bashZhTranslator } from './translators/bashZh'
import { dockerfileZhTranslator } from './translators/dockerfileZh'
import { pythonZhTranslator } from './translators/pythonZh'
import { typescriptZhTranslator } from './translators/typescriptZh'
import { workspaceIndexHost } from './workspaceFiles'
@@ -115,10 +119,12 @@ export function registerCodeReader(context: ExtensionContext): CodeReaderApi {
api.registerLanguage(createTypeScriptAdapter(wasmDir)),
api.registerLanguage(createPythonAdapter(wasmDir)),
api.registerLanguage(createBashAdapter(wasmDir)),
api.registerLanguage(createDockerfileAdapter(wasmDir)),
api.registerTranslator(typescriptZhTranslator),
api.registerTranslator(pythonZhTranslator),
api.registerTranslator(bashZhTranslator),
...shellCommandRules.map(rule => api.registerCommandRule(rule)),
api.registerTranslator(dockerfileZhTranslator),
...[...shellCommandRules, ...systemCommandRules, ...packageCommandRules].map(rule => api.registerCommandRule(rule)),
api.registerLibraryRule(sqlalchemyRule),
api.registerLibraryRule(celeryRule),
api.registerLibraryRule(enumRule),