Skip to content

Commit 59967f7

Browse files
committed
[IMP] server: various debug improvements
1 parent 8c03506 commit 59967f7

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-7
lines changed

server/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ byteyarn = "0.5.1"
3838
roxmltree = "0.20.0"
3939
dirs = "5.0"
4040
toml = "0.8.22"
41+
# ittapi = "0.3" # profiling with VTune profiler
4142
[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies]
4243
nix = { version = "0.29.0", features = ["process"] }
4344

server/src/constants.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub const DEBUG_ODOO_BUILDER: bool = false;
1010
pub const DEBUG_MEMORY: bool = false;
1111
pub const DEBUG_THREADS: bool = false;
1212
pub const DEBUG_STEPS: bool = false;
13+
pub const DEBUG_STEPS_ONLY_INTERNAL: bool = true;
1314
pub const DEBUG_REBUILD_NOW: bool = false;
1415

1516
pub type Tree = (Vec<OYarn>, Vec<OYarn>);

server/src/core/python_arch_builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use lsp_types::Diagnostic;
99
use tracing::{trace, warn};
1010
use weak_table::traits::WeakElement;
1111

12-
use crate::constants::{BuildStatus, BuildSteps, OYarn, PackageType, SymType, DEBUG_STEPS};
12+
use crate::constants::{BuildStatus, BuildSteps, OYarn, PackageType, SymType, DEBUG_STEPS, DEBUG_STEPS_ONLY_INTERNAL};
1313
use crate::core::python_utils;
1414
use crate::core::import_resolver::resolve_import_stmt;
1515
use crate::core::symbols::symbol::Symbol;
@@ -72,7 +72,7 @@ impl PythonArchBuilder {
7272
self.current_step = if self.file_mode {BuildSteps::ARCH} else {BuildSteps::VALIDATION};
7373
self.ast_indexes = symbol.borrow().ast_indexes().unwrap_or(&vec![]).clone(); //copy current ast_indexes if we are not evaluating a file
7474
}
75-
if DEBUG_STEPS {
75+
if DEBUG_STEPS && (!DEBUG_STEPS_ONLY_INTERNAL || !symbol.borrow().is_external()) {
7676
trace!("building {} - {}", self.file.borrow().paths().first().unwrap_or(&S!("No path found")), symbol.borrow().name());
7777
}
7878
symbol.borrow_mut().set_build_status(BuildSteps::ARCH, BuildStatus::IN_PROGRESS);

server/src/core/python_arch_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl PythonArchEval {
7272
self.file_mode = Rc::ptr_eq(&file, &symbol);
7373
self.current_step = if self.file_mode {BuildSteps::ARCH_EVAL} else {BuildSteps::VALIDATION};
7474
}
75-
if DEBUG_STEPS {
75+
if DEBUG_STEPS && (!DEBUG_STEPS_ONLY_INTERNAL || !symbol.borrow().is_external()) {
7676
trace!("evaluating {} - {}", self.file.borrow().paths().first().unwrap_or(&S!("No path found")), symbol.borrow().name());
7777
}
7878
symbol.borrow_mut().set_build_status(BuildSteps::ARCH_EVAL, BuildStatus::IN_PROGRESS);

server/src/core/python_validator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl PythonValidator {
7878
if self.sym_stack[0].borrow().build_status(BuildSteps::ARCH_EVAL) != BuildStatus::DONE {
7979
return;
8080
}
81-
if DEBUG_STEPS {
81+
if DEBUG_STEPS && (!DEBUG_STEPS_ONLY_INTERNAL || !self.sym_stack[0].borrow().is_external()) {
8282
trace!("Validating {}", self.sym_stack[0].borrow().paths().first().unwrap_or(&S!("No path found")));
8383
}
8484
self.sym_stack[0].borrow_mut().set_build_status(BuildSteps::VALIDATION, BuildStatus::IN_PROGRESS);
@@ -103,7 +103,7 @@ impl PythonValidator {
103103
file_info.replace_diagnostics(BuildSteps::VALIDATION, self.diagnostics.clone());
104104
},
105105
SymType::FUNCTION => {
106-
if DEBUG_STEPS {
106+
if DEBUG_STEPS && (!DEBUG_STEPS_ONLY_INTERNAL || !self.sym_stack[0].borrow().is_external()) {
107107
trace!("Validating function {}", self.sym_stack[0].borrow().name());
108108
}
109109
self.file_mode = false;

server/src/core/xml_validation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ impl XmlValidator {
9494
for (fs, deps) in field_sym.iter() {
9595
if deps.is_none() {
9696
let has_required = fs.borrow().evaluations().unwrap_or(&vec![]).iter()
97-
.any(|eval|
97+
.any(|eval|
9898
eval.symbol.get_symbol_as_weak(session, &mut None, diagnostics, None)
9999
.context.get("required").unwrap_or(&ContextValue::BOOLEAN(false)).as_bool()
100100
);
101101
let has_default = fs.borrow().evaluations().unwrap_or(&vec![]).iter()
102-
.any(|eval|
102+
.any(|eval|
103103
eval.symbol.get_symbol_as_weak(session, &mut None, diagnostics, None)
104104
.context.contains_key("default")
105105
);

0 commit comments

Comments
 (0)