Skip to content

Commit 9376701

Browse files
committed
fix: exclude declartion
1 parent 75ee986 commit 9376701

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

crates/ide/src/references.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ pub(crate) fn find_all_refs(
181181
is_mut: matches!(def, Definition::Local(l) if l.is_mut(sema.db)),
182182
nav,
183183
}
184+
})
185+
.filter(|decl| {
186+
!(config.exclude_library_refs && is_library_file(sema.db, decl.nav.file_id))
184187
});
185188
ReferenceSearchResult { declaration, references }
186189
}
@@ -222,6 +225,11 @@ pub(crate) fn find_all_refs(
222225
}
223226
}
224227

228+
fn is_library_file(db: &RootDatabase, file_id: FileId) -> bool {
229+
let source_root = db.file_source_root(file_id).source_root_id(db);
230+
db.source_root(source_root).source_root(db).is_library
231+
}
232+
225233
pub(crate) fn find_defs(
226234
sema: &Semantics<'_, RootDatabase>,
227235
syntax: &SyntaxNode,

0 commit comments

Comments
 (0)