Andrey Tkachenko
47f8b48407
All checks were successful
continuous-integration/drone/push Build is passing
222 lines
3.8 KiB
Rust
222 lines
3.8 KiB
Rust
use std::collections::HashMap;
|
|
|
|
use serde_derive::Deserialize;
|
|
use toml::Value;
|
|
|
|
///
|
|
///
|
|
///
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct PluginMetadataHook {
|
|
entry: String,
|
|
}
|
|
|
|
///
|
|
///
|
|
///
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct PluginMetadataExportArgument {
|
|
name: String,
|
|
#[serde(rename = "type")]
|
|
ty: String,
|
|
default: Option<Value>,
|
|
required: bool,
|
|
}
|
|
|
|
///
|
|
/// Plugin Export Definition
|
|
///
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct PluginMetadataExport {
|
|
name: String,
|
|
args: Vec<PluginMetadataExportArgument>,
|
|
entry: String,
|
|
}
|
|
|
|
///
|
|
/// Plugin Export Key Mapping
|
|
///
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct PluginMetadataExportKeyMapping {
|
|
entry: String,
|
|
args: Vec<PluginMetadataExportArgument>,
|
|
mapping: String,
|
|
}
|
|
|
|
///
|
|
/// Plugin Metadata Dependency
|
|
///
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct PluginMetadataDependency {
|
|
///
|
|
/// Dependecy name
|
|
name: String,
|
|
|
|
///
|
|
/// Version match pattern
|
|
version: Option<String>,
|
|
|
|
///
|
|
/// Git repository url
|
|
git: Option<String>,
|
|
|
|
///
|
|
/// Branch name in case of git repository url set
|
|
branch: Option<String>,
|
|
|
|
///
|
|
/// Revision number in case of git repository url set
|
|
rev: Option<String>,
|
|
|
|
///
|
|
/// Path in case package is in file system
|
|
path: Option<String>,
|
|
}
|
|
|
|
///
|
|
/// Plugin Metadata Configuration Option
|
|
///
|
|
///
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct PluginMetadataOption {
|
|
///
|
|
/// Option name
|
|
///
|
|
name: String,
|
|
|
|
///
|
|
/// Value Type
|
|
///
|
|
#[serde(rename = "type")]
|
|
ty: String,
|
|
|
|
///
|
|
/// Description
|
|
///
|
|
description: Option<String>,
|
|
|
|
///
|
|
/// Option default value
|
|
///
|
|
default: Option<Value>,
|
|
|
|
///
|
|
/// Option required flag
|
|
required: bool,
|
|
}
|
|
|
|
///
|
|
/// Plugin Metadata
|
|
///
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct PluginMetadata {
|
|
///
|
|
/// Plugin name
|
|
///
|
|
name: String,
|
|
|
|
///
|
|
/// Plugin version signature
|
|
///
|
|
version: String,
|
|
|
|
///
|
|
/// Licence
|
|
///
|
|
licence: String,
|
|
|
|
///
|
|
/// Title
|
|
///
|
|
title: String,
|
|
|
|
///
|
|
/// Description
|
|
///
|
|
description: String,
|
|
|
|
///
|
|
/// List of plugin's authors
|
|
///
|
|
authors: Vec<String>,
|
|
|
|
///
|
|
/// Plugin documentation URL
|
|
///
|
|
documentation: String,
|
|
|
|
///
|
|
/// Plugin homepage URL
|
|
///
|
|
homepage: String,
|
|
|
|
///
|
|
/// Plugin repository URL
|
|
///
|
|
repository: String,
|
|
|
|
///
|
|
/// Plugin keywords for search optiomization
|
|
///
|
|
keywords: Vec<String>,
|
|
|
|
///
|
|
/// API set pluging is using
|
|
/// - if plugin uses only editor api (i.e. cursor or buffer content) it should be installed
|
|
/// locally
|
|
/// - if plugin needs to run commands or acces to fs - so it should be installed remotly
|
|
///
|
|
api_version: String,
|
|
|
|
///
|
|
/// List of categories the plugin is related to
|
|
///
|
|
categories: String,
|
|
|
|
///
|
|
/// Resources to include to publishing package
|
|
///
|
|
include: Vec<String>,
|
|
|
|
///
|
|
/// Files or folders to exclude from publishing the plugin
|
|
///
|
|
exclude: Vec<String>,
|
|
|
|
///
|
|
/// Plugin dependencies
|
|
///
|
|
dependencies: Vec<PluginMetadataDependency>,
|
|
|
|
///
|
|
/// Configuration options for the plugin
|
|
///
|
|
options: Vec<PluginMetadataOption>,
|
|
|
|
///
|
|
/// Plugin event hooks
|
|
///
|
|
hooks: HashMap<String, PluginMetadataHook>,
|
|
|
|
///
|
|
/// Plugin Exports
|
|
///
|
|
exports: Vec<PluginMetadataExport>,
|
|
|
|
///
|
|
/// Key Mapping Exports
|
|
///
|
|
export_key_mappings: Vec<PluginMetadataExportKeyMapping>,
|
|
|
|
///
|
|
/// Assets
|
|
/// - binary: Wasm Binary
|
|
/// - tree-sitter: tree-sitter plugin
|
|
/// - theme: App theme styles
|
|
/// - icons: icon pack
|
|
/// - syntax: Syntax theme colors
|
|
/// - readme: Readme file
|
|
///
|
|
assets: HashMap<String, String>,
|
|
}
|