feat(ide): export Zed task assets; publish Void/VbsZed
This commit is contained in:
1 parent
12a52bbd0d
commit
3577ba69b7
6 files changed
+59
-3
No files matched your search
+37
-1
@@ -1267,10 +1267,46 @@ export_ide_plugin_assets(const IdePluginOptions &options) {
|
||||
}(),
|
||||
output.string());
|
||||
|
||||
if (options.editor == IdeKind::Zed) {
|
||||
std::string zed_tasks = "[\n";
|
||||
for (std::size_t i = 0; i < commands.size(); ++i) {
|
||||
const auto &command = commands[i];
|
||||
if (i > 0) {
|
||||
zed_tasks += ",\n";
|
||||
}
|
||||
zed_tasks += " {\"label\":" + json_quote(command.title) +
|
||||
",\"command\":\"vbs\",\"args\":" + json_array(command.args, json_quote) +
|
||||
",\"use_new_terminal\":false,\"allow_concurrent_runs\":false}";
|
||||
}
|
||||
zed_tasks += "\n]\n";
|
||||
const std::string zed_manifest =
|
||||
"id = \"vbs\"\n"
|
||||
"name = \"VoidBuildSystem\"\n"
|
||||
"description = \"Zed task assets for VoidBuildSystem (VBS).\"\n"
|
||||
"version = \"0.1.0\"\n"
|
||||
"schema_version = 1\n"
|
||||
"authors = [\"Void contributors\"]\n"
|
||||
"repository = \"https://git.faumaray.com/Void/VbsZed\"\n";
|
||||
const std::string zed_readme =
|
||||
"# VbsZed\n\nZed task assets for VoidBuildSystem, generated by `vbs ide plugin "
|
||||
"--editor zed`.\n\nCopy `tasks.json` to `.zed/tasks.json` in your project (or install "
|
||||
"this extension) and run the tasks from Zed's task menu. Set `VBS_BIN` if `vbs` is not "
|
||||
"on `PATH`.\n";
|
||||
|
||||
for (const auto &[name, content] :
|
||||
std::vector<std::pair<std::string, std::string>>{{"extension.toml", zed_manifest},
|
||||
{"tasks.json", zed_tasks},
|
||||
{"README.md", zed_readme}}) {
|
||||
if (auto written = write_asset(output / name, content); !written) {
|
||||
return std::unexpected{written.error()};
|
||||
}
|
||||
}
|
||||
return report;
|
||||
}
|
||||
if (options.editor != IdeKind::VsCode) {
|
||||
return std::unexpected{Void::System::make_system_error(
|
||||
Void::System::SystemErrorCode::unsupported,
|
||||
"editor plugin assets are currently generated for vscode only")};
|
||||
"editor plugin assets are generated for vscode and zed only")};
|
||||
}
|
||||
|
||||
for (const auto &[name, content] :
|
||||
|
||||
Reference in new issue
Block a user