You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: server/src/core/python_arch_eval_hooks.rs
+37-16Lines changed: 37 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -435,36 +435,57 @@ impl PythonArchEvalHooks {
435
435
letmut f = file_symbol.borrow_mut();
436
436
f.add_model_dependencies(model);
437
437
}
438
-
let symbols = model.clone().borrow().get_main_symbols(session, from_module.clone(),&mutNone);
438
+
let model = model.clone();
439
+
let model = model.borrow();
440
+
let symbols = model.get_main_symbols(session, from_module.clone(),&mutNone);
439
441
if !symbols.is_empty(){
440
442
for s in symbols.iter(){
441
443
if from_module.is_none() || ModuleSymbol::is_in_deps(session,&from_module.as_ref().unwrap(),&s.borrow().find_module().unwrap().borrow().as_module_package().dir_name,&mutNone){
//still here? If from module is set, dependencies are not met
447
+
}else{
446
448
if from_module.is_some(){
449
+
//retry without from_module to see if model exists elsewhere
450
+
let symbols = model.get_main_symbols(session,None,&mutNone);
451
+
if symbols.is_empty(){
452
+
let range = FileMgr::textRange_to_temporary_Range(&context.get(&S!("range")).unwrap().as_text_range());
453
+
diagnostics.push(Diagnostic::new(range,
454
+
Some(DiagnosticSeverity::ERROR),
455
+
Some(NumberOrString::String(S!("OLS30105"))),
456
+
Some(EXTENSION_NAME.to_string()),
457
+
S!("This model is inherited, but never declared."),
458
+
None,
459
+
None
460
+
)
461
+
);
462
+
}else{
463
+
let range = FileMgr::textRange_to_temporary_Range(&context.get(&S!("range")).unwrap().as_text_range());
464
+
let valid_modules:Vec<String> = symbols.iter().map(|s| match s.borrow().find_module(){
465
+
Some(sym) => sym.borrow().name().clone(),
466
+
None => S!("Unknown").clone()
467
+
}).collect();
468
+
diagnostics.push(Diagnostic::new(range,
469
+
Some(DiagnosticSeverity::ERROR),
470
+
Some(NumberOrString::String(S!("OLS30101"))),
471
+
Some(EXTENSION_NAME.to_string()),
472
+
format!("This model is not declared in the dependencies of your module. You should consider adding one of the following dependency: {:?}", valid_modules),
473
+
None,
474
+
None
475
+
)
476
+
);
477
+
}
478
+
}else{
447
479
let range = FileMgr::textRange_to_temporary_Range(&context.get(&S!("range")).unwrap().as_text_range());
448
480
diagnostics.push(Diagnostic::new(range,
449
481
Some(DiagnosticSeverity::ERROR),
450
-
Some(NumberOrString::String(S!("OLS30101"))),
482
+
Some(NumberOrString::String(S!("OLS30102"))),
451
483
Some(EXTENSION_NAME.to_string()),
452
-
S!("This model is not in the dependencies of your module."),
484
+
S!("Unknown model. Check your addons path"),
453
485
None,
454
486
None
455
-
)
456
-
);
487
+
));
457
488
}
458
-
}else{
459
-
let range = FileMgr::textRange_to_temporary_Range(&context.get(&S!("range")).unwrap().as_text_range());
460
-
diagnostics.push(Diagnostic::new(range,
461
-
Some(DiagnosticSeverity::ERROR),
462
-
Some(NumberOrString::String(S!("OLS30102"))),
463
-
Some(EXTENSION_NAME.to_string()),
464
-
S!("Unknown model. Check your addons path"),
465
-
None,
466
-
None
467
-
));
468
489
}
469
490
}else{
470
491
let range = FileMgr::textRange_to_temporary_Range(&context.get(&S!("range")).unwrap().as_text_range());
0 commit comments