@@ -11,6 +11,7 @@ use crate::completion::{list_completion_options, CompletionItem};
11
11
use crate :: config:: Config ;
12
12
use crate :: lint:: dead_code:: UnusedDeclarationsLinter ;
13
13
use crate :: named_entity:: { AnyEnt , EntRef } ;
14
+ use crate :: standard:: VHDLStandard ;
14
15
use crate :: syntax:: VHDLParser ;
15
16
use crate :: { data:: * , EntHierarchy , EntityId } ;
16
17
use fnv:: { FnvHashMap , FnvHashSet } ;
@@ -28,8 +29,8 @@ pub struct Project {
28
29
}
29
30
30
31
impl Project {
31
- pub fn new ( ) -> Project {
32
- let parser = VHDLParser :: default ( ) ;
32
+ pub fn new ( vhdl_standard : VHDLStandard ) -> Project {
33
+ let parser = VHDLParser :: new ( vhdl_standard ) ;
33
34
Project {
34
35
root : DesignRoot :: new ( parser. symbols . clone ( ) ) ,
35
36
files : FnvHashMap :: default ( ) ,
@@ -47,7 +48,7 @@ impl Project {
47
48
/// Create instance from given configuration.
48
49
/// Files referred by configuration are parsed into corresponding libraries.
49
50
pub fn from_config ( config : Config , messages : & mut dyn MessageHandler ) -> Project {
50
- let mut project = Project :: new ( ) ;
51
+ let mut project = Project :: new ( config . standard ( ) ) ;
51
52
let files = project. load_files_from_config ( & config, messages) ;
52
53
project. parse_and_add_files ( files, messages) ;
53
54
project. config = config;
@@ -58,7 +59,7 @@ impl Project {
58
59
/// The design state is reset, new files are added and parsed. Existing source files will be
59
60
/// kept and parsed from in-memory source (required for incremental document updates).
60
61
pub fn update_config ( & mut self , config : Config , messages : & mut dyn MessageHandler ) {
61
- self . parser = VHDLParser :: default ( ) ;
62
+ self . parser = VHDLParser :: new ( config . standard ( ) ) ;
62
63
self . root = DesignRoot :: new ( self . parser . symbols . clone ( ) ) ;
63
64
64
65
// Reset library associations for known files,
@@ -344,12 +345,6 @@ fn multiply<T: Clone>(value: T, n: usize) -> Vec<T> {
344
345
}
345
346
}
346
347
347
- impl Default for Project {
348
- fn default ( ) -> Self {
349
- Self :: new ( )
350
- }
351
- }
352
-
353
348
pub struct SourceFile {
354
349
library_names : FnvHashSet < Symbol > ,
355
350
source : Source ,
0 commit comments