mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
update for review
This commit is contained in:
parent
2e87f31fe9
commit
dba67b46a1
10 changed files with 65 additions and 39 deletions
|
@ -32,7 +32,7 @@ pub struct HoverConfig {
|
|||
pub documentation: bool,
|
||||
pub keywords: bool,
|
||||
pub format: HoverDocFormat,
|
||||
pub trait_item_display_num: Option<usize>,
|
||||
pub trait_assoc_items_size: Option<usize>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
|
|
|
@ -8,7 +8,7 @@ use hir::{
|
|||
};
|
||||
use ide_db::{
|
||||
base_db::SourceDatabase,
|
||||
defs::{Definition, HoverDisplayConfig},
|
||||
defs::Definition,
|
||||
documentation::HasDocs,
|
||||
famous_defs::FamousDefs,
|
||||
generated::lints::{CLIPPY_LINTS, DEFAULT_LINTS, FEATURES},
|
||||
|
@ -406,8 +406,12 @@ pub(super) fn definition(
|
|||
config: &HoverConfig,
|
||||
) -> Markup {
|
||||
let mod_path = definition_mod_path(db, &def);
|
||||
let hover_config = HoverDisplayConfig { trait_item_display_num: config.trait_item_display_num };
|
||||
let label = def.label(db, hover_config);
|
||||
let label = match def {
|
||||
Definition::Trait(trait_) => {
|
||||
trait_.display_limited(db, config.trait_assoc_items_size).to_string()
|
||||
}
|
||||
_ => def.label(db),
|
||||
};
|
||||
let docs = def.docs(db, famous_defs);
|
||||
let value = (|| match def {
|
||||
Definition::Variant(it) => {
|
||||
|
|
|
@ -17,7 +17,7 @@ const HOVER_BASE_CONFIG: HoverConfig = HoverConfig {
|
|||
documentation: true,
|
||||
format: HoverDocFormat::Markdown,
|
||||
keywords: true,
|
||||
trait_item_display_num: Some(7),
|
||||
trait_assoc_items_size: None,
|
||||
};
|
||||
|
||||
fn check_hover_no_result(ra_fixture: &str) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use hir::{db::HirDatabase, Crate, HirFileIdExt, Module, Semantics};
|
||||
use ide_db::{
|
||||
base_db::{FileId, FileRange, SourceDatabaseExt},
|
||||
defs::{Definition, HoverDisplayConfig},
|
||||
defs::Definition,
|
||||
documentation::Documentation,
|
||||
famous_defs::FamousDefs,
|
||||
helpers::get_definition,
|
||||
|
@ -166,7 +166,7 @@ impl StaticIndex<'_> {
|
|||
documentation: true,
|
||||
keywords: true,
|
||||
format: crate::HoverDocFormat::Markdown,
|
||||
trait_item_display_num: None,
|
||||
trait_assoc_items_size: None,
|
||||
};
|
||||
let tokens = tokens.filter(|token| {
|
||||
matches!(
|
||||
|
@ -197,7 +197,7 @@ impl StaticIndex<'_> {
|
|||
enclosing_moniker: current_crate
|
||||
.zip(def.enclosing_definition(self.db))
|
||||
.and_then(|(cc, enclosing_def)| def_to_moniker(self.db, enclosing_def, cc)),
|
||||
signature: Some(def.label(self.db, HoverDisplayConfig::default())),
|
||||
signature: Some(def.label(self.db)),
|
||||
kind: def_to_kind(self.db, def),
|
||||
});
|
||||
self.def_map.insert(def, it);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue