dprint_core/plugins/
plugin_info.rs

1use serde::Deserialize;
2use serde::Serialize;
3
4/// Information about a plugin.
5#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
6#[serde(rename_all = "camelCase")]
7pub struct PluginInfo {
8  /// The name of the plugin.
9  pub name: String,
10  /// The version of the plugin.
11  pub version: String,
12  /// Gets the key that can be used in the configuration JSON.
13  pub config_key: String,
14  /// A url the user can go to in order to get help information about the plugin.
15  pub help_url: String,
16  /// Schema url for the plugin configuration.
17  ///
18  /// Generally in the format: https://plugins.dprint.dev/<org-or-user>/<repo>/<tag-name>/schema.json
19  /// For example: https://plugins.dprint.dev/dprint/dprint-plugin-typescript/0.60.0/schema.json
20  pub config_schema_url: String,
21  /// Plugin update url.
22  ///
23  /// Generally in the format: https://plugins.dprint.dev/<org-or-user>/<repo>/latest.json
24  /// For example: https://plugins.dprint.dev/dprint/dprint-plugin-typescript/latest.json
25  pub update_url: Option<String>,
26}
27
28/// The plugin file matching information based on the configuration.
29#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
30#[serde(rename_all = "camelCase")]
31pub struct FileMatchingInfo {
32  /// The file extensions this plugin should format.
33  #[serde(default = "Vec::new")]
34  pub file_extensions: Vec<String>,
35  /// The file names this plugin should format.
36  #[serde(default = "Vec::new")]
37  pub file_names: Vec<String>,
38}