Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/completion/src/render/macro_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ impl<'a> MacroRender<'a> {
fn render(&self, import_to_add: Option<ImportEdit>) -> Option<CompletionItem> {
// FIXME: Currently proc-macro do not have ast-node,
// such that it does not have source
// more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913
if self.macro_.is_proc_macro() {
return None;
}
Expand Down
6 changes: 6 additions & 0 deletions crates/hir/src/code_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,12 @@ impl MacroDef {

/// XXX: this parses the file
pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
// FIXME: Currently proc-macro do not have ast-node,
// such that it does not have source
// more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913
if self.is_proc_macro() {
return None;
}
self.source(db).value.name().map(|it| it.as_name())
}

Expand Down
10 changes: 9 additions & 1 deletion crates/ide/src/display/navigation_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ impl ToNav for FileSymbol {
impl TryToNav for Definition {
fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> {
match self {
Definition::Macro(it) => Some(it.to_nav(db)),
Definition::Macro(it) => {
// FIXME: Currently proc-macro do not have ast-node,
// such that it does not have source
// more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913
if it.is_proc_macro() {
return None;
}
Some(it.to_nav(db))
}
Definition::Field(it) => Some(it.to_nav(db)),
Definition::ModuleDef(it) => it.try_to_nav(db),
Definition::SelfType(it) => Some(it.to_nav(db)),
Expand Down
6 changes: 6 additions & 0 deletions crates/ide/src/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
let mod_path = definition_mod_path(db, &def);
return match def {
Definition::Macro(it) => {
// FIXME: Currently proc-macro do not have ast-node,
// such that it does not have source
// more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913
if it.is_proc_macro() {
return None;
}
let label = macro_label(&it.source(db).value);
from_def_source_labeled(db, it, Some(label), mod_path)
}
Expand Down