蓝色天空.知识 · 实践 · 创造
我的收藏
在线代码实验室

运行 VS Code 双许可模型、发布里程碑与多根目录 .code-workspace 配置离线校验

PYTHONWindows x64、CPython 3.12.14、Playwright 与本地浏览器/标准库。explore-tutorial.py
explore-tutorial.py96 行
"""Offline VS Code overview, licensing & workspace config verifier for Ch01 (tutorial)."""
import json

VERSION = "CPython 3.12.14 offline VS Code config & architecture verifier"


def check(name, summary, expected, actual):
    return {
        "name": name,
        "summary": summary,
        "expected": expected,
        "actual": actual,
        "passed": actual == expected,
    }


def main():
    cases = []

    # Case 1: VS Code release milestones, dual-license model, and core capabilities
    milestones = [
        ("2015-04-29", "Build 2015 preview"),
        ("2015-11-18", "Open-sourced on GitHub with extensions"),
        ("2016-04-14", "1.0 GA release"),
        ("2024-11", "1.96 free GitHub Copilot tier"),
    ]
    profile = {
        "platforms": ["Windows", "macOS", "Linux"],
        "framework": "Electron",
        "source_license": "MIT",
        "product_license": "Microsoft Software License",
        "builtin_languages": ["JavaScript", "TypeScript", "CSS", "HTML"],
        "builtin_debugger": "Node.js",
        "milestone_count": len(milestones),
        "first_release": milestones[0][0],
        "copilot_free_version": "1.96",
    }
    cases.append(
        check(
            "vscode_metadata_and_license_model",
            "Verify VS Code cross-platform targets, MIT vs Microsoft dual license, built-in languages, and release timeline",
            {
                "platforms": ["Windows", "macOS", "Linux"],
                "framework": "Electron",
                "source_license": "MIT",
                "product_license": "Microsoft Software License",
                "builtin_languages": ["JavaScript", "TypeScript", "CSS", "HTML"],
                "builtin_debugger": "Node.js",
                "milestone_count": 4,
                "first_release": "2015-04-29",
                "copilot_free_version": "1.96",
            },
            profile,
        )
    )

    # Case 2: Multi-root .code-workspace & file encoding/EOL/language configuration
    workspace_doc = {
        "folders": [
            {"name": "frontend", "path": "./apps/web"},
            {"name": "backend", "path": "./services/api"},
        ],
        "settings": {
            "files.encoding": "utf8",
            "files.eol": "\n",
            "files.associations": {"*.vue": "html", "*.config": "json"},
        },
    }
    roundtrip = json.loads(json.dumps(workspace_doc, ensure_ascii=False))
    cases.append(
        check(
            "workspace_and_file_profile_validation",
            "Verify multi-root .code-workspace serialization, UTF-8 encoding, LF EOL, and language mode associations",
            {
                "folder_count": 2,
                "folder_names": ["frontend", "backend"],
                "encoding": "utf8",
                "eol": "\n",
                "association_count": 2,
            },
            {
                "folder_count": len(roundtrip["folders"]),
                "folder_names": [f["name"] for f in roundtrip["folders"]],
                "encoding": roundtrip["settings"]["files.encoding"],
                "eol": roundtrip["settings"]["files.eol"],
                "association_count": len(roundtrip["settings"]["files.associations"]),
            },
        )
    )

    print(json.dumps({"version": VERSION, "cases": cases}, ensure_ascii=False, indent=2))


if __name__ == "__main__":
    main()
本例需在 Windows x64、CPython 3.12.14、Playwright 与本地浏览器/标准库。 中运行,请复制源码、保存文件或下载工程包后在本地执行验证。
运行说明与环境独立工程

运行环境:Windows x64、CPython 3.12.14、Playwright 与本地浏览器/标准库。

入口文件:projects/vscode-tutorial-lab/explore-tutorial.py

本地运行步骤快速上手
  1. 点击上方“保存源码”保存为 explore-tutorial.py,或下载右侧课程工程包。
  2. 确认本地已准备 Windows x64、CPython 3.12.14、Playwright 与本地浏览器/标准库。。
  3. 按对应章节命令执行,结合正文核对实际输出。
附件与关联工程包下载

下载课程关联工程包:VS Code

课程关联工程包(登记关联25章) · 含当前章节或实例 · mbskycom202612a2203.zip

下载课程关联工程包:VS Code

课程关联工程包(登记关联1章) · 含当前章节或实例 · mbskycom202612a2224.zip
SITE SEARCH

搜索教程、工具与资讯

热门搜索

JavaScriptJSON格式化正则表达式AI 编程AI 翻译AI导航专题标签
Esc 关闭

欢迎登录蓝色天空网

使用会员账号,继续你的学习