emmylua_code_analysis/config/configs/
reformat.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone, Default)]
5#[serde(rename_all = "camelCase")]
6pub struct EmmyrcReformat {
7    /// Whether to enable external tool formatting.
8    #[serde(default)]
9    pub external_tool: Option<EmmyrcExternalTool>,
10
11    /// Whether to enable external tool range formatting.
12    #[serde(default)]
13    pub external_tool_range_format: Option<EmmyrcExternalTool>,
14
15    /// Whether to use the diff algorithm for formatting.
16    #[serde(default = "default_false")]
17    pub use_diff: bool,
18}
19
20#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone, Default)]
21#[serde(rename_all = "camelCase")]
22pub struct EmmyrcExternalTool {
23    /// The command to run the external tool.
24    #[serde(default)]
25    pub program: String,
26    /// The arguments to pass to the external tool.
27    #[serde(default)]
28    pub args: Vec<String>,
29    /// The timeout for the external tool in milliseconds.
30    #[serde(default = "default_timeout")]
31    pub timeout: u64,
32}
33
34fn default_timeout() -> u64 {
35    5000
36}
37
38fn default_false() -> bool {
39    false
40}