@@ -5,7 +5,7 @@ use once_cell::sync::Lazy;
5
5
use regex:: Regex ;
6
6
use roxmltree:: Node ;
7
7
8
- use crate :: { constants:: { BuildStatus , BuildSteps , OYarn , EXTENSION_NAME } , core:: { diagnostics:: { create_diagnostic, DiagnosticCode } , xml_data:: { XmlData , XmlDataActWindow , XmlDataDelete , XmlDataField , XmlDataMenuItem , XmlDataRecord , XmlDataReport , XmlDataTemplate } } , oyarn, threads:: SessionInfo , Sy , S } ;
8
+ use crate :: { constants:: { BuildStatus , BuildSteps , OYarn , EXTENSION_NAME } , core:: { diagnostics:: { create_diagnostic, DiagnosticCode } , xml_data:: { XmlData , XmlDataDelete , XmlDataField , XmlDataMenuItem , XmlDataRecord , XmlDataTemplate } } , oyarn, threads:: SessionInfo , Sy , S } ;
9
9
10
10
use super :: xml_arch_builder:: XmlArchBuilder ;
11
11
@@ -39,8 +39,6 @@ impl XmlArchBuilder {
39
39
|| self . load_record ( session, & child, diagnostics)
40
40
|| self . load_template ( session, & child, diagnostics)
41
41
|| self . load_delete ( session, & child, diagnostics)
42
- || self . load_act_window ( session, & child, diagnostics)
43
- || self . load_report ( session, & child, diagnostics)
44
42
|| self . load_function ( session, & child, diagnostics)
45
43
|| child. is_text ( ) || child. is_comment ( ) ) {
46
44
if let Some ( diagnostic) = create_diagnostic ( session, DiagnosticCode :: OLS05005 , & [ child. tag_name ( ) . name ( ) , node. tag_name ( ) . name ( ) ] ) {
@@ -509,121 +507,6 @@ impl XmlArchBuilder {
509
507
true
510
508
}
511
509
512
- fn load_act_window ( & mut self , session : & mut SessionInfo , node : & Node , diagnostics : & mut Vec < Diagnostic > ) -> bool {
513
- if node. tag_name ( ) . name ( ) != "act_window" { return false ; }
514
- let mut found_id = None ;
515
- for attr in [ "id" , "name" , "res_model" ] {
516
- if node. attribute ( attr) . is_none ( ) {
517
- if let Some ( diagnostic) = create_diagnostic ( session, DiagnosticCode :: OLS05036 , & [ attr] ) {
518
- diagnostics. push ( Diagnostic {
519
- range : Range { start : Position :: new ( node. range ( ) . start as u32 , 0 ) , end : Position :: new ( node. range ( ) . end as u32 , 0 ) } ,
520
- ..diagnostic. clone ( )
521
- } ) ;
522
- }
523
- }
524
- if attr == "id" {
525
- found_id = node. attribute ( attr) . map ( |v| v. to_string ( ) ) ;
526
- }
527
- }
528
- for attr in node. attributes ( ) {
529
- match attr. name ( ) {
530
- "id" | "name" | "res_model" => { } ,
531
- "domain" | "view_mode" | "view_id" | "target" | "context" | "groups" | "limit" | "usage" | "binding_model" => { } ,
532
- "binding_type" => {
533
- if attr. value ( ) != "action" && attr. value ( ) != "report" {
534
- if let Some ( diagnostic) = create_diagnostic ( session, DiagnosticCode :: OLS05039 , & [ attr. value ( ) ] ) {
535
- diagnostics. push ( Diagnostic {
536
- range : Range { start : Position :: new ( attr. range ( ) . start as u32 , 0 ) , end : Position :: new ( attr. range ( ) . end as u32 , 0 ) } ,
537
- ..diagnostic. clone ( )
538
- } ) ;
539
- }
540
- }
541
- } ,
542
- "binding_views" => {
543
- if !BINDING_VIEWS_RE . is_match ( attr. value ( ) ) {
544
- if let Some ( diagnostic) = create_diagnostic ( session, DiagnosticCode :: OLS05040 , & [ attr. value ( ) ] ) {
545
- diagnostics. push ( Diagnostic {
546
- range : Range { start : Position :: new ( attr. range ( ) . start as u32 , 0 ) , end : Position :: new ( attr. range ( ) . end as u32 , 0 ) } ,
547
- ..diagnostic. clone ( )
548
- } ) ;
549
- }
550
- }
551
- } ,
552
- _ => {
553
- if let Some ( diagnostic) = create_diagnostic ( session, DiagnosticCode :: OLS05037 , & [ attr. name ( ) ] ) {
554
- diagnostics. push ( Diagnostic {
555
- range : Range { start : Position :: new ( attr. range ( ) . start as u32 , 0 ) , end : Position :: new ( attr. range ( ) . end as u32 , 0 ) } ,
556
- ..diagnostic. clone ( )
557
- } ) ;
558
- }
559
- }
560
- }
561
- }
562
- if node. text ( ) . is_some ( ) {
563
- if let Some ( diagnostic) = create_diagnostic ( session, DiagnosticCode :: OLS05038 , & [ ] ) {
564
- diagnostics. push ( Diagnostic {
565
- range : Range { start : Position :: new ( node. range ( ) . start as u32 , 0 ) , end : Position :: new ( node. range ( ) . end as u32 , 0 ) } ,
566
- ..diagnostic. clone ( )
567
- } ) ;
568
- }
569
- }
570
- let data = XmlData :: ACT_WINDOW ( XmlDataActWindow {
571
- file_symbol : Rc :: downgrade ( & self . xml_symbol ) ,
572
- xml_id : found_id. clone ( ) . map ( |id| oyarn ! ( "{}" , id) ) ,
573
- res_model : Sy ! ( node. attribute( "res_model" ) . unwrap( ) . to_string( ) ) ,
574
- name : Sy ! ( node. attribute( "name" ) . unwrap( ) . to_string( ) ) ,
575
- } ) ;
576
- self . on_operation_creation ( session, found_id, node, data, diagnostics) ;
577
- true
578
- }
579
-
580
- fn load_report ( & mut self , session : & mut SessionInfo , node : & Node , diagnostics : & mut Vec < Diagnostic > ) -> bool {
581
- if node. tag_name ( ) . name ( ) != "report" { return false ; }
582
- let mut found_id = None ;
583
- for attr in [ "string" , "model" , "name" ] {
584
- if node. attribute ( attr) . is_none ( ) {
585
- if let Some ( diagnostic) = create_diagnostic ( session, DiagnosticCode :: OLS05041 , & [ attr] ) {
586
- diagnostics. push ( Diagnostic {
587
- range : Range { start : Position :: new ( node. range ( ) . start as u32 , 0 ) , end : Position :: new ( node. range ( ) . end as u32 , 0 ) } ,
588
- ..diagnostic. clone ( )
589
- } ) ;
590
- }
591
- }
592
- }
593
- for attr in node. attributes ( ) {
594
- match attr. name ( ) {
595
- "id" => { found_id = Some ( attr. value ( ) . to_string ( ) ) ; } ,
596
- "print_report_name" | "report_type" | "multi" | "menu" | "keyword" | "file" |
597
- "xml" | "parser" | "auto" | "header" | "attachment" | "attachment_use" | "groups" | "paperformat" | "usage" => { } ,
598
- _ => {
599
- if let Some ( diagnostic) = create_diagnostic ( session, DiagnosticCode :: OLS05042 , & [ attr. name ( ) ] ) {
600
- diagnostics. push ( Diagnostic {
601
- range : Range { start : Position :: new ( attr. range ( ) . start as u32 , 0 ) , end : Position :: new ( attr. range ( ) . end as u32 , 0 ) } ,
602
- ..diagnostic. clone ( )
603
- } ) ;
604
- }
605
- }
606
- }
607
- }
608
- if node. text ( ) . is_some ( ) {
609
- if let Some ( diagnostic) = create_diagnostic ( session, DiagnosticCode :: OLS05043 , & [ ] ) {
610
- diagnostics. push ( Diagnostic {
611
- range : Range { start : Position :: new ( node. range ( ) . start as u32 , 0 ) , end : Position :: new ( node. range ( ) . end as u32 , 0 ) } ,
612
- ..diagnostic. clone ( )
613
- } ) ;
614
- }
615
- }
616
- let data = XmlData :: REPORT ( XmlDataReport {
617
- file_symbol : Rc :: downgrade ( & self . xml_symbol ) ,
618
- xml_id : found_id. clone ( ) . map ( |id| oyarn ! ( "{}" , id) ) ,
619
- name : Sy ! ( node. attribute( "name" ) . unwrap( ) . to_string( ) ) ,
620
- model : Sy ! ( node. attribute( "model" ) . unwrap( ) . to_string( ) ) ,
621
- string : Sy ! ( node. attribute( "string" ) . unwrap( ) . to_string( ) ) ,
622
- } ) ;
623
- self . on_operation_creation ( session, found_id, node, data, diagnostics) ;
624
- true
625
- }
626
-
627
510
fn load_function ( & mut self , session : & mut SessionInfo , node : & Node , diagnostics : & mut Vec < Diagnostic > ) -> bool {
628
511
if node. tag_name ( ) . name ( ) != "function" { return false ; }
629
512
for attr in [ "model" , "name" ] {
0 commit comments