mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-17 18:57:04 +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
|
|
@ -990,7 +990,7 @@ impl t for foo {
|
|||
fn test_injection() {
|
||||
check_highlighting(
|
||||
r##"
|
||||
fn fixture(ra_fixture: &str) {}
|
||||
fn fixture(#[rust_analyzer::rust_fixture] ra_fixture: &str) {}
|
||||
|
||||
fn main() {
|
||||
fixture(r#"
|
||||
|
|
@ -1188,7 +1188,11 @@ fn foo(x: &fn(&dyn Trait)) {}
|
|||
/// Highlights the code given by the `ra_fixture` argument, renders the
|
||||
/// result as HTML, and compares it with the HTML file given as `snapshot`.
|
||||
/// Note that the `snapshot` file is overwritten by the rendered HTML.
|
||||
fn check_highlighting(ra_fixture: &str, expect: ExpectFile, rainbow: bool) {
|
||||
fn check_highlighting(
|
||||
#[rust_analyzer::rust_fixture] ra_fixture: &str,
|
||||
expect: ExpectFile,
|
||||
rainbow: bool,
|
||||
) {
|
||||
let (analysis, file_id) = fixture::file(ra_fixture.trim());
|
||||
let actual_html = &analysis.highlight_as_html(file_id, rainbow).unwrap();
|
||||
expect.assert_eq(actual_html)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue