pub struct Dictionary { /* private fields */ }Expand description
Manages custom dictionaries for the language checker. Words in the dictionary are excluded from spelling diagnostics.
Internally, user-added words and bundled words are kept in separate sets.
Only user words are persisted to dictionary.txt.
Implementations§
Source§impl Dictionary
impl Dictionary
pub fn new() -> Self
Sourcepub fn load(workspace_root: &Path) -> Result<Self>
pub fn load(workspace_root: &Path) -> Result<Self>
Load dictionaries from a workspace root. Reads from .languagecheck/dictionary.txt (one word per line).
Sourcepub fn load_bundled(&mut self)
pub fn load_bundled(&mut self)
Load the bundled dictionaries that ship with the extension. These contain domain-specific technical terms from open-source wordlists. Bundled words are kept separate and never persisted to the user’s dictionary file.
Sourcepub fn load_wordlist_file(&mut self, path: &Path, base: &Path) -> Result<()>
pub fn load_wordlist_file(&mut self, path: &Path, base: &Path) -> Result<()>
Load additional words from a file path. The file is expected to contain
one word per line; lines starting with # and blank lines are skipped.
Paths are resolved relative to base if they are not absolute.
Sourcepub fn add_word(&mut self, word: &str) -> Result<()>
pub fn add_word(&mut self, word: &str) -> Result<()>
Add a word to the user dictionary and persist to disk.
Sourcepub fn contains(&self, word: &str) -> bool
pub fn contains(&self, word: &str) -> bool
Check if a word is in the dictionary (case-insensitive). Checks both user words and bundled/external wordlists.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dictionary
impl RefUnwindSafe for Dictionary
impl Send for Dictionary
impl Sync for Dictionary
impl Unpin for Dictionary
impl UnsafeUnpin for Dictionary
impl UnwindSafe for Dictionary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more