mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +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
|
@ -2,8 +2,8 @@
|
|||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use base_db::FileId;
|
||||
use hir::{ItemInNs, ModuleDef, Name, Semantics};
|
||||
use base_db::{FileId, SourceDatabaseExt};
|
||||
use hir::{Crate, ItemInNs, ModuleDef, Name, Semantics};
|
||||
use syntax::{
|
||||
ast::{self, make},
|
||||
AstToken, SyntaxKind, SyntaxToken, TokenAtOffset,
|
||||
|
@ -103,3 +103,9 @@ pub fn lint_eq_or_in_group(lint: &str, lint_is: &str) -> bool {
|
|||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_editable_crate(krate: Crate, db: &RootDatabase) -> bool {
|
||||
let root_file = krate.root_file(db);
|
||||
let source_root_id = db.file_source_root(root_file);
|
||||
!db.source_root(source_root_id).is_library
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue