Auto merge of #16349 - Young-Flash:use_error_recovery, r=Veykril

fix: add error recovery for use_tree_list parsing

This PR adds error recovery for USE_TREE_LIST parsing, avoid the wrong USE_TREE_LIST making the rest parsing incorrectly.

before

![before](c6643690-f25c-4ad9-93d9-e661ba5b1dc3)

after

![after](30a58c40-2711-48d2-b2e5-fb208fc8636c)

close https://github.com/rust-lang/rust-analyzer/issues/16227
This commit is contained in:
bors 2024-01-18 09:52:37 +00:00
commit 1ab8c7fd27
5 changed files with 112 additions and 38 deletions

View file

@ -8,6 +8,33 @@ fn check(ra_fixture: &str, expect: Expect) {
expect.assert_eq(&actual)
}
#[test]
fn use_tree_completion() {
check(
r#"
struct implThing;
use crate::{impl$0};
"#,
expect![[r#"
st implThing implThing
kw self
"#]],
);
check(
r#"
struct implThing;
use crate::{impl$0;
"#,
expect![[r#"
st implThing implThing
kw self
"#]],
);
}
#[test]
fn use_tree_start() {
cov_mark::check!(unqualified_path_selected_only);