Repository: lapce/lapce
File: lapce-data/src/explorer.rs (Rust)

Code before:
        indent_level: usize,
    },
    /// Naming a file that has yet to be created
    Naming {
        /// The index that the file being created should appear at
        /// Note that when naming, it is not yet actually created.
        list_index: usize,
        /// Indentation level
        indent_level: usize,
        /// If true, then we are creating a directory
        /// If false, then we are creating a file
        is_dir: bool,
        /// The folder that the file/directory is being created within
        base_path: PathBuf,
    },
    /// Duplicating an existing file
    Duplicating {
        /// The index that the file being created should appear at
        /// Note that when duplicating, it is not yet actually created.
        list_index: usize,
        /// Indentation level
        indent_level: usize,
        /// The folder that the file/directory is being created within
        base_path: PathBuf,
        /// The name of the file being duplicated
        name: OsString,
    },
}
impl Naming {
    pub fn list_index(&self) -> usize {
        match self {
            Naming::Renaming { list_index, .. }
            | Naming::Naming { list_index, .. }
            | Naming::Duplicating { list_index, .. } => *list_index,
        }
    }
}

#[derive(Clone)]
pub struct FileExplorerData {
    pub tab_id: WidgetId,
    pub widget_id: WidgetId,
    pub workspace: Option<FileNodeItem>,
    pub active_selected: Option<PathBuf>,
    /// The status of renaming/naming a file/directory
    pub naming: Option<Naming>,
    /// The id of the editor (in `main_split.editors`) for renaming
    pub renaming_editor_view_id: WidgetId,
    pub proxy: Arc<LapceProxy>,
    pub event_sink: ExtEventSink,
}

Review comment (suggestion):
This should be a `String` rather than `OsString`, we don't operate on raw platform strings (at least not yet)

Code after:
    },
    /// Naming a file that has yet to be created
    Naming {
        /// The index that the file being created should appear at
        /// Note that when naming, it is not yet actually created.
        list_index: usize,
        /// Indentation level
        indent_level: usize,
        /// If true, then we are creating a directory
        /// If false, then we are creating a file
        is_dir: bool,
        /// The folder that the file/directory is being created within
        base_path: PathBuf,
    },
    /// Duplicating an existing file
    Duplicating {
        /// The index that the file being created should appear at
        /// Note that when duplicating, it is not yet actually created.
        list_index: usize,
        /// Indentation level
        indent_level: usize,
        /// The folder that the file/directory is being created within
        base_path: PathBuf,
        /// The name of the file being duplicated
        name: String,
    },
}
impl Naming {
    pub fn list_index(&self) -> usize {
        match self {
            Naming::Renaming { list_index, .. }
            | Naming::Naming { list_index, .. }
            | Naming::Duplicating { list_index, .. } => *list_index,
        }
    }
}

#[derive(Clone)]
pub struct FileExplorerData {
    pub tab_id: WidgetId,
    pub widget_id: WidgetId,
    pub workspace: Option<FileNodeItem>,
    pub active_selected: Option<PathBuf>,
    /// The status of renaming/naming a file/directory
    pub naming: Option<Naming>,
    /// The id of the editor (in `main_split.editors`) for renaming
    pub renaming_editor_view_id: WidgetId,
    pub proxy: Arc<LapceProxy>,
    pub event_sink: ExtEventSink,
}