@@ -61,38 +61,42 @@ impl Backend {
6161 } else {
6262 PathBuf :: from ( "" )
6363 } ;
64+ let mut linter = self . linter . write ( ) . unwrap ( ) ;
65+ if let Some ( ref mut linter) = * linter {
6466
65- let config = self . config . read ( ) . unwrap ( ) ;
66- let mut include_paths = Vec :: new ( ) ;
67- let mut defines = HashMap :: new ( ) ;
68- if let Some ( ref config) = * config {
69- for path in & config. verilog . include_paths {
70- let mut p = root_uri. clone ( ) ;
71- p. push ( PathBuf :: from ( path) ) ;
72- include_paths. push ( p) ;
73- }
74- for define in & config. verilog . defines {
75- let mut define = define. splitn ( 2 , '=' ) ;
76- let ident = String :: from ( define. next ( ) . unwrap ( ) ) ;
77- let text = define
78- . next ( )
79- . and_then ( |x| enquote:: unescape ( x, None ) . ok ( ) )
80- . map ( |x| DefineText :: new ( x, None ) ) ;
81- let define = Define :: new ( ident. clone ( ) , vec ! [ ] , text) ;
82- defines. insert ( ident, Some ( define) ) ;
83- }
84- } ;
85- debug ! ( "include_paths: {:?}" , include_paths) ;
86- debug ! ( "defines: {:?}" , defines) ;
67+ let config = self . config . read ( ) . unwrap ( ) ;
68+ let mut include_paths = Vec :: new ( ) ;
69+ let mut defines = HashMap :: new ( ) ;
70+ if let Some ( ref config) = * config {
71+ for path in & config. verilog . include_paths {
72+ let mut p = root_uri. clone ( ) ;
73+ p. push ( PathBuf :: from ( path) ) ;
74+ include_paths. push ( p) ;
75+ }
76+ for define in & config. verilog . defines {
77+ let mut define = define. splitn ( 2 , '=' ) ;
78+ let ident = String :: from ( define. next ( ) . unwrap ( ) ) ;
79+ let text = define
80+ . next ( )
81+ . and_then ( |x| enquote:: unescape ( x, None ) . ok ( ) )
82+ . map ( |x| DefineText :: new ( x, None ) ) ;
83+ let define = Define :: new ( ident. clone ( ) , vec ! [ ] , text) ;
84+ defines. insert ( ident, Some ( define) ) ;
85+ }
86+ for plugin in & config. verilog . plugins {
87+ debug ! ( "plugin: {:?}" , & plugin) ;
88+ linter. load ( & plugin) . unwrap ( ) ;
89+ }
90+ } ;
91+ debug ! ( "include_paths: {:?}" , include_paths) ;
92+ debug ! ( "defines: {:?}" , defines) ;
8793
88- let src_path = if let Ok ( x) = path. strip_prefix ( root_uri) {
89- x. to_path_buf ( )
90- } else {
91- PathBuf :: from ( "" )
92- } ;
94+ let src_path = if let Ok ( x) = path. strip_prefix ( root_uri) {
95+ x. to_path_buf ( )
96+ } else {
97+ PathBuf :: from ( "" )
98+ } ;
9399
94- let mut linter = self . linter . write ( ) . unwrap ( ) ;
95- if let Some ( ref mut linter) = * linter {
96100 // Iterate over lines in the file, applying each textrule to each line
97101 // in turn.
98102 let mut beg: usize = 0 ;
0 commit comments