diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-09 09:33:46 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-09 09:33:46 +0000 |
commit | 57c27f91392fdd9d72fd023f4e2fecd8b68a7d09 (patch) | |
tree | 23e1e0216789b8b21183e07b10f97e2f57ae033c /crates/ra_ide/src/lib.rs | |
parent | 58ab084034b760367359334807c7f7773faf7f92 (diff) | |
parent | e1aa96f2c5b6cdbf0fb7f49b47209055b7a937f2 (diff) |
Merge #3519
3519: Show mod path on hover r=matklad a=SomeoneToIgnore
Closes #1064
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/lib.rs')
-rw-r--r-- | crates/ra_ide/src/lib.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 4dfe0553e..903624381 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -211,7 +211,13 @@ impl Analysis { | |||
211 | // Default to enable test for single file. | 211 | // Default to enable test for single file. |
212 | let mut cfg_options = CfgOptions::default(); | 212 | let mut cfg_options = CfgOptions::default(); |
213 | cfg_options.insert_atom("test".into()); | 213 | cfg_options.insert_atom("test".into()); |
214 | crate_graph.add_crate_root(file_id, Edition::Edition2018, cfg_options, Env::default()); | 214 | crate_graph.add_crate_root( |
215 | file_id, | ||
216 | Edition::Edition2018, | ||
217 | None, | ||
218 | cfg_options, | ||
219 | Env::default(), | ||
220 | ); | ||
215 | change.add_file(source_root, file_id, "main.rs".into(), Arc::new(text)); | 221 | change.add_file(source_root, file_id, "main.rs".into(), Arc::new(text)); |
216 | change.set_crate_graph(crate_graph); | 222 | change.set_crate_graph(crate_graph); |
217 | host.apply_change(change); | 223 | host.apply_change(change); |
@@ -415,12 +421,12 @@ impl Analysis { | |||
415 | 421 | ||
416 | /// Returns the edition of the given crate. | 422 | /// Returns the edition of the given crate. |
417 | pub fn crate_edition(&self, crate_id: CrateId) -> Cancelable<Edition> { | 423 | pub fn crate_edition(&self, crate_id: CrateId) -> Cancelable<Edition> { |
418 | self.with_db(|db| db.crate_graph().edition(crate_id)) | 424 | self.with_db(|db| db.crate_graph().crate_data(&crate_id).edition) |
419 | } | 425 | } |
420 | 426 | ||
421 | /// Returns the root file of the given crate. | 427 | /// Returns the root file of the given crate. |
422 | pub fn crate_root(&self, crate_id: CrateId) -> Cancelable<FileId> { | 428 | pub fn crate_root(&self, crate_id: CrateId) -> Cancelable<FileId> { |
423 | self.with_db(|db| db.crate_graph().crate_root(crate_id)) | 429 | self.with_db(|db| db.crate_graph().crate_data(&crate_id).root_file_id) |
424 | } | 430 | } |
425 | 431 | ||
426 | /// Returns the set of possible targets to run for the current file. | 432 | /// Returns the set of possible targets to run for the current file. |