Files
openidea/src-tauri/src/commands/spell.rs

31 lines
1.0 KiB
Rust
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! 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
}