mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
feat: allow generate_function
to generate in different local crate
This commit is contained in:
parent
943de55214
commit
bda2af71c6
4 changed files with 140 additions and 31 deletions
|
@ -6,13 +6,13 @@ mod tests;
|
|||
|
||||
use std::iter;
|
||||
|
||||
use base_db::SourceDatabaseExt;
|
||||
use hir::{
|
||||
HasAttrs, Local, Name, PathResolution, ScopeDef, Semantics, SemanticsScope, Type, TypeInfo,
|
||||
};
|
||||
use ide_db::{
|
||||
base_db::{FilePosition, SourceDatabase},
|
||||
famous_defs::FamousDefs,
|
||||
helpers::is_editable_crate,
|
||||
FxHashMap, FxHashSet, RootDatabase,
|
||||
};
|
||||
use syntax::{
|
||||
|
@ -525,10 +525,11 @@ impl<'a> CompletionContext<'a> {
|
|||
return Visible::No;
|
||||
}
|
||||
// If the definition location is editable, also show private items
|
||||
let root_file = defining_crate.root_file(self.db);
|
||||
let source_root_id = self.db.file_source_root(root_file);
|
||||
let is_editable = !self.db.source_root(source_root_id).is_library;
|
||||
return if is_editable { Visible::Editable } else { Visible::No };
|
||||
return if is_editable_crate(defining_crate, self.db) {
|
||||
Visible::Editable
|
||||
} else {
|
||||
Visible::No
|
||||
};
|
||||
}
|
||||
|
||||
if self.is_doc_hidden(attrs, defining_crate) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue