1#[derive(Debug, Clone)]
3pub struct EditorConfig {
4 pub show_line_numbers: bool,
5 pub wrap_mode: bool,
6 pub tab_width: usize,
7 pub theme: String,
8}
9
10impl Default for EditorConfig {
11 fn default() -> Self {
12 Self {
13 show_line_numbers: true,
14 wrap_mode: true,
15 tab_width: 4,
16 theme: "base16-ocean.dark".into(),
17 }
18 }
19}
20
21impl EditorConfig {
22 pub fn new() -> Self {
23 Self::default()
24 }
25
26 pub fn with_line_numbers(mut self, show: bool) -> Self {
27 self.show_line_numbers = show;
28 self
29 }
30
31 pub fn with_wrap_mode(mut self, wrap: bool) -> Self {
32 self.wrap_mode = wrap;
33 self
34 }
35
36 pub fn with_tab_width(mut self, width: usize) -> Self {
37 self.tab_width = width;
38 self
39 }
40
41 pub fn with_theme(mut self, theme: String) -> Self {
42 self.theme = theme;
43 self
44 }
45}