Skip to content

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

fix(ls): duplicate lints (#1490)

Elijah Potter49fcf8546d78
diff --git a/harper-core/src/linting/phrase_corrections/mod.rs b/harper-core/src/linting/phrase_corrections/mod.rs
index a092c93c9..8c629bf72 100644
--- a/harper-core/src/linting/phrase_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_corrections/mod.rs
@@ -161,12 +161,6 @@ pub fn lint_group() -> LintGroup {
"Did you mean `bad rap`?",
"Changes `bed rap` to the proper idiom `bad rap`."
),
- "BaitedBreath" => (
- ["baited breath"],
- ["bated breath"],
- "Did you mean `bated breath`?",
- "Ensures `bated breath` is written correctly, as `baited breath` is incorrect."
- ),
"BanTogether" => (
["ban together"],
["band together"],
diff --git a/harper-ls/src/document_state.rs b/harper-ls/src/document_state.rs
index 626dfc020..a489275a7 100644
--- a/harper-ls/src/document_state.rs
+++ b/harper-ls/src/document_state.rs
@@ -2,7 +2,9 @@ use crate::config::{CodeActionConfig, DiagnosticSeverity};
use crate::diagnostics::{lint_to_code_actions, lints_to_diagnostics};
use crate::pos_conv::range_to_span;
use harper_core::linting::{Lint, LintGroup, Linter};
-use harper_core::{Document, IgnoredLints, MergedDictionary, MutableDictionary, TokenKind};
+use harper_core::{
+ Document, IgnoredLints, MergedDictionary, MutableDictionary, TokenKind, remove_overlaps,
+};
use harper_core::{Lrc, Token};
use tower_lsp_server::lsp_types::{CodeActionOrCommand, Command, Diagnostic, Range, Uri};
@@ -29,6 +31,7 @@ impl DocumentState {
self.linter.config = temp;
+ remove_overlaps(&mut lints);
self.ignored_lints
.remove_ignored(&mut lints, &self.document);
diff --git a/packages/vscode-plugin/src/tests/suite/integration.test.ts b/packages/vscode-plugin/src/tests/suite/integration.test.ts
index cbee90222..2c2395e49 100644
--- a/packages/vscode-plugin/src/tests/suite/integration.test.ts
+++ b/packages/vscode-plugin/src/tests/suite/integration.test.ts
@@ -34,14 +34,14 @@ describe('Integration >', () => {
compareActualVsExpectedDiagnostics(
await waitForDiagnosticsChange(markdownUri),
createExpectedDiagnostics(
- {
- message: 'Did you mean to repeat this word?',
- range: createRange(2, 39, 2, 48),
- },
{
message: 'Did you mean to spell `errorz` this way?',
range: createRange(2, 26, 2, 32),
},
+ {
+ message: 'Did you mean to repeat this word?',
+ range: createRange(2, 39, 2, 48),
+ },
{
message: 'Did you mean to spell `realise` this way?',
range: createRange(4, 26, 4, 33),
@@ -130,14 +130,14 @@ describe('Integration >', () => {
async () => await config.update('dialect', 'British', ConfigurationTarget.Workspace),
),
createExpectedDiagnostics(
- {
- message: 'Did you mean to repeat this word?',
- range: createRange(2, 39, 2, 48),
- },
{
message: 'Did you mean to spell `errorz` this way?',
range: createRange(2, 26, 2, 32),
},
+ {
+ message: 'Did you mean to repeat this word?',
+ range: createRange(2, 39, 2, 48),
+ },
),
);