Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

1.0 KB
Raw Blame
//! IPC commands of `ide_host::ops::spell` (the shared implementation).

use crate::state::AppState;
use ide_core::{DocId, IdeResult, RequestId};
#[allow(unused_imports)]
pub use ide_host::ops::spell::*;
use ide_spell::{SpellScope, Typo};
use tauri::{State, Window};

/// Misspelt words in the comments, string literals and declared names of
/// `doc` that `scope` includes (all of its text for prose). Cancel with
/// `cancel_request(request)`.
#[tauri::command]
#[specta::specta]
pub async fn spell_check(
    window: Window,
    state: State<'_, AppState>,
    doc: DocId,
    scope: SpellScope,
    request: RequestId,
) -> IdeResult<Vec<Typo>> {
    ide_host::ops::spell::spell_check(&state.host, window.label(), doc, scope, request).await
}

/// Replacements for a misspelt `word`, best first (Typo › Change to…).
#[tauri::command]
#[specta::specta]
pub async fn spell_suggest(window: Window, state: State<'_, AppState>, word: String) -> IdeResult<Vec<String>> {
    ide_host::ops::spell::spell_suggest(&state.host, window.label(), word).await
}