mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-25 15:16:07 +00:00
Add more diagnostics
This commit is contained in:
@@ -63,13 +63,18 @@ impl RbxSession {
|
|||||||
let closest_path = self.path_map.descend(root_path, path);
|
let closest_path = self.path_map.descend(root_path, path);
|
||||||
let &instance_id = self.path_map.get(&closest_path).unwrap();
|
let &instance_id = self.path_map.get(&closest_path).unwrap();
|
||||||
|
|
||||||
|
trace!("Snapshotting path {}", closest_path.display());
|
||||||
|
|
||||||
let snapshot = snapshot_instances_from_imfs(&imfs, &closest_path, &mut self.sync_point_names)
|
let snapshot = snapshot_instances_from_imfs(&imfs, &closest_path, &mut self.sync_point_names)
|
||||||
.expect("Could not generate instance snapshot");
|
.expect("Could not generate instance snapshot");
|
||||||
|
|
||||||
reconcile_subtree(&mut self.tree, instance_id, &snapshot, &mut self.path_map, &mut self.instance_metadata_map, &mut changes);
|
reconcile_subtree(&mut self.tree, instance_id, &snapshot, &mut self.path_map, &mut self.instance_metadata_map, &mut changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !changes.is_empty() {
|
if changes.is_empty() {
|
||||||
|
trace!("No instance changes triggered from file update.");
|
||||||
|
} else {
|
||||||
|
trace!("Pushing changes: {}", changes);
|
||||||
self.message_queue.push_messages(&[changes]);
|
self.message_queue.push_messages(&[changes]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +93,10 @@ impl RbxSession {
|
|||||||
// If the path doesn't exist or it's a directory, we don't care if it
|
// If the path doesn't exist or it's a directory, we don't care if it
|
||||||
// updated
|
// updated
|
||||||
match imfs.get(path) {
|
match imfs.get(path) {
|
||||||
Some(ImfsItem::Directory(_)) | None => return,
|
Some(ImfsItem::Directory(_)) | None => {
|
||||||
|
trace!("Updated path was a directory, ignoring.");
|
||||||
|
return;
|
||||||
|
},
|
||||||
Some(ImfsItem::File(_)) => {},
|
Some(ImfsItem::File(_)) => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,7 +109,12 @@ impl RbxSession {
|
|||||||
|
|
||||||
let instance_id = match self.path_map.remove(path) {
|
let instance_id = match self.path_map.remove(path) {
|
||||||
Some(id) => id,
|
Some(id) => id,
|
||||||
None => return,
|
None => {
|
||||||
|
// TODO: init.lua files won't be in the path map, that should be
|
||||||
|
// patched up!
|
||||||
|
trace!("Path was not in path map, ignoring removal.");
|
||||||
|
return;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let removed_subtree = match self.tree.remove_instance(instance_id) {
|
let removed_subtree = match self.tree.remove_instance(instance_id) {
|
||||||
@@ -118,6 +131,8 @@ impl RbxSession {
|
|||||||
updated: HashSet::new(),
|
updated: HashSet::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
trace!("Pushing changes: {}", changes);
|
||||||
|
|
||||||
self.message_queue.push_messages(&[changes]);
|
self.message_queue.push_messages(&[changes]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use std::{
|
|||||||
str,
|
str,
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
|
fmt,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -19,6 +20,35 @@ pub struct InstanceChanges {
|
|||||||
pub updated: HashSet<RbxId>,
|
pub updated: HashSet<RbxId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for InstanceChanges {
|
||||||
|
fn fmt(&self, output: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
writeln!(output, "InstanceChanges {{")?;
|
||||||
|
|
||||||
|
if !self.added.is_empty() {
|
||||||
|
writeln!(output, " Added:")?;
|
||||||
|
for id in &self.added {
|
||||||
|
writeln!(output, " {}", id)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.removed.is_empty() {
|
||||||
|
writeln!(output, " Removed:")?;
|
||||||
|
for id in &self.removed {
|
||||||
|
writeln!(output, " {}", id)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.updated.is_empty() {
|
||||||
|
writeln!(output, " Updated:")?;
|
||||||
|
for id in &self.updated {
|
||||||
|
writeln!(output, " {}", id)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeln!(output, "}}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl InstanceChanges {
|
impl InstanceChanges {
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.added.is_empty() && self.removed.is_empty() && self.updated.is_empty()
|
self.added.is_empty() && self.removed.is_empty() && self.updated.is_empty()
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ impl<'a> fmt::Display for VisualizeRbxTree<'a> {
|
|||||||
fn visualize_rbx_node(tree: &RbxTree, id: RbxId, output: &mut fmt::Formatter) -> fmt::Result {
|
fn visualize_rbx_node(tree: &RbxTree, id: RbxId, output: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let node = tree.get_instance(id).unwrap();
|
let node = tree.get_instance(id).unwrap();
|
||||||
|
|
||||||
writeln!(output, " \"{}\" [label=\"{}\"]", id, node.name)?;
|
writeln!(output, " \"{}\" [label=\"{} ({})\"]", id, node.name, node.class_name)?;
|
||||||
|
|
||||||
for &child_id in node.get_children_ids() {
|
for &child_id in node.get_children_ids() {
|
||||||
writeln!(output, " \"{}\" -> \"{}\"", id, child_id)?;
|
writeln!(output, " \"{}\" -> \"{}\"", id, child_id)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user