We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 75ee986 commit 9376701Copy full SHA for 9376701
1 file changed
crates/ide/src/references.rs
@@ -181,6 +181,9 @@ pub(crate) fn find_all_refs(
181
is_mut: matches!(def, Definition::Local(l) if l.is_mut(sema.db)),
182
nav,
183
}
184
+ })
185
+ .filter(|decl| {
186
+ !(config.exclude_library_refs && is_library_file(sema.db, decl.nav.file_id))
187
});
188
ReferenceSearchResult { declaration, references }
189
@@ -222,6 +225,11 @@ pub(crate) fn find_all_refs(
222
225
223
226
224
227
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
+
233
pub(crate) fn find_defs(
234
sema: &Semantics<'_, RootDatabase>,
235
syntax: &SyntaxNode,
0 commit comments