Repository: helix-editor/helix
File: helix-view/src/editor.rs (Rust)

Code before:
    /// Allows asynchronous tasks to control the rendering
    /// The `Notify` allows asynchronous tasks to request the editor to perform a redraw
    /// The `RwLock` blocks the editor from performing the render until an exclusive lock can be aquired
    pub redraw_handle: RedrawHandle,
    pub needs_redraw: bool,
    /// Cached position of the cursor calculated during rendering.
    /// The content of `cursor_cache` is returned by `Editor::cursor` if
    /// set to `Some(_)`. The value will be cleared after it's used.
    /// If `cursor_cache` is `None` then the `Editor::cursor` function will
    /// calculate the cursor position.
    ///
    /// `Some(None)` represents a cursor position outside of the visible area.
    /// This will just cause `Editor::cursor` to return `None`.
    ///
    /// This cache is only a performance optimization to
    /// avoid calculating the cursor position multiple
    /// times during rendering and should not be set by other functions.
    pub cursor_cache: Cell<Option<Option<Position>>>,
    /// When a new completion request is sent to the server old
    /// unifinished request must be dropped. Each completion
    /// request is associated with a channel that cancels
    /// when the channel is dropped. That channel is stored
    /// here. When a new completion request is sent this
    /// field is set and any old requests are automatically
    /// canceled as a result
    pub completion_request_handel: Option<oneshot::Sender<()>>,
}

pub type RedrawHandle = (Arc<Notify>, Arc<RwLock<()>>);

#[derive(Debug)]
pub enum EditorEvent {
    DocumentSaved(DocumentSavedEventResult),
    ConfigEvent(ConfigEvent),
    LanguageServerMessage((usize, Call)),
    DebuggerEvent(dap::Payload),
    IdleTimer,
}

#[derive(Debug, Clone)]
pub enum ConfigEvent {
    Refresh,
    Update(Box<Config>),
}

enum ThemeAction {
    Set,
    Preview,
}

#[derive(Debug, Clone)]

Review comment (suggestion):
```suggestion
    pub completion_request_handle: Option<oneshot::Sender<()>>,
```

Code after:
    /// Allows asynchronous tasks to control the rendering
    /// The `Notify` allows asynchronous tasks to request the editor to perform a redraw
    /// The `RwLock` blocks the editor from performing the render until an exclusive lock can be aquired
    pub redraw_handle: RedrawHandle,
    pub needs_redraw: bool,
    /// Cached position of the cursor calculated during rendering.
    /// The content of `cursor_cache` is returned by `Editor::cursor` if
    /// set to `Some(_)`. The value will be cleared after it's used.
    /// If `cursor_cache` is `None` then the `Editor::cursor` function will
    /// calculate the cursor position.
    ///
    /// `Some(None)` represents a cursor position outside of the visible area.
    /// This will just cause `Editor::cursor` to return `None`.
    ///
    /// This cache is only a performance optimization to
    /// avoid calculating the cursor position multiple
    /// times during rendering and should not be set by other functions.
    pub cursor_cache: Cell<Option<Option<Position>>>,
    /// When a new completion request is sent to the server old
    /// unifinished request must be dropped. Each completion
    /// request is associated with a channel that cancels
    /// when the channel is dropped. That channel is stored
    /// here. When a new completion request is sent this
    /// field is set and any old requests are automatically
    /// canceled as a result
    pub completion_request_handle: Option<oneshot::Sender<()>>,
}

pub type RedrawHandle = (Arc<Notify>, Arc<RwLock<()>>);

#[derive(Debug)]
pub enum EditorEvent {
    DocumentSaved(DocumentSavedEventResult),
    ConfigEvent(ConfigEvent),
    LanguageServerMessage((usize, Call)),
    DebuggerEvent(dap::Payload),
    IdleTimer,
}

#[derive(Debug, Clone)]
pub enum ConfigEvent {
    Refresh,
    Update(Box<Config>),
}

enum ThemeAction {
    Set,
    Preview,
}

#[derive(Debug, Clone)]