[ty] Invert ty_ide and ty_project dependency (#19501)

This commit is contained in:
Micha Reiser 2025-07-23 09:37:46 +02:00 committed by GitHub
parent 53d795da67
commit c281891b5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 27 additions and 143 deletions

View file

@ -1,5 +1,4 @@
mod completion;
mod db;
mod docstring;
mod find_node;
mod goto;
@ -14,7 +13,6 @@ mod signature_help;
mod stub_mapping;
pub use completion::completion;
pub use db::Db;
pub use docstring::get_parameter_documentation;
pub use goto::{goto_declaration, goto_definition, goto_type_definition};
pub use hover::hover;
@ -29,6 +27,7 @@ use ruff_db::files::{File, FileRange};
use ruff_text_size::{Ranged, TextRange};
use rustc_hash::FxHashSet;
use std::ops::{Deref, DerefMut};
use ty_project::Db;
use ty_python_semantic::types::{Type, TypeDefinition};
/// Information associated with a text range.
@ -211,13 +210,13 @@ impl HasNavigationTargets for TypeDefinition<'_> {
#[cfg(test)]
mod tests {
use crate::db::tests::TestDb;
use insta::internals::SettingsBindDropGuard;
use ruff_db::Db;
use ruff_db::diagnostic::{Diagnostic, DiagnosticFormat, DisplayDiagnosticConfig};
use ruff_db::files::{File, system_path_to_file};
use ruff_db::system::{DbWithWritableSystem, SystemPath, SystemPathBuf};
use ruff_text_size::TextSize;
use ty_project::ProjectMetadata;
use ty_python_semantic::{
Program, ProgramSettings, PythonPlatform, PythonVersionWithSource, SearchPathSettings,
};
@ -231,7 +230,7 @@ mod tests {
}
pub(super) struct CursorTest {
pub(super) db: TestDb,
pub(super) db: ty_project::TestDb,
pub(super) cursor: Cursor,
_insta_settings_guard: SettingsBindDropGuard,
}
@ -286,7 +285,11 @@ mod tests {
impl CursorTestBuilder {
pub(super) fn build(&self) -> CursorTest {
let mut db = TestDb::new();
let mut db = ty_project::TestDb::new(ProjectMetadata::new(
"test".into(),
SystemPathBuf::from("/"),
));
let mut cursor: Option<Cursor> = None;
for &Source {
ref path,