Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix: issue where repeated words would be flagged even if inside parenthesis

Elijah Potter49cca77182d5
diff --git a/README.md b/README.md
index 9315d9ca7..49b60044c 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,9 @@
<h1>Harper</h1>
</div>
+[![Build](https://github.com/chilipepperhott/harper/actions/workflows/build.yml/badge.svg)](https://github.com/chilipepperhott/harper/actions/workflows/build.yml)
+[![Rust Tests](https://github.com/chilipepperhott/harper/actions/workflows/rust-tests.yml/badge.svg)](https://github.com/chilipepperhott/harper/actions/workflows/rust-tests.yml)
+
Harper is a an English grammar checker designed to be _just right._
I created it after years of dealing with the shortcomings of the competition.
@@ -23,11 +26,7 @@ Harper is even small enough to load via [WebAssembly.](https://harper.elijahpott
## Installation
-Binary releases are coming soon, so if you are looking for a single file download, you'll have to wait.
+If you want to use Harper on your machine, you will want to look at the [documentation for
+`harper-ls`](./harper-ls/README.md), the Language Server Protocol implementation.
-However, if you happen to have [Rust installed](https://www.rust-lang.org/tools/install), you're in luck!
-To install `harper-ls`, the variant of Harper for text editors like Neovim, simply run:
-```bash
-cargo install harper-ls
-```
diff --git a/harper-core/README.md b/harper-core/README.md
index 0640d1877..94e56b4da 100644
--- a/harper-core/README.md
+++ b/harper-core/README.md
@@ -3,5 +3,5 @@
This is the core engine behind Harper.
Right now, it only exists to hold the core functioning of `harper-ls` and `harper-wasm` (and by extension the web interface).
-`harper-core` _is_ [available on crates.io](https://crates.io/crates/harper-core), however improving the API is currently not a high priority.
+`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.
diff --git a/harper-core/src/linting/repeated_words.rs b/harper-core/src/linting/repeated_words.rs
index f5e8b693f..eef650561 100644
--- a/harper-core/src/linting/repeated_words.rs
+++ b/harper-core/src/linting/repeated_words.rs
@@ -52,7 +52,6 @@ impl Default for RepeatedWords {
}
impl Linter for RepeatedWords {
- /// A linter that checks to make sure the first word of each sentence is capitalized.
fn lint(&mut self, document: &Document) -> Vec<Lint> {
let mut lints = Vec::new();
@@ -69,6 +68,10 @@ impl Linter for RepeatedWords {
if self.set.contains(word_a) && word_a == word_b {
let intervening_tokens = &sentence[idx_a + 1..*idx_b];
+ if intervening_tokens.iter().any(|t| !t.kind.is_whitespace()) {
+ continue;
+ }
+
// Detect and remove the whitespace between the repetitions.
let remove_end = tok_b.span.end;
diff --git a/harper-ls/README.md b/harper-ls/README.md
index 00f7ff776..8835c6b4d 100644
--- a/harper-ls/README.md
+++ b/harper-ls/README.md
@@ -1,4 +1,20 @@
# `harper-ls`
`harper-ls` is the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) frontend for [Harper](https://harper.elijahpotter.dev).
-Out of the box, it has built-in support for parsing the comments of most programming languages.
+Out of the box, it has built-in support for parsing the comments of most programming languages, as well as any and all markdown files.
+
+## Installation
+
+Binary releases are coming soon, so if you are looking for a single file download, you'll have to wait.
+
+However, if you happen to have [Rust installed](https://www.rust-lang.org/tools/install), you're in luck!
+To install `harper-ls`, the variant of Harper for text editors like Neovim, simply run:
+
+```bash
+cargo install harper-ls
+```
+
+### Neovim Setup
+
+Right now we only support using `nvim-lspconfig` to run Harper in Neovim.
+Refer to [the documentation](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#harper_ls) for more information.