update & save
This commit is contained in:
parent
8593beff8c
commit
e8e7466287
@ -29,6 +29,7 @@ itertools = "0"
|
||||
subst = "0.3.0"
|
||||
strum = { version = "0.26.2", features = ["derive"] }
|
||||
enum-map = "2.7.3"
|
||||
log = "0.4.19"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
|
@ -14,6 +14,7 @@ use crate::named_entity::EntRef;
|
||||
use crate::standard::VHDLStandard;
|
||||
use crate::syntax::VHDLParser;
|
||||
use crate::{data::*, EntHierarchy, EntityId};
|
||||
use log::info;
|
||||
use fnv::{FnvHashMap, FnvHashSet};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::path::Path;
|
||||
@ -89,14 +90,33 @@ impl Project {
|
||||
self.parse_and_add_files(new_files, messages);
|
||||
}
|
||||
|
||||
pub fn new_without_config(path: &PathBuf, messages: &mut dyn MessageHandler, standard: Option<VHDLStandard>) -> Project {
|
||||
let mut project = Project::new(standard.unwrap_or(VHDLStandard::VHDL2008));
|
||||
let file = project.load_file_without_config(&path);
|
||||
project.parse_and_add_files(file, messages);
|
||||
// project.config = Config::default();
|
||||
pub fn new_without_config(path: &PathBuf, messages: &mut dyn MessageHandler) -> Project {
|
||||
let config_str = format!(
|
||||
r#"
|
||||
[libraries]
|
||||
lib.files = ['{:?}']
|
||||
"#, path.to_str().unwrap()
|
||||
);
|
||||
let new_config = Config::from_str(&config_str, path.parent().unwrap()).unwrap();
|
||||
let project = Project::from_config(new_config, messages);
|
||||
info!("new config {:#?}", project.config);
|
||||
project
|
||||
}
|
||||
|
||||
pub fn digital_lsp_update_config( &mut self, path: &PathBuf, messages: &mut dyn MessageHandler) {
|
||||
let config_str = format!(
|
||||
r#"
|
||||
[libraries]
|
||||
lib.files = ['{:?}']
|
||||
"#, path.to_str().unwrap()
|
||||
);
|
||||
if let Ok(mut new_config) = Config::from_str(&config_str, path.parent().unwrap()) {
|
||||
new_config.append(&self.config, messages);
|
||||
self.update_config(new_config, messages);
|
||||
info!("update config {:#?}", self.config);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_file(
|
||||
&mut self,
|
||||
path: &PathBuf,
|
||||
|
Loading…
x
Reference in New Issue
Block a user