11use glob:: glob;
22use lsp_types:: { Diagnostic , DiagnosticSeverity , DiagnosticTag , NumberOrString , Position , Range } ;
3- use tracing:: { error, info } ;
3+ use tracing:: error;
44use std:: collections:: { HashMap , HashSet } ;
55use std:: rc:: Rc ;
66use std:: cell:: RefCell ;
@@ -12,8 +12,8 @@ use crate::{constants::*, oyarn, Sy, S};
1212use crate :: threads:: SessionInfo ;
1313use crate :: utils:: { is_dir_cs, is_file_cs, PathSanitizer } ;
1414
15- use super :: entry_point:: { self , EntryPoint , EntryPointType } ;
16- use super :: file_mgr:: { add_diagnostic, NoqaInfo } ;
15+ use super :: entry_point:: { EntryPoint , EntryPointType } ;
16+ use super :: file_mgr:: add_diagnostic;
1717use super :: odoo:: SyncOdoo ;
1818use super :: symbols:: symbol:: Symbol ;
1919
@@ -185,24 +185,15 @@ pub fn find_module(session: &mut SessionInfo, odoo_addons: Rc<RefCell<Symbol>>,
185185 let paths = ( * odoo_addons) . borrow ( ) . paths ( ) . clone ( ) ;
186186 for path in paths. iter ( ) {
187187 let full_path = Path :: new ( path. as_str ( ) ) . join ( name. as_str ( ) ) ;
188- if is_dir_cs ( full_path. sanitize ( ) ) {
189- let _arc_symbol = Symbol :: create_from_path ( session, & full_path, odoo_addons. clone ( ) , false ) ;
190- if _arc_symbol. is_some ( ) {
191- let typ = _arc_symbol. as_ref ( ) . unwrap ( ) . borrow ( ) . typ ( ) ;
192- match typ {
193- SymType :: NAMESPACE => {
194- return Some ( _arc_symbol. as_ref ( ) . unwrap ( ) . clone ( ) ) ;
195- } ,
196- SymType :: PACKAGE ( _) => {
197- let _arc_symbol = _arc_symbol. as_ref ( ) . unwrap ( ) . clone ( ) ;
198- session. sync_odoo . modules . insert ( name. clone ( ) , Rc :: downgrade ( & _arc_symbol) ) ;
199- session. sync_odoo . add_to_rebuild_arch ( _arc_symbol. clone ( ) ) ;
200- return Some ( _arc_symbol) ;
201- } ,
202- _ => { return None }
203- }
204- }
188+ if !is_dir_cs ( full_path. sanitize ( ) ) {
189+ continue ;
205190 }
191+ let Some ( module_symbol) = Symbol :: create_from_path ( session, & full_path, odoo_addons. clone ( ) , true ) else {
192+ continue ;
193+ } ;
194+ session. sync_odoo . modules . insert ( name. clone ( ) , Rc :: downgrade ( & module_symbol) ) ;
195+ session. sync_odoo . add_to_rebuild_arch ( module_symbol. clone ( ) ) ;
196+ return Some ( module_symbol. clone ( ) ) ;
206197 }
207198 None
208199}
0 commit comments