feat(ide): export a portable VS Code extension; publish Void/VbsVsCode
This commit is contained in:
1 parent
399b52c31c
commit
12a52bbd0d
9 files changed
+278
-2
No files matched your search
@@ -196,6 +196,8 @@ message(STATUS "daemon describe response: ${daemon_describe_out}")
|
||||
check_process(0 "Usage: vbs ide <command>.*Commands:.*generate.*query" "" ide --help)
|
||||
check_process(0 "Usage: vbs ide generate " "" ide generate --help)
|
||||
check_process(0 "Usage: vbs ide query " "" ide query --help)
|
||||
check_process(0 "Usage: vbs ide plugin .*--editor.*--output" "" ide plugin --help)
|
||||
check_process(2 "" "--output is required" ide plugin)
|
||||
check_process(2 "" "missing subcommand for 'vbs ide'" ide)
|
||||
check_process(2 "" "unknown IDE kind" ide generate --editor invalid_ide)
|
||||
|
||||
|
||||
@@ -1083,6 +1083,55 @@ void build(Void::Build::Project &p) {
|
||||
}
|
||||
}
|
||||
|
||||
// === Editor plugin asset export ===
|
||||
VOID_TEST(FullV1Tests, ide_plugin_assets_export_vscode_extension) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_plugin_"};
|
||||
Editor::IdePluginOptions options;
|
||||
options.project_root = tmp / "proj";
|
||||
options.build_root = tmp / "build";
|
||||
options.vbs_executable = "/opt/vbs/bin/vbs";
|
||||
options.editor = Editor::IdeKind::VsCode;
|
||||
options.output_dir = tmp / "vbs-tools";
|
||||
options.force = true;
|
||||
|
||||
auto report = Editor::generate_ide_plugin_assets(options);
|
||||
Void::Testing::require(report.has_value());
|
||||
Void::Testing::expect_eq(report->written_files.size(), std::size_t{3});
|
||||
Void::Testing::expect(std::filesystem::exists(options.output_dir / "package.json"));
|
||||
Void::Testing::expect(std::filesystem::exists(options.output_dir / "extension.js"));
|
||||
Void::Testing::expect(std::filesystem::exists(options.output_dir / "README.md"));
|
||||
|
||||
auto manifest_text = Void::FileSystem::read_file(options.output_dir / "package.json");
|
||||
Void::Testing::require(manifest_text.has_value());
|
||||
auto manifest = Void::Json::Strict::parse(*manifest_text);
|
||||
Void::Testing::require(manifest.has_value());
|
||||
const auto *manifest_object = std::get_if<Void::Json::Strict::Value::Object>(&manifest->value);
|
||||
Void::Testing::require(manifest_object != nullptr);
|
||||
const auto contributes_it = manifest_object->find("contributes");
|
||||
Void::Testing::require(contributes_it != manifest_object->end());
|
||||
const auto *contributes =
|
||||
std::get_if<Void::Json::Strict::Value::Object>(&contributes_it->second.value);
|
||||
Void::Testing::require(contributes != nullptr);
|
||||
const auto commands_it = contributes->find("commands");
|
||||
Void::Testing::require(commands_it != contributes->end());
|
||||
const auto *commands =
|
||||
std::get_if<Void::Json::Strict::Value::Array>(&commands_it->second.value);
|
||||
Void::Testing::require(commands != nullptr);
|
||||
Void::Testing::expect_eq(commands->size(), std::size_t{6});
|
||||
|
||||
auto extension_text = Void::FileSystem::read_file(options.output_dir / "extension.js");
|
||||
Void::Testing::require(extension_text.has_value());
|
||||
Void::Testing::expect(extension_text->find("VBS_BIN || \"vbs\"") != std::string::npos);
|
||||
Void::Testing::expect(extension_text->find("workspaceFolders") != std::string::npos);
|
||||
Void::Testing::expect(extension_text->find("vbs.build") != std::string::npos);
|
||||
Void::Testing::expect(extension_text->find("vbs.package") != std::string::npos);
|
||||
|
||||
auto zed_options = options;
|
||||
zed_options.editor = Editor::IdeKind::Zed;
|
||||
auto zed_report = Editor::generate_ide_plugin_assets(zed_options);
|
||||
Void::Testing::expect(!zed_report.has_value());
|
||||
}
|
||||
|
||||
// === Migration tooling: CMakeLists.txt -> build.cpp scaffold ===
|
||||
VOID_TEST(FullV1Tests, cmake_lists_import_renders_build_cpp_scaffold) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_migrate_"};
|
||||
|
||||
Reference in new issue
Block a user