Skip to content

Commit 843030e

Browse files
committed
fix(ls): move ignore action to bottom and respect force_stable
1 parent 4da93ac commit 843030e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

harper-ls/src/diagnostics.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,7 @@ pub fn lint_to_code_actions<'a>(
2727
source: &'a [char],
2828
config: &CodeActionConfig,
2929
) -> Vec<CodeActionOrCommand> {
30-
let mut results = vec![CodeActionOrCommand::Command(Command {
31-
title: "Ignore grammatical error.".to_owned(),
32-
command: "HarperIgnoreLint".to_owned(),
33-
arguments: Some(vec![
34-
serde_json::Value::String(url.to_string()),
35-
serde_json::to_value(lint).unwrap(),
36-
]),
37-
})];
30+
let mut results = Vec::new();
3831

3932
results.extend(
4033
lint.suggestions
@@ -76,6 +69,15 @@ pub fn lint_to_code_actions<'a>(
7669
.map(CodeActionOrCommand::CodeAction),
7770
);
7871

72+
results.push(CodeActionOrCommand::Command(Command {
73+
title: "Ignore Harper error.".to_owned(),
74+
command: "HarperIgnoreLint".to_owned(),
75+
arguments: Some(vec![
76+
serde_json::Value::String(url.to_string()),
77+
serde_json::to_value(lint).unwrap(),
78+
]),
79+
}));
80+
7981
if lint.lint_kind.is_spelling() {
8082
let orig = lint.span.get_content_string(source);
8183

@@ -90,10 +92,10 @@ pub fn lint_to_code_actions<'a>(
9092
"HarperAddToFileDict".to_string(),
9193
Some(vec![orig.into(), url.to_string().into()]),
9294
)));
95+
}
9396

94-
if config.force_stable {
95-
results.reverse();
96-
}
97+
if config.force_stable {
98+
results.reverse();
9799
}
98100

99101
results

0 commit comments

Comments
 (0)