mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Add line numbers to file paths in the website editor structure docs (#3130)
* added the line number to existing path * Update JS parser to use line numbers --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -49,11 +49,11 @@ pub trait HierarchicalTree {
|
||||
fn build_message_tree() -> DebugMessageTree;
|
||||
|
||||
fn message_handler_data_str() -> MessageData {
|
||||
MessageData::new(String::new(), Vec::new(), "")
|
||||
MessageData::new(String::new(), Vec::new(), "", 0)
|
||||
}
|
||||
|
||||
fn message_handler_str() -> MessageData {
|
||||
MessageData::new(String::new(), Vec::new(), "")
|
||||
MessageData::new(String::new(), Vec::new(), "", 0)
|
||||
}
|
||||
|
||||
fn path() -> &'static str {
|
||||
@@ -64,5 +64,6 @@ pub trait HierarchicalTree {
|
||||
pub trait ExtractField {
|
||||
fn field_types() -> Vec<(String, usize)>;
|
||||
fn path() -> &'static str;
|
||||
fn line_number() -> usize;
|
||||
fn print_field_types();
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@ pub struct MessageData {
|
||||
name: String,
|
||||
fields: Vec<(String, usize)>,
|
||||
path: &'static str,
|
||||
line_number: usize,
|
||||
}
|
||||
|
||||
impl MessageData {
|
||||
pub fn new(name: String, fields: Vec<(String, usize)>, path: &'static str) -> MessageData {
|
||||
MessageData { name, fields, path }
|
||||
pub fn new(name: String, fields: Vec<(String, usize)>, path: &'static str, line_number: usize) -> MessageData {
|
||||
MessageData { name, fields, path, line_number }
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &str {
|
||||
@@ -21,6 +22,10 @@ impl MessageData {
|
||||
pub fn path(&self) -> &'static str {
|
||||
self.path
|
||||
}
|
||||
|
||||
pub fn line_number(&self) -> usize {
|
||||
self.line_number
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -31,6 +36,7 @@ pub struct DebugMessageTree {
|
||||
message_handler: Option<MessageData>,
|
||||
message_handler_data: Option<MessageData>,
|
||||
path: &'static str,
|
||||
line_number: usize,
|
||||
}
|
||||
|
||||
impl DebugMessageTree {
|
||||
@@ -42,6 +48,7 @@ impl DebugMessageTree {
|
||||
message_handler: None,
|
||||
message_handler_data: None,
|
||||
path: "",
|
||||
line_number: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +60,10 @@ impl DebugMessageTree {
|
||||
self.path = path;
|
||||
}
|
||||
|
||||
pub fn set_line_number(&mut self, line_number: usize) {
|
||||
self.line_number = line_number
|
||||
}
|
||||
|
||||
pub fn add_variant(&mut self, variant: DebugMessageTree) {
|
||||
if let Some(variants) = &mut self.variants {
|
||||
variants.push(variant);
|
||||
@@ -81,6 +92,10 @@ impl DebugMessageTree {
|
||||
self.path
|
||||
}
|
||||
|
||||
pub fn line_number(&self) -> usize {
|
||||
self.line_number
|
||||
}
|
||||
|
||||
pub fn variants(&self) -> Option<&Vec<DebugMessageTree>> {
|
||||
self.variants.as_ref()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user