mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-01 10:58:12 +08:00
Generate a visualization of the editor's hierarchical message system tree (#2499)
* Feat: implement the hierarchical tree for visualization * rename HierarchicalTree trait function * feat: change the HierarchicalTree from String to DebugMessageTree struct * Nits * feat: impliment proc macro to extract field from messagedata structs * update the hierarchical-tree for hanlder data * feat: added message handler struct to hierarchical tree * feat: add the line number to message handler struct * feat: added handler path to tree and NITS * clean the white spaces in type string * fixes some white spaces * feat: added path to message enum in hierarchical tree * feat: add file creation of hierarchical message system tree * cleanup * Code review * Add todo comment for deferred change --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
d0e1d8982f
commit
00236c8136
@@ -42,6 +42,58 @@ pub fn two_segment_path(left_ident: Ident, right_ident: Ident) -> Path {
|
||||
Path { leading_colon: None, segments }
|
||||
}
|
||||
|
||||
pub fn clean_rust_type_syntax(input: String) -> String {
|
||||
let mut result = String::new();
|
||||
let mut chars = input.chars().peekable();
|
||||
|
||||
while let Some(c) = chars.next() {
|
||||
match c {
|
||||
'&' => {
|
||||
result.push('&');
|
||||
while let Some(' ') = chars.peek() {
|
||||
chars.next();
|
||||
}
|
||||
}
|
||||
'<' => {
|
||||
while let Some(' ') = result.chars().rev().next() {
|
||||
result.pop();
|
||||
}
|
||||
result.push('<');
|
||||
while let Some(' ') = chars.peek() {
|
||||
chars.next();
|
||||
}
|
||||
}
|
||||
'>' => {
|
||||
while let Some(' ') = result.chars().rev().next() {
|
||||
result.pop();
|
||||
}
|
||||
result.push('>');
|
||||
while let Some(' ') = chars.peek() {
|
||||
chars.next();
|
||||
}
|
||||
}
|
||||
':' => {
|
||||
if let Some(':') = chars.peek() {
|
||||
while let Some(' ') = result.chars().rev().next() {
|
||||
result.pop();
|
||||
}
|
||||
}
|
||||
result.push(':');
|
||||
chars.next();
|
||||
result.push(':');
|
||||
while let Some(' ') = chars.peek() {
|
||||
chars.next();
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
result.push(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user