Skip to content

Commit

Permalink
Improve text fixture annotation removal regexp
Browse files Browse the repository at this point in the history
Summary:
We strip annotation lines from the output after applying a fix in tests.
This is done using a regular expression to pick up the `%% ^^^^ error: blah` comment lines.

Impriove this regex
- make the presence of the lightbulb indicating an available assist optional
- Deal more appropriately with annotations of the from `%%<^^ error: foo`

Reviewed By: perehonchuk

Differential Revision: D55966908

fbshipit-source-id: 32eca9f3479dd6c4fd48100c2306a11a8c4e81e2
  • Loading branch information
alanz authored and facebook-github-bot committed Apr 11, 2024
1 parent ca1a9b4 commit 110ce5f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion crates/base_db/src/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ pub fn remove_annotations(marker: Option<&str>, text: &str) -> String {
/// Check if the given line contains a `%% ^^^ 💡 some text` annotation
pub fn contains_annotation(line: &str) -> bool {
lazy_static! {
static ref RE: Regex = Regex::new(r"^\s*%%[\s<]+(\^)* +💡.*$").unwrap();
static ref RE: Regex = Regex::new(r"^\s*%%( +\^+|[<\^]+) +💡?.*$").unwrap();
}
RE.is_match(line)
}
Expand Down
1 change: 0 additions & 1 deletion crates/ide/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,6 @@ baz(1)->4.
baz()->
1.
%%^^^^^^^ 💡 warning: match is redundant
"#,
);
}
Expand Down
1 change: 0 additions & 1 deletion crates/ide/src/diagnostics/unused_include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,6 @@ foo() -> ok.
"#,
r#"
-module(main).
%%^^^^^^^^^^^^^^^^^^^^^^^ 💡 warning: Unused file: header.hrl
foo() -> ok.
Expand Down

0 comments on commit 110ce5f

Please sign in to comment.