update
This commit is contained in:
parent
e8e7466287
commit
a058a7c641
@ -56,6 +56,7 @@ impl LibraryConfig {
|
||||
if file_path.exists() {
|
||||
result.push(file_path);
|
||||
} else {
|
||||
// info!("File {pattern} does not exist");
|
||||
messages.push(Message::warning(format! {"File {pattern} does not exist"}));
|
||||
}
|
||||
} else {
|
||||
@ -76,12 +77,14 @@ impl LibraryConfig {
|
||||
}
|
||||
|
||||
if empty_pattern {
|
||||
// info!("Pattern '{stripped_pattern}' did not match any file");
|
||||
messages.push(Message::warning(format!(
|
||||
"Pattern '{stripped_pattern}' did not match any file"
|
||||
)));
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
// info!("Invalid pattern '{pattern}' {err}");
|
||||
messages.push(Message::error(format!("Invalid pattern '{pattern}' {err}")));
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ impl Project {
|
||||
pub fn from_config(config: Config, messages: &mut dyn MessageHandler) -> Project {
|
||||
let mut project = Project::new(config.standard());
|
||||
let files = project.load_files_from_config(&config, messages);
|
||||
// info!("new project files: {files:#?}");
|
||||
project.parse_and_add_files(files, messages);
|
||||
project.config = config;
|
||||
project
|
||||
@ -87,6 +88,7 @@ impl Project {
|
||||
}
|
||||
|
||||
self.config = config;
|
||||
// info!("new project files: {new_files:#?}");
|
||||
self.parse_and_add_files(new_files, messages);
|
||||
}
|
||||
|
||||
@ -94,26 +96,30 @@ impl Project {
|
||||
let config_str = format!(
|
||||
r#"
|
||||
[libraries]
|
||||
lib.files = ['{:?}']
|
||||
"#, path.to_str().unwrap()
|
||||
lib.files = [{:?}]
|
||||
"#, path.file_name().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);
|
||||
let mut project = Project::from_config(new_config, messages);
|
||||
// info!("new config {:#?}", project.config);
|
||||
project.analyse();
|
||||
project
|
||||
}
|
||||
|
||||
pub fn digital_lsp_update_config( &mut self, path: &PathBuf, messages: &mut dyn MessageHandler) {
|
||||
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()
|
||||
lib.files = [{:?}]
|
||||
"#, path.file_name().unwrap()
|
||||
);
|
||||
if let Ok(mut new_config) = Config::from_str(&config_str, path.parent().unwrap()) {
|
||||
new_config.append(&self.config, messages);
|
||||
if let Ok(new_config) = Config::from_str(&config_str, path.parent().unwrap()) {
|
||||
// info!("update config - new config {:#?}", new_config);
|
||||
// new_config.append(&self.config, messages);
|
||||
// info!("update config - appended config {:#?}", new_config);
|
||||
self.update_config(new_config, messages);
|
||||
info!("update config {:#?}", self.config);
|
||||
// info!("update config - updated {:#?}", self.config);
|
||||
// self.analyse();
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,14 +168,17 @@ lib.files = ['{:?}']
|
||||
self.empty_libraries.clear();
|
||||
|
||||
for library in config.iter_libraries() {
|
||||
//info!("load file: library {library:#?}");
|
||||
let library_name =
|
||||
Latin1String::from_utf8(library.name()).expect("Library name not latin-1 encoded");
|
||||
let library_name = self.parser.symbol(&library_name);
|
||||
|
||||
// info!("load file: library name {library_name:#?}");
|
||||
let mut empty_library = true;
|
||||
for file_name in library.file_names(messages) {
|
||||
empty_library = false;
|
||||
|
||||
// info!("load file: file name {file_name:#?}");
|
||||
match files.entry(FilePath::new(&file_name)) {
|
||||
Entry::Occupied(mut entry) => {
|
||||
entry.get_mut().insert(library_name.clone());
|
||||
@ -210,8 +219,12 @@ lib.files = ['{:?}']
|
||||
|
||||
for (file_name, library_names, parser_diagnostics, result) in parsed.into_iter() {
|
||||
let (source, design_file) = match result {
|
||||
Ok(result) => result,
|
||||
Ok(result) => {
|
||||
// info!("add file {file_name:#?}");
|
||||
result
|
||||
}
|
||||
Err(err) => {
|
||||
// info!("can't add file {file_name:#?} error {:?}", err.to_string());
|
||||
messages.push(Message::file_error(err.to_string(), &file_name));
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user