mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 19:17:12 +00:00
Re-implement rust string highlighting via tool attribute
This commit is contained in:
parent
897f7e579e
commit
bf669dab84
72 changed files with 386 additions and 173 deletions
|
|
@ -69,27 +69,32 @@ fn setup_tracing() -> Option<tracing::subscriber::DefaultGuard> {
|
|||
}
|
||||
|
||||
#[track_caller]
|
||||
fn check_types(ra_fixture: &str) {
|
||||
fn check_types(#[rust_analyzer::rust_fixture] ra_fixture: &str) {
|
||||
check_impl(ra_fixture, false, true, false)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn check_types_source_code(ra_fixture: &str) {
|
||||
fn check_types_source_code(#[rust_analyzer::rust_fixture] ra_fixture: &str) {
|
||||
check_impl(ra_fixture, false, true, true)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn check_no_mismatches(ra_fixture: &str) {
|
||||
fn check_no_mismatches(#[rust_analyzer::rust_fixture] ra_fixture: &str) {
|
||||
check_impl(ra_fixture, true, false, false)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn check(ra_fixture: &str) {
|
||||
fn check(#[rust_analyzer::rust_fixture] ra_fixture: &str) {
|
||||
check_impl(ra_fixture, false, false, false)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn check_impl(ra_fixture: &str, allow_none: bool, only_types: bool, display_source: bool) {
|
||||
fn check_impl(
|
||||
#[rust_analyzer::rust_fixture] ra_fixture: &str,
|
||||
allow_none: bool,
|
||||
only_types: bool,
|
||||
display_source: bool,
|
||||
) {
|
||||
let _tracing = setup_tracing();
|
||||
let (db, files) = TestDB::with_many_files(ra_fixture);
|
||||
|
||||
|
|
@ -282,7 +287,7 @@ fn pat_node(
|
|||
})
|
||||
}
|
||||
|
||||
fn infer(ra_fixture: &str) -> String {
|
||||
fn infer(#[rust_analyzer::rust_fixture] ra_fixture: &str) -> String {
|
||||
infer_with_mismatches(ra_fixture, false)
|
||||
}
|
||||
|
||||
|
|
@ -520,13 +525,13 @@ fn ellipsize(mut text: String, max_len: usize) -> String {
|
|||
text
|
||||
}
|
||||
|
||||
fn check_infer(ra_fixture: &str, expect: Expect) {
|
||||
fn check_infer(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) {
|
||||
let mut actual = infer(ra_fixture);
|
||||
actual.push('\n');
|
||||
expect.assert_eq(&actual);
|
||||
}
|
||||
|
||||
fn check_infer_with_mismatches(ra_fixture: &str, expect: Expect) {
|
||||
fn check_infer_with_mismatches(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) {
|
||||
let mut actual = infer_with_mismatches(ra_fixture, true);
|
||||
actual.push('\n');
|
||||
expect.assert_eq(&actual);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue