mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Prevent being able to rename items that are not part of the workspace
This commit is contained in:
parent
75371eb0fa
commit
c447a795ab
10 changed files with 92 additions and 15 deletions
|
@ -244,6 +244,12 @@ impl Analysis {
|
|||
self.with_db(|db| db.parse(file_id).tree())
|
||||
}
|
||||
|
||||
/// Returns true if this file belongs to an immutable library.
|
||||
pub fn is_library_file(&self, file_id: FileId) -> Cancelable<bool> {
|
||||
use ide_db::base_db::SourceDatabaseExt;
|
||||
self.with_db(|db| db.source_root(db.file_source_root(file_id)).is_library)
|
||||
}
|
||||
|
||||
/// Gets the file's `LineIndex`: data structure to convert between absolute
|
||||
/// offsets and line/column representation.
|
||||
pub fn file_line_index(&self, file_id: FileId) -> Cancelable<Arc<LineIndex>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue