Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: wrote docs and reorganized `harper_core::linter` imports
Elijah Potter067850381bf2
diff --git a/harper-cli/src/main.rs b/harper-cli/src/main.rsindex 66e6b0687..2ff8044b9 100644--- a/harper-cli/src/main.rs+++ b/harper-cli/src/main.rs@@ -6,8 +6,9 @@ use anyhow::format_err;use ariadne::{Color, Label, Report, ReportKind, Source};use clap::Parser;use harper_comments::CommentParser;+use harper_core::linting::{LintGroup, LintGroupConfig, Linter};use harper_core::parsers::Markdown;-use harper_core::{remove_overlaps, Document, FullDictionary, LintGroup, LintGroupConfig, Linter};+use harper_core::{remove_overlaps, Document, FullDictionary};#[derive(Debug, Parser)]enum Args {diff --git a/harper-comments/tests/language_support.rs b/harper-comments/tests/language_support.rsindex 448ad076a..2112440e7 100644--- a/harper-comments/tests/language_support.rs+++ b/harper-comments/tests/language_support.rs@@ -1,7 +1,8 @@use std::path::Path;use harper_comments::CommentParser;-use harper_core::{Document, FullDictionary, LintGroup, LintGroupConfig, Linter};+use harper_core::linting::{LintGroup, LintGroupConfig, Linter};+use harper_core::{Document, FullDictionary};/// Creates a unit test checking that the linting of a source file in/// `language_support_sources` produces the expected number of lints.diff --git a/harper-core/README.md b/harper-core/README.mdindex 94e56b4da..468af452b 100644--- a/harper-core/README.md+++ b/harper-core/README.md@@ -5,3 +5,8 @@ Right now, it only exists to hold the core functioning of `harper-ls` and `harpe`harper-core` _is_ [available on `crates.io`](https://crates.io/crates/harper-core), however improving the API is currently not a high priority.Feel free to use `harper-core` in your projects, but if you run into issues, create a pull request.++## Features++`concurrent`: Whether to use thread-safe primitives (`Arc` vs `Rc`). Disabled by default.+It is not recommended unless you need thread-safely (i.e. you want to use something like `tokio`).diff --git a/harper-core/benches/parse_demo.rs b/harper-core/benches/parse_demo.rsindex 04de0527b..8118d44ec 100644--- a/harper-core/benches/parse_demo.rs+++ b/harper-core/benches/parse_demo.rs@@ -1,5 +1,6 @@use divan::{black_box, AllocProfiler, Bencher};-use harper_core::{Document, FullDictionary, LintGroup, LintGroupConfig, Linter};+use harper_core::linting::{LintGroup, LintGroupConfig, Linter};+use harper_core::{Document, FullDictionary};#[global_allocator]static ALLOC: AllocProfiler = AllocProfiler::system();diff --git a/harper-core/dictionary.dict b/harper-core/dictionary.dictindex 339978e0d..4c9b7499f 100644--- a/harper-core/dictionary.dict+++ b/harper-core/dictionary.dict@@ -35556,6 +35556,7 @@ parringparrot/GMDSparry/GDSMparse/DRSGT+parser/SMparsec/MSparsimonious/Yparsimony/Mdiff --git a/harper-core/src/char_string.rs b/harper-core/src/char_string.rsindex 26394f629..6945a58ff 100644--- a/harper-core/src/char_string.rs+++ b/harper-core/src/char_string.rs@@ -1,5 +1,7 @@use smallvec::SmallVec;+/// A char sequence that improves cache locality.+/// Most English words are fewer than 6 characters.pub type CharString = SmallVec<[char; 6]>;pub trait CharStringExt {diff --git a/harper-core/src/document.rs b/harper-core/src/document.rsindex 413ad1d3e..5cd8959e5 100644--- a/harper-core/src/document.rs+++ b/harper-core/src/document.rs@@ -12,6 +12,8 @@ use crate::token::NumberSuffix;use crate::vec_ext::VecExt;use crate::{Dictionary, FatToken, FullDictionary, Lrc, Token, TokenKind, TokenStringExt};+/// A document containing some amount of lexed and parsed English text.+/// This ispub struct Document {source: Lrc<Vec<char>>,tokens: Vec<Token>@@ -24,20 +26,24 @@ impl Default for Document {}impl Document {- /// Lexes and parses text to produce a document.+ /// Lexes and parses text to produce a document using a provided language+ /// parser and dictionary.pub fn new(text: &str, parser: &mut impl Parser, dictionary: &impl Dictionary) -> Self {let source: Vec<_> = text.chars().collect();Self::new_from_vec(Lrc::new(source), parser, dictionary)}- /// Lexes and parses text to produce a document.+ /// Lexes and parses text to produce a document using a provided language+ /// parser and the included curated dictionary.pub fn new_curated(text: &str, parser: &mut impl Parser) -> Self {let source: Vec<_> = text.chars().collect();Self::new_from_vec(Lrc::new(source), parser, &FullDictionary::curated())}+ /// Lexes and parses text to produce a document using a provided language+ /// parser and dictionary.pub fn new_from_vec(source: Lrc<Vec<char>>,parser: &mut impl Parser,@@ -51,19 +57,26 @@ impl Document {document}+ /// Parse text to produce a document using the built-in [`PlainEnglish`]+ /// parser and curated dictionary.pub fn new_plain_english_curated(text: &str) -> Self {Self::new(text, &mut PlainEnglish, &FullDictionary::curated())}+ /// Parse text to produce a document using the built-in [`PlainEnglish`]+ /// parser and a provided dictionary.pub fn new_plain_english(text: &str, dictionary: &impl Dictionary) -> Self {Self::new(text, &mut PlainEnglish, dictionary)}- /// Create a new Markdown document using the curated dictionary for tagging.+ /// Parse text to produce a document using the built-in [`Markdown`] parser+ /// and curated dictionary.pub fn new_markdown_curated(text: &str) -> Self {Self::new(text, &mut Markdown, &FullDictionary::curated())}+ /// Parse text to produce a document using the built-in [`PlainEnglish`]+ /// parser and the curated dictionary.pub fn new_markdown(text: &str, dictionary: &impl Dictionary) -> Self {Self::new(text, &mut Markdown, dictionary)}@@ -162,10 +175,12 @@ impl Document {self.tokens.get(index).copied()}+ /// Get an iterator over all the tokens contained in the document.pub fn tokens(&self) -> impl Iterator<Item = Token> + '_ {self.tokens.iter().copied()}+ /// Get an iterator over all the tokens contained in the document.pub fn fat_tokens(&self) -> impl Iterator<Item = FatToken> + '_ {self.tokens().map(|token| token.to_fat(&self.source))}@@ -194,7 +209,14 @@ impl Document {})}- /// Iterate over sentence chunks.+ /// Iterate over chunks.+ ///+ /// For example, the following sentence contains two chunks separated by a+ /// comma:+ ///+ /// ```text+ /// Here is an example, it is short.+ /// ```pub fn chunks(&self) -> impl Iterator<Item = &'_ [Token]> + '_ {let first_sentence = self.chunk_terminators()@@ -229,7 +251,7 @@ impl Document {})}- /// Get the index of the last sentence terminator.+ /// Get the index of the last sentence terminator in the document.fn last_sentence_terminator(&self) -> Option<usize> {self.tokens.iter()@@ -243,6 +265,8 @@ impl Document {})}+ /// Get an iterator over token slices that represent the individual+ /// sentences in a document.pub fn sentences(&self) -> impl Iterator<Item = &'_ [Token]> + '_ {let first_sentence = self.sentence_terminators()@@ -501,6 +525,7 @@ impl Document {}}+/// Creates functions necessary to implement [`TokenStringExt]` on a document.macro_rules! create_fns_on_doc {($thing:ident) => {paste! {diff --git a/harper-core/src/lib.rs b/harper-core/src/lib.rsindex fc7be0206..e51e41398 100644--- a/harper-core/src/lib.rs+++ b/harper-core/src/lib.rs@@ -6,7 +6,7 @@ mod char_string;mod document;mod language_detection;mod lexing;-mod linting;+pub mod linting;mod mask;pub mod parsers;mod punctuation;@@ -19,7 +19,7 @@ mod word_metadata;pub use char_string::{CharString, CharStringExt};pub use document::Document;-pub use linting::{Lint, LintGroup, LintGroupConfig, LintKind, Linter, Suggestion};+use linting::Lint;pub use mask::{Mask, Masker};pub use punctuation::{Punctuation, Quote};pub use span::Span;diff --git a/harper-core/src/linting/an_a.rs b/harper-core/src/linting/an_a.rsindex e8ec68be0..71ff42a96 100644--- a/harper-core/src/linting/an_a.rs+++ b/harper-core/src/linting/an_a.rs@@ -2,7 +2,8 @@ use std::borrow::Cow;use itertools::Itertools;-use crate::{Document, Lint, LintKind, Linter, Suggestion, TokenStringExt};+use crate::linting::{Lint, LintKind, Linter, Suggestion};+use crate::{Document, TokenStringExt};#[derive(Debug, Default)]pub struct AnA;diff --git a/harper-core/src/linting/correct_number_suffix.rs b/harper-core/src/linting/correct_number_suffix.rsindex 8c2a2a20a..bc06b7004 100644--- a/harper-core/src/linting/correct_number_suffix.rs+++ b/harper-core/src/linting/correct_number_suffix.rs@@ -1,6 +1,6 @@-use super::{Lint, LintKind, Linter};+use super::{Lint, LintKind, Linter, Suggestion};use crate::token::{NumberSuffix, TokenStringExt};-use crate::{Document, Span, Suggestion, TokenKind};+use crate::{Document, Span, TokenKind};/// Detect and warn that the sentence is too long.#[derive(Debug, Clone, Copy, Default)]diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rsindex 5a0b7fc7a..82fb71d53 100644--- a/harper-core/src/linting/lint_group.rs+++ b/harper-core/src/linting/lint_group.rs@@ -23,7 +23,7 @@ macro_rules! create_lint_group_config {#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default)]pub struct LintGroupConfig {$(- #[doc = "Configures the use of the `" $linter "` linter.+ #[doc = "Configures the use of the [`" $linter "`] linter.If set to [`None`], the default configuration will be used."]pub [<$linter:snake>]: Option<bool>,)*@@ -45,6 +45,8 @@ macro_rules! create_lint_group_config {}}+ /// A wrapper that combines all built-in Harper linters+ /// into a single, configurable [`Linter`].pub struct LintGroup<T: Dictionary> {$([<$linter:snake>]: $linter,diff --git a/harper-core/src/linting/matcher.rs b/harper-core/src/linting/matcher.rsindex 491b990be..e340043dc 100644--- a/harper-core/src/linting/matcher.rs+++ b/harper-core/src/linting/matcher.rs@@ -1,16 +1,5 @@-use crate::{- CharString,- Document,- Lint,- LintKind,- Linter,- Punctuation,- Span,- Suggestion,- Token,- TokenKind,- WordMetadata-};+use crate::linting::{Lint, LintKind, Linter, Suggestion};+use crate::{CharString, Document, Punctuation, Span, Token, TokenKind, WordMetadata};#[derive(Debug, PartialEq, PartialOrd, Clone)]struct PatternToken {@@ -383,8 +372,8 @@ impl Linter for Matcher {#[cfg(test)]mod tests {- use super::Matcher;- use crate::{Document, Linter};+ use super::{Linter, Matcher};+ use crate::Document;#[test]fn matches_therefore() {diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rsindex a5df164ad..bececebab 100644--- a/harper-core/src/linting/mod.rs+++ b/harper-core/src/linting/mod.rs@@ -14,8 +14,21 @@ mod spelled_numbers;mod unclosed_quotes;mod wrong_quotes;+pub use an_a::AnA;+pub use correct_number_suffix::CorrectNumberSuffix;pub use lint::{Lint, LintKind, Suggestion};pub use lint_group::{LintGroup, LintGroupConfig};+pub use long_sentences::LongSentences;+pub use matcher::Matcher;+pub use multiple_sequential_pronouns::MultipleSequentialPronouns;+pub use number_suffix_capitalization::NumberSuffixCapitalization;+pub use repeated_words::RepeatedWords;+pub use sentence_capitalization::SentenceCapitalization;+pub use spaces::Spaces;+pub use spell_check::SpellCheck;+pub use spelled_numbers::SpelledNumbers;+pub use unclosed_quotes::UnclosedQuotes;+pub use wrong_quotes::WrongQuotes;use crate::Document;@@ -30,7 +43,8 @@ pub trait Linter: Send + Sync {#[cfg(test)]mod tests {- use crate::{Document, Linter};+ use super::Linter;+ use crate::Document;pub fn assert_lint_count(text: &str, mut linter: impl Linter, count: usize) {let test = Document::new_markdown_curated(text);diff --git a/harper-core/src/linting/multiple_sequential_pronouns.rs b/harper-core/src/linting/multiple_sequential_pronouns.rsindex f88fdb70b..7ab2a3ec0 100644--- a/harper-core/src/linting/multiple_sequential_pronouns.rs+++ b/harper-core/src/linting/multiple_sequential_pronouns.rs@@ -1,4 +1,5 @@-use crate::{CharString, Document, Lint, LintKind, Linter, Span, Token, TokenStringExt};+use crate::linting::{LintKind, Linter};+use crate::{CharString, Document, Lint, Span, Token, TokenStringExt};/// Linter that checks if multiple pronouns are being used right after each/// other. This is a common mistake to make during the revision process.diff --git a/harper-core/src/linting/number_suffix_capitalization.rs b/harper-core/src/linting/number_suffix_capitalization.rsindex 1e3195198..f4b626e1b 100644--- a/harper-core/src/linting/number_suffix_capitalization.rs+++ b/harper-core/src/linting/number_suffix_capitalization.rs@@ -1,6 +1,6 @@-use super::{Lint, LintKind, Linter};+use super::{Lint, LintKind, Linter, Suggestion};use crate::token::TokenStringExt;-use crate::{Document, Span, Suggestion, TokenKind};+use crate::{Document, Span, TokenKind};/// Detect and warn that the sentence is too long.#[derive(Debug, Clone, Copy, Default)]diff --git a/harper-core/src/linting/repeated_words.rs b/harper-core/src/linting/repeated_words.rsindex e3ff54b45..6c98add40 100644--- a/harper-core/src/linting/repeated_words.rs+++ b/harper-core/src/linting/repeated_words.rs@@ -1,8 +1,8 @@use hashbrown::HashSet;-use super::{Lint, LintKind, Linter};+use super::{Lint, LintKind, Linter, Suggestion};use crate::token::{Token, TokenKind, TokenStringExt};-use crate::{CharString, Document, Span, Suggestion};+use crate::{CharString, Document, Span};#[derive(Debug, Clone)]pub struct RepeatedWords {diff --git a/harper-core/src/linting/spaces.rs b/harper-core/src/linting/spaces.rsindex 756e12944..6597d269c 100644--- a/harper-core/src/linting/spaces.rs+++ b/harper-core/src/linting/spaces.rs@@ -1,6 +1,6 @@-use super::{Lint, Linter};+use super::{Lint, LintKind, Linter, Suggestion};use crate::token::TokenStringExt;-use crate::{Document, LintKind, Suggestion, Token, TokenKind};+use crate::{Document, Token, TokenKind};#[derive(Debug, Default)]pub struct Spaces;diff --git a/harper-core/src/linting/spelled_numbers.rs b/harper-core/src/linting/spelled_numbers.rsindex 9e0fbaeb0..0a6713f01 100644--- a/harper-core/src/linting/spelled_numbers.rs+++ b/harper-core/src/linting/spelled_numbers.rs@@ -1,4 +1,5 @@-use crate::{Document, Lint, LintKind, Linter, Suggestion, TokenStringExt};+use crate::linting::{LintKind, Linter, Suggestion};+use crate::{Document, Lint, TokenStringExt};/// Linter that checks to make sure small integers (< one hundred) are spelled/// out.diff --git a/harper-core/src/linting/wrong_quotes.rs b/harper-core/src/linting/wrong_quotes.rsindex 4b9f9fd9f..e22e5848f 100644--- a/harper-core/src/linting/wrong_quotes.rs+++ b/harper-core/src/linting/wrong_quotes.rs@@ -1,6 +1,6 @@-use super::{Lint, Linter};+use super::{Lint, Linter, Suggestion};use crate::document::Document;-use crate::{Suggestion, Token, TokenStringExt};+use crate::{Token, TokenStringExt};#[derive(Debug, Clone, Copy, Default)]pub struct WrongQuotes;diff --git a/harper-core/src/mask/mod.rs b/harper-core/src/mask/mod.rsindex 5b87edae0..b2c10e75c 100644--- a/harper-core/src/mask/mod.rs+++ b/harper-core/src/mask/mod.rs@@ -4,10 +4,15 @@ use crate::Span;/// being parsed. They can be composed to do things like isolate comments from a/// programming language or disable linting for languages that have been/// determined to not be English.+///+/// This is primarily used by [`crate::parsers::Mask`] to create parsers for+/// things like comments of programming languages.pub trait Masker: Send + Sync {fn create_mask(&mut self, source: &[char]) -> Mask;}+/// Identifies portions of a [`char`] sequence that should __not__ be ignored by+/// Harper.pub struct Mask {// Right now, there aren't any use-cases where we can't treat this as a stack.//diff --git a/harper-core/src/span.rs b/harper-core/src/span.rsindex 8411e2280..4783805c3 100644--- a/harper-core/src/span.rs+++ b/harper-core/src/span.rs@@ -2,7 +2,7 @@ use std::ops::Range;use serde::{Deserialize, Serialize};-/// A window in a [char].+/// A window in a [`char`] sequence.#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default, PartialEq, Eq)]pub struct Span {pub start: usize,diff --git a/harper-core/src/spell/dictionary.rs b/harper-core/src/spell/dictionary.rsindex 8fce77296..3fc31d2b7 100644--- a/harper-core/src/spell/dictionary.rs+++ b/harper-core/src/spell/dictionary.rs@@ -5,19 +5,29 @@ use crate::WordMetadata;#[cfg(not(feature = "concurrent"))]#[blanket(derive(Rc))]pub trait Dictionary: Clone {+ /// Check if the dictionary contains a given word.fn contains_word(&self, word: &[char]) -> bool;+ /// Produce an iterator over all words in the dictionary.fn words_iter(&self) -> impl Iterator<Item = &'_ [char]>;/// Iterate over all the words in the dictionary of a given lengthfn words_with_len_iter(&self, len: usize) -> Box<dyn Iterator<Item = &'_ [char]> + '_>;+ /// Get the associated [`WordMetadata`] for a given word.+ /// If the word isn't in the dictionary, the resulting metadata will be+ /// empty.fn get_word_metadata(&self, word: &[char]) -> WordMetadata;}#[cfg(feature = "concurrent")]#[blanket(derive(Arc))]pub trait Dictionary: Send + Sync + Clone {+ /// Check if the dictionary contains a given word.fn contains_word(&self, word: &[char]) -> bool;+ /// Produce an iterator over all words in the dictionary.fn words_iter(&self) -> impl Iterator<Item = &'_ [char]>;/// Iterate over all the words in the dictionary of a given lengthfn words_with_len_iter(&self, len: usize) -> Box<dyn Iterator<Item = &'_ [char]> + '_>;+ /// Get the associated [`WordMetadata`] for a given word.+ /// If the word isn't in the dictionary, the resulting metadata will be+ /// empty.fn get_word_metadata(&self, word: &[char]) -> WordMetadata;}diff --git a/harper-core/src/spell/full_dictionary.rs b/harper-core/src/spell/full_dictionary.rsindex 9d2ad07be..16f681dbb 100644--- a/harper-core/src/spell/full_dictionary.rs+++ b/harper-core/src/spell/full_dictionary.rs@@ -7,7 +7,7 @@ use super::seq_to_normalized;use crate::{CharString, Lrc, WordMetadata};/// A full, fat dictionary.-/// All of the elements are stored in-memory.+/// All elements are stored in-memory.#[derive(Debug, Clone, Eq, PartialEq)]pub struct FullDictionary {/// Storing a separate [`Vec`] for iterations speeds up spellchecking by@@ -25,6 +25,8 @@ pub struct FullDictionary {word_map: HashMap<CharString, WordMetadata>}+/// The uncached function that is used to produce the original copy of the+/// curated dictionary.fn uncached_inner_new() -> Lrc<FullDictionary> {let word_list = parse_default_word_list().unwrap();let attr_list = parse_default_attribute_list();@@ -61,7 +63,7 @@ impl FullDictionary {}}- /// Create a dictionary from the curated Hunspell dictionary included+ /// Create a dictionary from the curated dictionary included/// in the Harper binary.pub fn curated() -> Lrc<Self> {DICT.with(|v| v.clone())diff --git a/harper-core/tests/run_tests.rs b/harper-core/tests/run_tests.rsindex 31f635ea2..48e179df5 100644--- a/harper-core/tests/run_tests.rs+++ b/harper-core/tests/run_tests.rs@@ -1,4 +1,5 @@-use harper_core::{Document, FullDictionary, LintGroup, LintGroupConfig, Linter};+use harper_core::linting::{LintGroup, LintGroupConfig, Linter};+use harper_core::{Document, FullDictionary};/// Creates a unit test checking that the linting of a Markdown document (in/// `tests_sources`) produces the expected number of lints.diff --git a/harper-html/tests/run_tests.rs b/harper-html/tests/run_tests.rsindex 6092fc7ca..72647bcbc 100644--- a/harper-html/tests/run_tests.rs+++ b/harper-html/tests/run_tests.rs@@ -1,4 +1,5 @@-use harper_core::{Document, FullDictionary, LintGroup, LintGroupConfig, Linter};+use harper_core::linting::{LintGroup, LintGroupConfig, Linter};+use harper_core::{Document, FullDictionary};/// Creates a unit test checking that the linting of a Markdown document (in/// `tests_sources`) produces the expected number of lints.diff --git a/harper-ls/src/backend.rs b/harper-ls/src/backend.rsindex 2da558c4e..495ab4cae 100644--- a/harper-ls/src/backend.rs+++ b/harper-ls/src/backend.rs@@ -4,13 +4,12 @@ use std::sync::Arc;use anyhow::anyhow;use harper_comments::CommentParser;+use harper_core::linting::{LintGroup, Linter};use harper_core::parsers::{Markdown, PlainEnglish};use harper_core::{Dictionary,Document,FullDictionary,- LintGroup,- Linter,Lrc,MergedDictionary,Token,diff --git a/harper-ls/src/config.rs b/harper-ls/src/config.rsindex fa761e62a..5c39b8476 100644--- a/harper-ls/src/config.rs+++ b/harper-ls/src/config.rs@@ -1,7 +1,7 @@use std::path::PathBuf;use dirs::{config_dir, data_local_dir};-use harper_core::LintGroupConfig;+use harper_core::linting::LintGroupConfig;use resolve_path::PathResolveExt;use serde::{Deserialize, Serialize};use serde_json::Value;diff --git a/harper-ls/src/diagnostics.rs b/harper-ls/src/diagnostics.rsindex 7f9d2d124..f12929fcd 100644--- a/harper-ls/src/diagnostics.rs+++ b/harper-ls/src/diagnostics.rs@@ -1,6 +1,6 @@use std::collections::HashMap;-use harper_core::{Lint, Suggestion};+use harper_core::linting::{Lint, Suggestion};use tower_lsp::lsp_types::{CodeAction,CodeActionKind,diff --git a/harper-wasm/src/lib.rs b/harper-wasm/src/lib.rsindex 0d1c4d5c2..72921e672 100644--- a/harper-wasm/src/lib.rs+++ b/harper-wasm/src/lib.rs@@ -2,8 +2,9 @@use std::sync::Mutex;+use harper_core::linting::{LintGroup, Linter};use harper_core::parsers::Markdown;-use harper_core::{remove_overlaps, Document, FullDictionary, LintGroup, Linter, Lrc};+use harper_core::{remove_overlaps, Document, FullDictionary, Lrc};use once_cell::sync::Lazy;use wasm_bindgen::prelude::wasm_bindgen;@@ -62,7 +63,7 @@ pub fn apply_suggestion(let span: harper_core::Span = span.into();match &suggestion.inner {- harper_core::Suggestion::ReplaceWith(chars) => {+ harper_core::linting::Suggestion::ReplaceWith(chars) => {// Avoid allocation if possibleif chars.len() == span.len() {for (index, c) in chars.iter().enumerate() {@@ -75,7 +76,7 @@ pub fn apply_suggestion(source.extend(popped.into_iter().skip(span.len()));}}- harper_core::Suggestion::Remove => {+ harper_core::linting::Suggestion::Remove => {for i in span.end..source.len() {source[i - span.len()] = source[i];}@@ -89,7 +90,7 @@ pub fn apply_suggestion(#[wasm_bindgen]pub struct Suggestion {- inner: harper_core::Suggestion+ inner: harper_core::linting::Suggestion}#[wasm_bindgen]@@ -100,7 +101,7 @@ pub enum SuggestionKind {#[wasm_bindgen]impl Suggestion {- pub(crate) fn new(inner: harper_core::Suggestion) -> Self {+ pub(crate) fn new(inner: harper_core::linting::Suggestion) -> Self {Self { inner }}@@ -109,28 +110,28 @@ impl Suggestion {/// string.pub fn get_replacement_text(&self) -> String {match &self.inner {- harper_core::Suggestion::Remove => "".to_string(),- harper_core::Suggestion::ReplaceWith(chars) => chars.iter().collect()+ harper_core::linting::Suggestion::Remove => "".to_string(),+ harper_core::linting::Suggestion::ReplaceWith(chars) => chars.iter().collect()}}pub fn kind(&self) -> SuggestionKind {match &self.inner {- harper_core::Suggestion::Remove => SuggestionKind::Remove,- harper_core::Suggestion::ReplaceWith(_) => SuggestionKind::Replace+ harper_core::linting::Suggestion::Remove => SuggestionKind::Remove,+ harper_core::linting::Suggestion::ReplaceWith(_) => SuggestionKind::Replace}}}#[wasm_bindgen]pub struct Lint {- inner: harper_core::Lint,+ inner: harper_core::linting::Lint,source: Lrc<Vec<char>>}#[wasm_bindgen]impl Lint {- pub(crate) fn new(inner: harper_core::Lint, source: Lrc<Vec<char>>) -> Self {+ pub(crate) fn new(inner: harper_core::linting::Lint, source: Lrc<Vec<char>>) -> Self {Self { inner, source }}