Cấu trúc thư mục gốc

← Về MOC · Trước: Tổng quan: Code - OSS và Visual Studio Code

1. Bảng tổng hợp

Thư mục / fileVai tròĐọc thêm
src/Mã nguồn lõi (core) bằng TypeScript. Unit test nằm trong src/vs/**/test/Kiến trúc phân lớp (Layers)
src/vs/Các lớp base, platform, editor, workbench, code, server, sessionsKiến trúc phân lớp (Layers)
src/vscode-dts/File khai báo kiểu (type declaration) của Extension API: vscode.d.ts (~21.000 dòng) và ~180 file vscode.proposed.*.d.ts (API đề xuất)Extension Host & RPC
src/main.ts, src/mainImpl.tsĐiểm vào (entry point) của tiến trình Electron mainLuồng khởi động (Startup flow)
src/bootstrap-*.tsMã “mồi” (bootstrap) khởi tạo môi trường ESM, Node, server…Luồng khởi động (Startup flow)
extensions/97 built-in extension đi kèm sản phẩm (ngôn ngữ, theme, git, copilot…)Built-in Extensions – extension tích hợp sẵn
cli/Công cụ dòng lệnh code viết bằng Rust (dùng cho tunnel, server…)Build & Run từ mã nguồn
build/Script build: gulpfile.*.ts, thư mục next/ (build nhanh), checker/ (kiểm tra phân lớp), azure-pipelines/ (CI)Build & Run từ mã nguồn
scripts/Script tiện ích: code.sh (chạy bản dev), test.sh (unit test), code-web.sh, code-server.sh…Build & Run từ mã nguồn
test/Test tích hợp (integration/), smoke test (smoke/), runner unit test (unit/), MCP test…Testing – kiểm thử
resources/Tài nguyên tĩnh: icon, file cấu hình cho từng hệ điều hành—
remote/package.json cho phần chạy phía server từ xa (remote)Kiến trúc đa tiến trình (Multi-process)
.github/GitHub Actions (CI), mẫu issue/PR, hướng dẫn cho AI agent (copilot-instructions.md, instructions/, skills/)Coding Guidelines – quy ước viết code
.vscode/Cấu hình để dùng VS Code phát triển VS Code: launch.json (debug), tasks.json (build)Debug VS Code
.devcontainer/Cấu hình Dev Container / Codespaces (môi trường phát triển trong container)Build & Run từ mã nguồn
product.jsonCấu hình sản phẩm (tên, thư mục dữ liệu, URL dịch vụ…)Tổng quan: Code - OSS và Visual Studio Code
package.jsonKhai báo phiên bản, scripts npm, dependenciesBuild & Run từ mã nguồn
eslint.config.js + .eslint-plugin-local/Cấu hình lint và rule ESLint tự viết (ví dụ code-layering, code-import-patterns)Coding Guidelines – quy ước viết code
AGENTS.mdĐiểm vào hướng dẫn cho AI coding agent, trỏ tới .github/copilot-instructions.mdAgents Window & AI trong repo
out/Không có sẵn – được sinh ra khi build (JavaScript đã biên dịch)Build & Run từ mã nguồn

2. Bên trong src/vs/ – số liệu

Thư mụcSố file .tsNhóm con tiêu biểu
base496common, browser, node, parts
platform3.369hơn 100 service: files, configuration, storage, log, instantiation…
editor877common, browser, contrib (59 tính năng editor), standalone
workbench4.757browser, services (95), contrib (101), api
code22electron-main, electron-browser, node
server30node
sessions931Agents Window – xem Agents Window & AI trong repo

Mẹo định vị code nhanh

Hướng dẫn chính thức trong .github/copilot-instructions.md gợi ý thứ tự tìm code:

  1. Tìm theo khái niệm (semantic search).
  2. grep theo chuỗi chính xác (thông báo lỗi, tên hàm).
  3. Lần theo import – xem file nào import module đang xét.
  4. Đọc file test – thường cho thấy cách dùng và hành vi mong đợi.

3. Ví dụ: tìm nơi định nghĩa lệnh “Open Timeline”

# Tìm chuỗi ID lệnh trong toàn bộ src
grep -rn "files.openTimeline" src/vs
# Kết quả trỏ tới: src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts

File này được phân tích chi tiết ở Contribution Model & Registry.

Liên kết