10796: ide: display static values in hover r=Veykril a=jhgg

Continuation from #10785 - does the same thing, but for `static`'s as well.

Co-authored-by: Jake Heinz <jh@discordapp.com>
This commit is contained in:
bors[bot] 2021-11-18 09:48:10 +00:00 committed by GitHub
commit bf8cf09967
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 20 deletions

View file

@ -1497,6 +1497,10 @@ impl Static {
db.static_data(self.id).mutable
}
pub fn value(self, db: &dyn HirDatabase) -> Option<ast::Expr> {
self.source(db)?.value.body()
}
pub fn ty(self, db: &dyn HirDatabase) -> Type {
let data = db.static_data(self.id);
let resolver = self.id.resolver(db.upcast());