From 8d305680e6560debaf7868c160112e07a7bea8a0 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 2 Mar 2021 14:41:01 +0100 Subject: Show docs on hover for keywords and primitives --- crates/ide_db/src/helpers.rs | 4 ++++ crates/ide_db/src/helpers/famous_defs_fixture.rs | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'crates/ide_db') diff --git a/crates/ide_db/src/helpers.rs b/crates/ide_db/src/helpers.rs index f9de8ce0e..3ff77400b 100644 --- a/crates/ide_db/src/helpers.rs +++ b/crates/ide_db/src/helpers.rs @@ -41,6 +41,10 @@ pub struct FamousDefs<'a, 'b>(pub &'a Semantics<'b, RootDatabase>, pub Option { pub const FIXTURE: &'static str = include_str!("helpers/famous_defs_fixture.rs"); + pub fn std(&self) -> Option { + self.find_crate("std") + } + pub fn core(&self) -> Option { self.find_crate("core") } diff --git a/crates/ide_db/src/helpers/famous_defs_fixture.rs b/crates/ide_db/src/helpers/famous_defs_fixture.rs index bb4e9666b..d3464ae17 100644 --- a/crates/ide_db/src/helpers/famous_defs_fixture.rs +++ b/crates/ide_db/src/helpers/famous_defs_fixture.rs @@ -129,3 +129,11 @@ pub mod prelude { } #[prelude_import] pub use prelude::*; +//- /libstd.rs crate:std deps:core +//! Signatures of traits, types and functions from the std lib for use in tests. + +/// Docs for return_keyword +mod return_keyword {} + +/// Docs for prim_str +mod prim_str {} -- cgit v1.2.3