11use crate :: core:: diagnostics:: { create_diagnostic, DiagnosticCode } ;
22use crate :: core:: entry_point:: EntryPointType ;
33use crate :: core:: file_mgr:: AstType ;
4+ use crate :: core:: symbols:: symbol:: SymbolPath ;
45use crate :: core:: xml_data:: OdooData ;
56use crate :: core:: xml_validation:: XmlValidator ;
67use crate :: features:: document_symbols:: DocumentSymbolFeature ;
@@ -468,8 +469,10 @@ impl SyncOdoo {
468469 fn build_modules ( session : & mut SessionInfo ) {
469470 {
470471 let addons_symbol = session. sync_odoo . get_symbol ( session. sync_odoo . config . odoo_path . as_ref ( ) . unwrap ( ) , & tree ( vec ! [ "odoo" , "addons" ] , vec ! [ ] ) , u32:: MAX ) [ 0 ] . clone ( ) ;
471- let addons_path = addons_symbol. borrow ( ) . paths ( ) . clone ( ) ;
472- for addon_path in addons_path. iter ( ) {
472+ let SymbolPath :: Multiple ( addons_paths) = addons_symbol. borrow ( ) . path ( ) else {
473+ panic ! ( "Odoo addons symbol paths should be a namespace" ) ;
474+ } ;
475+ for addon_path in addons_paths. iter ( ) {
473476 info ! ( "searching modules in {}" , addon_path) ;
474477 if PathBuf :: from ( addon_path) . exists ( ) {
475478 //browse all dir in path
@@ -756,7 +759,7 @@ impl SyncOdoo {
756759
757760 pub fn add_to_rebuild_arch ( & mut self , symbol : Rc < RefCell < Symbol > > ) {
758761 if DEBUG_THREADS {
759- trace ! ( "ADDED TO ARCH - {}" , symbol. borrow( ) . paths ( ) . first ( ) . unwrap_or ( & symbol. borrow( ) . name ( ) . to_string ( ) ) ) ;
762+ trace ! ( "ADDED TO ARCH - {} - {:?} " , symbol. borrow( ) . name ( ) , symbol. borrow( ) . path ( ) ) ;
760763 }
761764 if symbol. borrow ( ) . build_status ( BuildSteps :: ARCH ) != BuildStatus :: IN_PROGRESS {
762765 let sym_clone = symbol. clone ( ) ;
@@ -770,7 +773,7 @@ impl SyncOdoo {
770773
771774 pub fn add_to_rebuild_arch_eval ( & mut self , symbol : Rc < RefCell < Symbol > > ) {
772775 if DEBUG_THREADS {
773- trace ! ( "ADDED TO EVAL - {}" , symbol. borrow( ) . paths ( ) . first ( ) . unwrap_or ( & symbol. borrow( ) . name ( ) . to_string ( ) ) ) ;
776+ trace ! ( "ADDED TO EVAL - {} - {:?} " , symbol. borrow( ) . name ( ) , symbol. borrow( ) . path ( ) ) ;
774777 }
775778 if symbol. borrow ( ) . build_status ( BuildSteps :: ARCH_EVAL ) != BuildStatus :: IN_PROGRESS {
776779 let sym_clone = symbol. clone ( ) ;
@@ -783,7 +786,7 @@ impl SyncOdoo {
783786
784787 pub fn add_to_validations ( & mut self , symbol : Rc < RefCell < Symbol > > ) {
785788 if DEBUG_THREADS {
786- trace ! ( "ADDED TO VALIDATION - {}" , symbol. borrow( ) . paths ( ) . first ( ) . unwrap_or ( & symbol. borrow( ) . name ( ) . to_string ( ) ) ) ;
789+ trace ! ( "ADDED TO VALIDATION - {} - {:?} " , symbol. borrow( ) . name ( ) , symbol. borrow( ) . path ( ) ) ;
787790 }
788791 if symbol. borrow ( ) . build_status ( BuildSteps :: VALIDATION ) != BuildStatus :: IN_PROGRESS {
789792 symbol. borrow_mut ( ) . set_build_status ( BuildSteps :: VALIDATION , BuildStatus :: PENDING ) ;
@@ -805,10 +808,10 @@ impl SyncOdoo {
805808 }
806809 if DEBUG_REBUILD_NOW {
807810 if symbol. borrow ( ) . build_status ( step) == BuildStatus :: INVALID {
808- panic ! ( "Trying to build an invalid symbol: {}" , symbol. borrow( ) . paths ( ) . first ( ) . unwrap_or ( & symbol. borrow( ) . name ( ) . to_string ( ) ) ) ;
811+ panic ! ( "Trying to build an invalid symbol: {} - {:?} " , symbol. borrow( ) . name ( ) , symbol. borrow( ) . path ( ) ) ;
809812 }
810813 if symbol. borrow ( ) . build_status ( step) == BuildStatus :: IN_PROGRESS && !session. sync_odoo . is_in_rebuild ( & symbol, step) {
811- error ! ( "Trying to build a symbol that is NOT in the queue: {}" , symbol. borrow( ) . paths ( ) . first ( ) . unwrap_or ( & symbol. borrow( ) . name ( ) . to_string ( ) ) ) ;
814+ error ! ( "Trying to build a symbol that is NOT in the queue: {} - {:?} " , symbol. borrow( ) . name ( ) , symbol. borrow( ) . path ( ) ) ;
812815 }
813816 }
814817 if symbol. borrow ( ) . build_status ( step) == BuildStatus :: PENDING && symbol. borrow ( ) . previous_step_done ( step) {
@@ -822,7 +825,7 @@ impl SyncOdoo {
822825 } else if step == BuildSteps :: ARCH_EVAL {
823826 if DEBUG_REBUILD_NOW {
824827 if symbol. borrow ( ) . build_status ( BuildSteps :: ARCH ) != BuildStatus :: DONE {
825- panic ! ( "An evaluation has been requested on a non-arched symbol: {}" , symbol. borrow( ) . paths ( ) . first ( ) . unwrap_or ( & symbol. borrow( ) . name ( ) . to_string ( ) ) ) ;
828+ panic ! ( "An evaluation has been requested on a non-arched symbol: {} - {:?} " , symbol. borrow( ) . name ( ) , symbol. borrow( ) . path ( ) ) ;
826829 }
827830 }
828831 let mut builder = PythonArchEval :: new ( entry_point, symbol. clone ( ) ) ;
@@ -831,7 +834,7 @@ impl SyncOdoo {
831834 } else if step == BuildSteps :: VALIDATION {
832835 if DEBUG_REBUILD_NOW {
833836 if symbol. borrow ( ) . build_status ( BuildSteps :: ARCH ) != BuildStatus :: DONE || symbol. borrow ( ) . build_status ( BuildSteps :: ARCH_EVAL ) != BuildStatus :: DONE {
834- panic ! ( "An evaluation has been requested on a non-arched symbol: {}" , symbol. borrow( ) . paths ( ) . first ( ) . unwrap_or ( & symbol. borrow( ) . name ( ) . to_string ( ) ) ) ;
837+ panic ! ( "An evaluation has been requested on a non-arched symbol: {} - {:?} " , symbol. borrow( ) . name ( ) , symbol. borrow( ) . path ( ) ) ;
835838 }
836839 }
837840 let mut validator = PythonValidator :: new ( entry_point, symbol. clone ( ) ) ;
@@ -947,7 +950,10 @@ impl SyncOdoo {
947950 let mut to_del = Vec :: from_iter ( path_symbol. borrow ( ) . all_module_symbol ( ) . map ( |x| x. clone ( ) ) ) ;
948951 let mut index = 0 ;
949952 while index < to_del. len ( ) {
950- FileMgr :: delete_path ( session, & to_del[ index] . borrow ( ) . paths ( ) [ 0 ] ) ;
953+ match to_del[ index] . borrow ( ) . path ( ) {
954+ SymbolPath :: Single ( p) => FileMgr :: delete_path ( session, & p) ,
955+ SymbolPath :: Multiple ( _) | SymbolPath :: None => { }
956+ }
951957 let mut to_del_child = Vec :: from_iter ( to_del[ index] . borrow ( ) . all_module_symbol ( ) . map ( |x| x. clone ( ) ) ) ;
952958 to_del. append ( & mut to_del_child) ;
953959 index += 1 ;
0 commit comments