-
Notifications
You must be signed in to change notification settings - Fork 23
List namespace paths on hover + path-related refactors #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cammarosano
wants to merge
5
commits into
alpha
Choose a base branch
from
alpha-list_namespace_dirs-rcdl
base: alpha
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d2e8a97
[IMP] list namespace dirs on hover
cammarosano 2a68db2
[REF] remove paths from RootSymbol
cammarosano cebf89c
[REF] move add_path to NamespaceSymbol
cammarosano 0b7874c
[REF] path method in PackageSymbol
cammarosano 77d6151
[REF] symbol path handling with SymbolPath enum
cammarosano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| use crate::core::diagnostics::{create_diagnostic, DiagnosticCode}; | ||
| use crate::core::entry_point::EntryPointType; | ||
| use crate::core::file_mgr::AstType; | ||
| use crate::core::symbols::symbol::SymbolPath; | ||
| use crate::core::xml_data::OdooData; | ||
| use crate::core::xml_validation::XmlValidator; | ||
| use crate::features::document_symbols::DocumentSymbolFeature; | ||
|
|
@@ -443,7 +444,7 @@ impl SyncOdoo { | |
| let addon_symbol = addon_symbol[0].clone(); | ||
| if odoo_addon_path.exists() { | ||
| if session.sync_odoo.load_odoo_addons { | ||
| addon_symbol.borrow_mut().add_path( | ||
| addon_symbol.borrow_mut().as_namespace_mut().add_path( | ||
| odoo_addon_path.sanitize() | ||
| ); | ||
| EntryPointMgr::add_entry_to_addons(session, odoo_addon_path.sanitize(), | ||
|
|
@@ -457,7 +458,7 @@ impl SyncOdoo { | |
| for addon in session.sync_odoo.config.addons_paths.clone().iter() { | ||
| let addon_path = PathBuf::from(addon); | ||
| if addon_path.exists() { | ||
| addon_symbol.borrow_mut().add_path( | ||
| addon_symbol.borrow_mut().as_namespace_mut().add_path( | ||
| addon_path.sanitize() | ||
| ); | ||
| EntryPointMgr::add_entry_to_addons(session, addon.clone(), | ||
|
|
@@ -472,8 +473,10 @@ impl SyncOdoo { | |
| fn build_modules(session: &mut SessionInfo) { | ||
| { | ||
| 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(); | ||
| let addons_path = addons_symbol.borrow().paths().clone(); | ||
| for addon_path in addons_path.iter() { | ||
| let SymbolPath::Multiple(addons_paths) = addons_symbol.borrow().path() else { | ||
| panic!("Odoo addons symbol paths should be a namespace"); | ||
| }; | ||
| for addon_path in addons_paths.iter() { | ||
| info!("searching modules in {}", addon_path); | ||
| if PathBuf::from(addon_path).exists() { | ||
| //browse all dir in path | ||
|
|
@@ -760,7 +763,7 @@ impl SyncOdoo { | |
|
|
||
| pub fn add_to_rebuild_arch(&mut self, symbol: Rc<RefCell<Symbol>>) { | ||
| if DEBUG_THREADS { | ||
| trace!("ADDED TO ARCH - {}", symbol.borrow().paths().first().unwrap_or(&symbol.borrow().name().to_string())); | ||
| trace!("ADDED TO ARCH - {} - {:?}", symbol.borrow().name(), symbol.borrow().path()); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fda-odoo I had shown you a |
||
| } | ||
| if symbol.borrow().build_status(BuildSteps::ARCH) != BuildStatus::IN_PROGRESS { | ||
| let sym_clone = symbol.clone(); | ||
|
|
@@ -774,7 +777,7 @@ impl SyncOdoo { | |
|
|
||
| pub fn add_to_rebuild_arch_eval(&mut self, symbol: Rc<RefCell<Symbol>>) { | ||
| if DEBUG_THREADS { | ||
| trace!("ADDED TO EVAL - {}", symbol.borrow().paths().first().unwrap_or(&symbol.borrow().name().to_string())); | ||
| trace!("ADDED TO EVAL - {} - {:?}", symbol.borrow().name(), symbol.borrow().path()); | ||
| } | ||
| if symbol.borrow().build_status(BuildSteps::ARCH_EVAL) != BuildStatus::IN_PROGRESS { | ||
| let sym_clone = symbol.clone(); | ||
|
|
@@ -787,7 +790,7 @@ impl SyncOdoo { | |
|
|
||
| pub fn add_to_validations(&mut self, symbol: Rc<RefCell<Symbol>>) { | ||
| if DEBUG_THREADS { | ||
| trace!("ADDED TO VALIDATION - {}", symbol.borrow().paths().first().unwrap_or(&symbol.borrow().name().to_string())); | ||
| trace!("ADDED TO VALIDATION - {} - {:?}", symbol.borrow().name(), symbol.borrow().path()); | ||
| } | ||
| if symbol.borrow().build_status(BuildSteps::VALIDATION) != BuildStatus::IN_PROGRESS { | ||
| symbol.borrow_mut().set_build_status(BuildSteps::VALIDATION, BuildStatus::PENDING); | ||
|
|
@@ -809,10 +812,10 @@ impl SyncOdoo { | |
| } | ||
| if DEBUG_REBUILD_NOW { | ||
| if symbol.borrow().build_status(step) == BuildStatus::INVALID { | ||
| panic!("Trying to build an invalid symbol: {}", symbol.borrow().paths().first().unwrap_or(&symbol.borrow().name().to_string())); | ||
| panic!("Trying to build an invalid symbol: {} - {:?}", symbol.borrow().name(), symbol.borrow().path()); | ||
| } | ||
| if symbol.borrow().build_status(step) == BuildStatus::IN_PROGRESS && !session.sync_odoo.is_in_rebuild(&symbol, step) { | ||
| error!("Trying to build a symbol that is NOT in the queue: {}", symbol.borrow().paths().first().unwrap_or(&symbol.borrow().name().to_string())); | ||
| error!("Trying to build a symbol that is NOT in the queue: {} - {:?}", symbol.borrow().name(), symbol.borrow().path()); | ||
| } | ||
| } | ||
| if symbol.borrow().build_status(step) == BuildStatus::PENDING && symbol.borrow().previous_step_done(step) { | ||
|
|
@@ -826,7 +829,7 @@ impl SyncOdoo { | |
| } else if step == BuildSteps::ARCH_EVAL { | ||
| if DEBUG_REBUILD_NOW { | ||
| if symbol.borrow().build_status(BuildSteps::ARCH) != BuildStatus::DONE { | ||
| panic!("An evaluation has been requested on a non-arched symbol: {}", symbol.borrow().paths().first().unwrap_or(&symbol.borrow().name().to_string())); | ||
| panic!("An evaluation has been requested on a non-arched symbol: {} - {:?}", symbol.borrow().name(), symbol.borrow().path()); | ||
| } | ||
| } | ||
| let mut builder = PythonArchEval::new(entry_point, symbol.clone()); | ||
|
|
@@ -835,7 +838,7 @@ impl SyncOdoo { | |
| } else if step == BuildSteps::VALIDATION { | ||
| if DEBUG_REBUILD_NOW { | ||
| if symbol.borrow().build_status(BuildSteps::ARCH) != BuildStatus::DONE || symbol.borrow().build_status(BuildSteps::ARCH_EVAL) != BuildStatus::DONE { | ||
| panic!("An evaluation has been requested on a non-arched symbol: {}", symbol.borrow().paths().first().unwrap_or(&symbol.borrow().name().to_string())); | ||
| panic!("An evaluation has been requested on a non-arched symbol: {} - {:?}", symbol.borrow().name(), symbol.borrow().path()); | ||
| } | ||
| } | ||
| let mut validator = PythonValidator::new(entry_point, symbol.clone()); | ||
|
|
@@ -951,7 +954,10 @@ impl SyncOdoo { | |
| let mut to_del = Vec::from_iter(path_symbol.borrow().all_module_symbol().map(|x| x.clone())); | ||
| let mut index = 0; | ||
| while index < to_del.len() { | ||
| FileMgr::delete_path(session, &to_del[index].borrow().paths()[0]); | ||
| match to_del[index].borrow().path() { | ||
| SymbolPath::Single(p) => FileMgr::delete_path(session, &p), | ||
| SymbolPath::Multiple(_) | SymbolPath::None => {} | ||
| } | ||
| let mut to_del_child = Vec::from_iter(to_del[index].borrow().all_module_symbol().map(|x| x.clone())); | ||
| to_del.append(&mut to_del_child); | ||
| index += 1; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fda-odoo we wrote this together.
But since then
SymbolPath::as_multiplehas been introduced.Shall I replace this by simply
let addon_paths = addons_symbol.borrow().path().as_multiple()?