mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
New HirDisplay method for displaying sourcecode
This commit is contained in:
parent
d3eb9d8eaf
commit
fe93675e8a
4 changed files with 184 additions and 41 deletions
23
crates/ra_hir_ty/src/tests/display_source_code.rs
Normal file
23
crates/ra_hir_ty/src/tests/display_source_code.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
use super::displayed_source_at_pos;
|
||||
use crate::test_db::TestDB;
|
||||
use ra_db::fixture::WithFixture;
|
||||
|
||||
#[test]
|
||||
fn qualify_path_to_submodule() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
r#"
|
||||
//- /main.rs
|
||||
|
||||
mod foo {
|
||||
pub struct Foo;
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
let foo: foo::Foo = foo::Foo;
|
||||
foo<|>
|
||||
}
|
||||
|
||||
"#,
|
||||
);
|
||||
assert_eq!("foo::Foo", displayed_source_at_pos(&db, pos));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue